Hi,
I am trying to achieve the following:
- On push to master branch, build docker image and tag with
latest
,abbreviated commit hash
andbuild number
. - On push to non-master branch, build docker image and tag with
abbreviated commit hash
andbuild number
.
Is there a way to combine both of those operations into a single pipeline step? E.g
docker:
image: plugins/docker
repo: my-repo
tags:
- latest
- ${DRONE_BUILD_NUMBER}
- ${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:8}
when:
event: push
branch: [master, qa]
The issue with the above is that it will tag the image with latest
even if the build is for a qa
branch. I can create two pipeline steps, one for master
and one for qa
, but was wondering if there’s a simpler way.