Docker Community Forums

Share and learn in the Docker community.

Autobuild not tagging versionned builds

We use autobuild on dockerhub to build images from bitbucket

Here is one autobuild setup

While every commit triggers an automatic build that is tagged with “latest”, no images are ever tagged with the git tags

Here’s an extract from the bitbucket commit history


Which results in these builds

In the tag list, there’s no taged image associated with the v1.0.x git tags. The v0.0.4 tag was created manually

Anyone ?
Maybe the docker folks can comment ?

I can’t see your full regex but it seems a likely culprit, mine is working OK with this, have you tried simplifying your regex to see if you can get something simpler working?

Tag
/^([0-9.]+)$/
Docker Tag: {\1}

@michaelparker,
I’m using the same one except for an extra ‘v’ : /^v([0-9].)+$/
I’ve tested the regular expressions before using them, they should work.
Is there any debugging information available on this process ?
Is there a way to manually trigger a tagged autobuild ?

@michaelparker,
I’m using the below build hook. Could that have something to do with this problem ?

#!/bin/bash
# file '/hooks/build'
GIT_COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=$(git describe --abbrev=0)
echo GIT_COMMIT=$GIT_COMMIT
echo GIT_TAG=$GIT_TAG
echo BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo SOURCE_BRANCH=$SOURCE_BRANCH
echo SOURCE_COMMIT=$SOURCE_COMMIT
echo DOCKERFILE_PATH=$DOCKERFILE_PATH
echo DOCKER_REPO=$DOCKER_REPO
echo DOCKER_TAG=$DOCKER_TAG

docker build \
   -t $IMAGE_NAME \
   -f $DOCKERFILE_PATH \
   --build-arg BUILD_DATE=$(date --iso-8601=seconds) \
   --build-arg GIT_COMMIT=$GIT_COMMIT \
   --build-arg GIT_TAG=$GIT_TAG \
   --build-arg SOURCE_BRANCH=$SOURCE_BRANCH  \
   --build-arg SOURCE_COMMIT=$SOURCE_COMMIT \
   --build-arg DOCKER_REPO=$DOCKER_REPO \
   --build-arg DOCKER_TAG=$DOCKER_TAG \
   --build-arg IMAGE_NAME=$IMAGE_NAME \
   .