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.
This commit is contained in:
parent
8ea80fbd46
commit
d0a54068a3
14
.travis.yml
14
.travis.yml
|
@ -361,12 +361,7 @@ jobs:
|
|||
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Draft release submission failed"
|
||||
|
||||
- name: Trigger Docker image build and publish
|
||||
script: >-
|
||||
curl -X POST \
|
||||
-H 'Accept: application/vnd.github.v3+json' \
|
||||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
||||
'https://api.github.com/repos/netdata/netdata/actions/workflows/docker.yml/dispatches' \
|
||||
-d '{"ref": "master", "inputs": {"version": "${build_version}"}}'
|
||||
script: .travis/trigger_docker_build.sh "${GITHUB_TOKEN}" "${BUILD_VERSION}"
|
||||
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger docker build during release" "${NOTIF_CHANNEL}"
|
||||
|
||||
- stage: Trigger deb and rpm package build (release)
|
||||
|
@ -462,12 +457,7 @@ jobs:
|
|||
after_deploy: rm -f .travis/gcs-credentials.json
|
||||
|
||||
- name: Trigger Docker image build and publish
|
||||
script: >-
|
||||
curl -X POST \
|
||||
-H 'Accept: application/vnd.github.v3+json' \
|
||||
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
|
||||
'https://api.github.com/repos/netdata/netdata/actions/workflows/docker.yml/dispatches' \
|
||||
-d '{"ref": "master", "inputs": {"version": "${build_version}"}}'
|
||||
script: .travis/trigger_docker_build.sh "${GITHUB_TOKEN}" "${BUILD_VERSION}"
|
||||
after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger docker build during nightly release" "${NOTIF_CHANNEL}"
|
||||
|
||||
- stage: Trigger deb and rpm package build (nightly release)
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue