How to update image versions in a pipeline

Hi,

I am currently running a pipeline where i want to update the image version number i.e “docker build -t (image_name):(version_number) .”
“docker push -t repository_name/(image_name):(version_number)”

I am trying to implement this inside a “deploy to production” job in circleci. initially i have been using the latest tag as shown below;

“docker push -t repository_name/(image_name):latest”

but our workflow is rather dynamic and using version numbering, but i have been searching for a solution to no avail.

would be nice if i can get some help.

thanks in advance.

You need to save the version strings as an environment variable.

'echo IMAGE_NAME="$(getimagename)" >> $BASH_ENV'
'echo VERSION="$(getversion)" >> $BASH_ENV'

Then

docker push -t repository_name/$IMAGE_NAME:$VERSION

You can also likely do it with a dynamic configuration where a setup job builds a parameter.json containing your variables and passes it to a continuation job.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.