dockertagsbitbucketversioningbamboo

How to tag Docker images with Bitbucket source code version using Bamboo Docker task?


After creating a new version of my software, I typically tag the most recent commit in the master branch with the corresponding release version (e.g. '1.3.0'). Currently, we are transitioning our workflow to Bitbucket and Bamboo. Unfortunately, I am having trouble figuring out how to push the Docker images to our Docker registry with the tag being the version specified by the tag in the Bitbucket source code. So far, the closest I have come is using 'namespace/repository:${bamboo.buildNumber}'. However, this is not the desired solution as it does not reflect the version from the source code in Bitbucket. Any help on that issue would be appreciated.


Solution

  • To solve my issue, I found that I needed to create a Trigger in the Triggers tab within the Plan Configuration of Bamboo.

    After setting up the Trigger, I moved to the Tasks tab in the Plan Configuration. Here, for every task where I created or pushed a Docker image,

    This approach ensured that new Docker images were created and pushed to the specified repository only if a new tag was created in the Bitbucket repository. It also tagged the images with the same tag as in the Bitbucket repo.