12

I am setting up a repository to automate the deployment of a web-app.

To manage the master branch releases i use tags in git to mark every release ex: 0.0.4, 0.0.5 and so on..

I notices that docker hub recently updated their Auto-build system and introduced a regex match. What i am trying to do is to get a image built every time i push a new tag to the branch.

My issue is that when i set up a new auto build on tag and regex like /^[0-9.]+$/ it doesn't get triggered to build? It works fine if i just set up a auto build on branch with the latest tag, then every time i push anything to the branch i get a new latest build.

3 Answers 3

8

I got a response for docker hub support that solved my issue:

All newly created automated build repos referencing BitBucket source will be able to have dynamic build triggers based on Git tags.

However, for existing automated build repos, created before 29th December 2015, there is a catch. In order for these existing repos to have tag-based dynamic build triggers, you would need to do either of the following:

The painful way: You will need to remove/delete your automated build repo on Docker Hub and set it up again.

The less painful way: Go to your BitBucket repo settings page (https://bitbucket.org///admin), click on the Services tab under Integration. You should see Docker Hub as one of services listed, likely with an entry that looks like this: POST https://registry.hub.docker.com/hooks/bitbucket. Copy the URL (https://registry.hub.docker.com/hooks/bitbucket) and then click on the Webhooks tab under Integration, then proceed to Add webhook. The title should be "Docker Hub", paste the copied URL in the URL field, tick the "Active" box, and select the "Repository push" option for Triggers. The final configuration should look like the attached screenshot. Last but not least, save the configuration. If you have done either of the above steps, your automated build repo on Docker Hub would trigger new builds when you push any tags to your BitBucket repo.

1

For GitHub I had to do the following

  • Log into hub.docker.com and navigate to the appropriate repo eg Fluentd - papertrail

  • Go to GitHub and navigate to the repo you want to build from

    • Go to Settings of the repo, then Webhooks
    • Click Add webhook and paste the Trigger URL from docker hub into the Payload URL box then click the Add webhook at the bottom.
    • Note you probably want to select individual events and limit them to commits, tags etc
0

I just went through the process of setting up an example repository. For me the automated setup didn't work. What I had to do was to add the Docker service to my repo on GitHub and all my pushes automatagically started triggering builds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.