Builds can be promoted before they are finished

It’s possible to promote a build before it has been finished - with my current setup, I have a build pipeline create some artefacts, and a promote pipeline that deploys said artefacts, but it’s currently possible to promote the build before it has finished, making the deploy/promote pipeline fail in odd ways, because they expect the artefacts to exist.

In the same vein, it’s possible to promote failed builds, which has similar issues to the above.

Am I using promote in an unintended way, or is this unintended behaviour?

Drone does not place any restrictions on if / when a build can be promoted. You can make a separate API call to determine if the build is complete before promoting, if desired.

This is how I did it for those looking for answers:

- name: check-build
  image: drone/cli:1.2-alpine
  pull: if-not-exists
      from_secret: build_checker_token
  - drone build info $DRONE_REPO $DRONE_BUILD_PARENT --format '{{ println .Status }}' | grep -q "success"

build_checker_token comes from creating a machine user

drone user add build-checker --machine --admin

I hope there’s a better way to allow machine to read info about repo builds without granting admin access.