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 - echo $REGISTRY_PWD | docker login -u drone --password-stdin registry.jfmonty2.com
- docker pull registry.jfmonty2.com/drone-server:latest - 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) - 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 if [[ $COMMIT_HASH != $IMAGE_COMMIT_HASH ]]; then
echo 'Updates available, triggering build pipeline.' echo 'Updates available, triggering build pipeline.'
curl -X POST -H "Authorization: Bearer $DRONE_API_TOKEN" \ 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 else
echo 'Image is already up to date.' echo 'Image is already up to date.'
fi fi
@ -54,7 +54,9 @@ name: main
trigger: trigger:
event: event:
- custom - promote
target:
- server-build
steps: steps:
- name: prepare - name: prepare