Hi,
Every time I build an image through pipeline I want its tag to get updated automatically. For example if I give an image name as Image1:1.0 , the next time I run the pipeline, my new image should be Image:2.0. Is there any provision in Rancher for this?
Thank you.
Hello,
You can use the variables reference as explained at the end of the following page: https://rancher.com/docs/rancher/v2.x/en/k8s-in-rancher/pipelines/
So when you are building and publishing the image using the Rancher pipeline, you can include a tag like image:${CICD_EXECUTION_SEQUENCE}
It looks like Rancher suggests using applyYamlConfig to update the image name. Is there a way to only update the image (or an example of how this yml file should look?)
Hi @nickl,
Not sure about what you’re trying to do, but I think that the following procedure can help you somehow…
To guarantee that your pipeline always use the latest image when deploying the application, configure your pipeline to publish the image to dockerhub with a specific tag, like in the following image:
and when configuring your deployment include this same tag to your image:
spec:
containers:
- image: evertonaulian/node:${CICD_GIT_COMMIT}
name: node
ports:
- containerPort: 3000
name: node
Got it, thanks!
And just to clarify - for the last step, I would need to include a ./deployment.yaml file in the repo with the full yaml file which I can grab from the Workload->View/Edit YAML? Or can it be a partial yaml file with just
spec:
containers:
- image: ourdocker/repo:${CICD_GIT_COMMIT}
Hi @nickl
You would need to include your full deployment.yaml file in the repo and include this file in your Pipeline configuration to be deployed in your environment as the following example:
Got it, thanks for the response!