Hi fellow Gitlabers,
I have a pipeline that builds and deploys docker image. As a best practice I tag docker Image using ${CI_COMMIT_SHORT_SHA}. I also only build image only if changes to dockerfile or App.js happen:
IMAGE_TAG: ${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}
Build job:
sript:
... skipped boring part
- docker push ${REPO}:${IMAGE_TAG}
only:
changes:
- Dockerfile
- app.js
Deploy job:
- terraform apply -auto-approve -var "app_image=${REPO}:${IMAGE_TAG}"
The problem is that sometimes I might want to deploy the image without building it again. In this case it would be good to use previous commit sha. Is it possible to do that? Or am I thinking wrong about something?
Thanks