I have a Spinnaker deployment pipeline which is triggered either when a Docker Image D1 or Docker Image D2 is updated in the docker registry.
The pipeline has multiple stages, wherein the D1 is deployed in stage S1 and if successful, D2 is deployed in stage S2.
What I are seeing is that depending on which image gets updated only one of the stages is successful. The other stage results in an ImagePullBackOff error in the K8S.
The issue seems to be that for the image change that triggers (e.g. D1) the pipeline the correct version of the image is getting pulled, for the other stage the image is being pulled with the ":latest" tag which doesn't exist in the docker registry.
Any ideas as to how this can be set-up ?
First of all it would be better to make 2 pipelines. If no then...
Your pipeline should be like this:
Config -- Deploy #1
\- Deploy #2
It doesn't matter how many triggers do you have - only one trigger will provide artifact. So you are able to get something like that:
${trigger['artifacts'][0]['name']}
It will provide you a String with name of your docker image e.g. docker-registry.com/org/app
.
Using this information you can enable your deployment stages using Conditional on Expression
in json it would be like:
"stageEnabled": {
"expression": "${trigger['artifacts'][0]['name'].contains('app')}",
"type": "expression"
},
Deploy stage which has condition resolved as false
will be skipped.