I have a github action that builds a docker image and pushes it to our repo.
docker build -t mySuperCoolTag --build-arg PIP_INDEX_URL=${{ secrets.PIP_INDEX_URL }} .
docker push mySuperCoolTag
Per our deployment process, we take the SHA of the latest image, add it to our yaml files for K8s to read and use.
Originally, I incorrectly thought that the local SHA of the image was the same being pushed to the repo, and I grabbed it and added it to the file like so:
docker images --no-trunc --quiet mySuperCoolTag
dockerSHA=$(docker images --no-trunc --quiet mySuperCoolTag)
#replace the current SHA in the configuration with the latest SHA
sed -i -E "s/sha256:\w*/$dockerSHA/g" config-file.yaml
This ended up not being the SHA I was looking for.