switch to promotion event for pipeline chaining

This commit is contained in:
Joseph Montanaro 2021-01-02 17:15:41 -08:00
parent 2d45d5b368
commit e2d00dafab

View File

@ -31,12 +31,12 @@ steps:
- echo $REGISTRY_PWD | docker login -u drone --password-stdin registry.jfmonty2.com
- docker pull registry.jfmonty2.com/drone-server:latest
- IMAGE_COMMIT_HASH=$(docker image inspect -f '{{ .Config.Labels.drone_commit_hash }}' registry.jfmonty2.com/drone-server:latest)
# compare
# compare and trigger CI if necessary
- |
if [[ $COMMIT_HASH != $IMAGE_COMMIT_HASH ]]; then
echo 'Updates available, triggering build pipeline.'
curl -X POST -H "Authorization: Bearer $DRONE_API_TOKEN" \
https://drone.jfmonty2.com/api/repos/jfmonty2/drone/builds
https://drone.jfmonty2.com/api/repos/jfmonty2/drone/builds/$DRONE_BUILD_NUMBER/promote?target=server-build
else
echo 'Image is already up to date.'
fi
@ -54,7 +54,9 @@ name: main
trigger:
event:
- custom
- promote
target:
- server-build
steps:
- name: prepare