On merge we create a docker image that we then promote to different environments.
The docker tag is automatically created to be <branch>-<sha>-<build number>
The goal is to have a unique docker image tag that won’t be overwritten by mistake when people rerun the build.
We use e.g:
${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}-${DRONE_BUILD_NUMBER}
${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}-${DRONE_BUILD_PARENT}
But from the env variables we have only the parent build number.
This means that we can deploy like this:
merge/push build --> promote staging
| --> promote production
We cannot deploy like this:
merge/push build --> promote staging --> promote production
as then we don’t have access to the merge/push build number in the promote of the promote so we cannot easily find the tag.
(This gets pretty annoying as in the UI for the promote build there is no way to go back to the parent build )
- Is there any way to get as env variable the initial build number (the merge/push build number)?
- Is there an easy way to set some variables in the initial merge/push build that we can use in later promote builds?