Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Hub - Automatic build on tag with regex match not triggered

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.

like image 657
Sultanen Avatar asked Dec 06 '15 00:12

Sultanen


2 Answers

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.

like image 132
Sultanen Avatar answered Oct 15 '22 14:10

Sultanen


For GitHub I had to do the following

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

    • Go to Build Settings and in the Build Triggers section generate a token. You should have something that looks like https://registry.hub.docker.com/u/timothyclarke/docker-fluentd-es-pt/trigger/<UUID>/ in the Trigger URL box
    • Copy the Trigger URL
  • 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
like image 37
Timothy c Avatar answered Oct 15 '22 14:10

Timothy c