Hi,
I am using a custom docker image in my deployment pipeline. Works great.
However, it seems very sensible to me to maintain the docker version in an environment variable in the repository, so I can change it via the repo, and not with a code release.
This is because many projects use this single image to deploy, and changes to the image need to be handled correctly.
I don't want to have to do a code release for each project to simply change the version number of the deployment image. And I also need to know that they are going to work even if I do a new version of the image.
I'd want to move them over to the one by one, ensuring that they are still working as before, adding new env vars to the repo if need be or what ever is required.
Step code in pipelines :
- step:
name: DEVELOP - Deploy Complete
deployment: test
trigger: manual
image:
name: my-dockerhub-repo/my-docker-image:$DOCKER_VERSION
username: $DOCKER_HUB_USERNAME
password: $DOCKER_HUB_PASSWORD
email: $DOCKER_HUB_EMAIL
I think line :
name: my-dockerhub-repo/my-docker:$DOCKER_HUB_VERSION
Should be acceptable. However, I get an error :
There is a problem with the format of your docker image name at [pipelines > branches > develop > 1 > step > image > name].
Presumably this is from a syntax check as it doesn't even run.
Any ideas how I can achieve this please ?
Thanks
Hello Jowan,
Currently only the username, password, and email support environment variable values. The image name does not support having environment variables.
If you'd like, you can open a feature request to support this here: https://bitbucket.org/site/master/issues/new
Depending on what you're doing, you could alternatively pull this image inside of your build script instead using Docker and run the relevant tests inside of the running container.
Thanks,
Phil
Hi Phil,
Thanks for the response.
Yes I see the (nested) docker solution and may use that, a mini docker just to spin up another docker with version number passed is a bit overkill though.
Definitely going to feature request it.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We had this error message:
There is a problem with the format of your docker image name at [image > name].
We tried to have image set like this:
name: $DOCKER_REGISTRY/bitbucket-pipeline-image-ubuntu18:latest
You should at least update the documentation here:
https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.htmlWith this information:
The image name does not support having environment variables.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.