# Builds can be promoted before they are finished

**URL:** <https://drone.discourse.group/t/builds-can-be-promoted-before-they-are-finished/5778>\
**Category:** Drone Support\
**Created:** [July 3, 2019, 2:48pm UTC](https://drone.discourse.group/t/builds-can-be-promoted-before-they-are-finished/5778 "2019-07-03T14:48:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffDownie](https://avatars.discourse-cdn.com/v4/letter/j/bb73d2/32.png) [@JeffDownie](https://drone.discourse.group/u/JeffDownie)\
**Post date:** [July 3, 2019, 2:48pm UTC](https://drone.discourse.group/t/builds-can-be-promoted-before-they-are-finished/5778/1 "2019-07-03T14:48:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [July 3, 2019, 4:50pm UTC](https://drone.discourse.group/t/builds-can-be-promoted-before-they-are-finished/5778/2 "2019-07-03T16:50:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![imranismail](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/imranismail/32/4352_2.png) [@imranismail](https://drone.discourse.group/u/imranismail)\
**Post date:** [April 8, 2020, 11:35am UTC](https://drone.discourse.group/t/builds-can-be-promoted-before-they-are-finished/5778/3 "2020-04-08T11:35:27Z")

</div>

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

```
- name: check-build
  image: drone/cli:1.2-alpine
  pull: if-not-exists
  environment:
    DRONE_SERVER: ${DRONE_SYSTEM_PROTO}://${DRONE_SYSTEM_HOST}
    DRONE_SECRET:
      from_secret: build_checker_token
  commands:
  - 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.
