Skip to content

Commit

Permalink
Add always-upload config option
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansch committed Mar 12, 2021
1 parent 4621e87 commit 17bac3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ check_linked_containers_and_save_logs() {
[[ -d "$logdir" ]] && rm -rf "$logdir"
mkdir -p "$logdir"

always_upload=()
while read -r name ; do
if [[ -n "$name" ]] ; then
always_upload+=("$name")
fi
done <<< "$(plugin_read_list ALWAYS_UPLOAD)"

# Get list of container if to service labels
containers=()
while IFS=$'\n' read -r container ; do
Expand All @@ -65,6 +72,8 @@ check_linked_containers_and_save_logs() {
echo "+++ :warning: Linked service $service_name exited with $service_exit_code"
plugin_prompt_and_run docker logs --timestamps --tail 5 "$service_container_id"
docker logs -t "$service_container_id" &>"${logdir}/${service_name}.log"
elif in_array "$service_name" "${always_upload[@]}"; then
docker logs -t "$service_container_id" &>"${logdir}/${service_name}.log"
elif $uploadall; then
docker logs -t "$service_container_id" &>"${logdir}/${service_name}.log"
fi
Expand Down
3 changes: 3 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ configuration:
type: boolean
upload-container-logs:
type: string
always-upload:
type: [ string, array ]
minimum: 1
propagate-uid-gid:
type: boolean
mount-buildkite-agent:
Expand Down

0 comments on commit 17bac3a

Please sign in to comment.