diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2021-01-22 09:22:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-22 09:22:22 -0500 |
commit | d0a54068a3ba00bcd7b29433dee8894cabf17fa3 (patch) | |
tree | e50d72afa1b940a6b3fd1155b6d91166d4905f0b /.travis | |
parent | 8ea80fbd465a3bdc0a35faaaf1385039ec6031bb (diff) |
Properly handle arguments and responses for triggering Docker builds. (#10545)
This moves the actual cURL command to a script, which both properly
handles the required parameters and also checks the results of the call
so that it throws an error if triggering the Docker build fails.
Diffstat (limited to '.travis')
-rwxr-xr-x | .travis/trigger_docker_build.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.travis/trigger_docker_build.sh b/.travis/trigger_docker_build.sh new file mode 100755 index 0000000000..bc0966c3b7 --- /dev/null +++ b/.travis/trigger_docker_build.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +token="${0}" +version="${1}" + +resp="$(curl -X POST \ + -H 'Accept: application/vnd.github.v3+json' \ + -H "Authorization: Bearer ${token}" \ + "https://api.github.com/repos/netdata/netdata/actions/workflows/docker.yml/dispatches" \ + -d "{\"ref\": \"master\", \"inputs\": {\"version\": \"${version}\"}}")" + +if [ -z "${resp}" ]; then + echo "Successfully triggered Docker image build." + exit 0 +else + echo "Failed to trigger Docker image build. Output:" + echo "${resp}" + exit 1 +fi |