static value 32 in Jenkinsfile (python-jenkins-agrocd-k8s)
Ryzen-thor opened this issue · 0 comments
Hi Abhishek,
You have put static value 32 in Jenkinsfile at final stage ('Update K8S manifest & push to Repo').
But once whole build is successful and suppose we change some value in index.html file and rebuild the pipeline, the sed command will search for 32 value in deploy.yaml file. But its value would have been change to suppose 33 due to last build success and therefore build will fail.
Anyway we should not put static value while changing image. So instead of "sed -i '' "s/32/${BUILD_NUMBER}/g" deploy.yaml", we should write "sed -i '' "s/todo-app.*/todo-app:${BUILD_NUMBER}/g" deploy.yaml"
Here, since our app name is todo-app so we will do s/todo-app.*/todo-app:${BUILD_NUMBER}/g. I had a problem with this that's why I thought of putting dynamic value and it worked!😊
Should I request for PR?