Bamboo variable injection with Docker pull

DanielaBaron October 30, 2017

I have a build job that in one task generates a specific docker tag and writes the tag to a properties file:

dockerTag=$(head -n 1 ci/dockertag)
echo "dockerTag=${dockerTag}" > docker-tag.properties

This results in docker-tag.properties containing something like:

dockerTag=0.0.2

The next task is Inject Bamboo variables, specifying "docker-tag.properties" as the properties file and "myproject" as the namespace, to make the "dockerTag" variable available to next tasks in the job. Tried both Local and Result radio options.

Next task is Docker pull, I need to use Bamboo Docker integration rather than a generic script because its pulling from a private registry and needs to provide credentials. The problem is when specifying the image to pull as follows:

docker.mycustom.registry/mynamespace/myimage:${bamboo.inject.myproject.dockerTag}

 The variable substitution doesn't seem to be working, looking at the log file, it's literally trying to pull an image name with the "${bamboo...":

docker pull docker.mycustom.registry/mynamespace/myimage:$%7Bbamboo.inject.myproject.dockerTag%7D

I have verified that the variable substitution is available from earlier in the log:

Injected variable bamboo.myproject.dockerTag=0.0.2 in LOCAL scope

Also the image:tag is available in the private registry.

Does anyone know how to make the docker pull command use bamboo's variables?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events