-
Notifications
You must be signed in to change notification settings - Fork 1
Add logging to DD, attempt to make shutdown more graceful #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
d86f209
Add --include-deps option to Docker image pulls and retries to Docker…
bjreath c5883ed
Merge pull request #8 from joinhandshake/apr/4.16.0-port
rayalan 0782f49
Fix for graceful shutdown option. Don't call docker rm --force until …
853a524
Merge remote-tracking branch 'upstream/master' into davkutalek/premat…
af54780
working on testing graceful shutdown fix
bebc54f
fixed broken tests
1b6df23
try running docker shell arg in [] to use exec mode
dc72a0f
try graceful compose shutdown
553a8d6
pass service name arg to stop/wait
4dbb936
exit upon getting term signal, otherwise service restarts
846e1bc
Don't run docker command in subshell, obviously signals wont make it\!
e5fd440
rewrite run.sh to use docker compose exec form. All the tests broke, …
99c0fc3
revert previous since it isn't working
722c50e
attempt to run shell script without sh -c which creates new shell
47d200d
syntax fix
aa1220c
try subshell with direct command
8e06129
refactor subshell to make it a little clearer, prevent exitcode -u issue
1a5d072
try not using a subshell again
385869d
Revert failed changes, Cleanup with some learnings. all tests passing
4eeae5d
one last attempt with no subshell and no sh -c
2e15fd5
use subshell but not bin/sh
88a6602
use bin/sh without e flag
8714720
fix service ref
8189dcf
revert prev
d21572b
no subshell
fccdf08
no sh
92ae4b4
revert
6490c0b
add logging
2d801bb
revert remove sh
130008f
Merge tag 'v4.16.0.1' into davkutalek/premature-kill-fix
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
|
|
||
| log() { | ||
| msg="SIG $1 received, process exiting" | ||
| echo "${msg}" | ||
| buildkite-agent meta-data set "dd_tags.job-signal-${BUILDKITE_STEP_KEY}" "$1" | ||
| buildkite-agent meta-data set "dd_tags.step-error-code-${BUILDKITE_STEP_KEY}" "$1" | ||
| buildkite-agent meta-data set "dd_tags.job-error-code-${BUILDKITE_JOB_ID}" "$1" | ||
|
|
||
| echo "$(pidof buildkite-agent) is the pid of the buildkite agent" || true | ||
|
|
||
| send_job_signaled_to_dd "${msg}" "${1}" | ||
| } | ||
|
|
||
| send_job_signaled_to_dd() { | ||
| send_event_to_dd '{ "title": "Job '"${BUILDKITE_STEP_KEY}"' received signal", "text": "'"${1}"'", "alert_type": "error", "tags": [ "ci:job_signal", "exit_status:'"${2}"'", "job_name:'"${BUILDKITE_STEP_KEY}"'", "build_id:'"${BUILDKITE_BUILD_ID}"'", "branch:'"${BUILDKITE_BRANCH}"'", "hs_source:docker_compose_plugin", "env:ci" ] }' | ||
| } | ||
|
|
||
| send_event_to_dd() { | ||
| if command -v curl >/dev/null 2>&1; then | ||
| echo "Using curl to send event to Datadog" | ||
| curl -X POST "https://api.datadoghq.com/api/v1/events" \ | ||
| -H "Accept: application/json" \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "DD-API-KEY: ${DD_API_KEY}" \ | ||
| -d "$1" | ||
| elif command -v wget >/dev/null 2>&1; then | ||
| echo "Using wget to send event to Datadog" | ||
| wget \ | ||
| --header="Accept: application/json" \ | ||
| --header="Content-Type: application/json" \ | ||
| --header="DD-API-KEY: ${DD_API_KEY}" \ | ||
| --post-data="$1" \ | ||
| --output-document - \ | ||
| https://api.datadoghq.com/api/v1/events | ||
| else | ||
| echo "No suitable network tool found to send event to Datadog" | ||
| exit 1 | ||
| fi | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unneccessary if we use the
|| exitcode=$?syntax.