Signed-off-by: Kevin Sandi <ksandi@contractor.linuxfoundation.org>
Change-Id: Iec1ec1df10623075c1121b88977570899cbfbd83
--- /dev/null
+---
+fixes:
+ - |
+ Updates the command to retrieve the correct digest sha256 of a docker image
+ after it has been pushed to a container registry in the release script.
+ Previously, the script was incorrectly attempting to get the sha256 from
+ the local docker images, which does not provide the correct digest needed
+ for signing the image with cosign. The fix uses `docker inspect` to get
+ the digest from the pushed image in the registry.
export COSIGN_PASSWORD
docker tag "$container_image_id" "$CONTAINER_PUSH_REGISTRY"/"$lfn_umbrella"/"$name":"$VERSION"
docker push "$CONTAINER_PUSH_REGISTRY"/"$lfn_umbrella"/"$name":"$VERSION"
- image_sha=$(docker images --no-trunc --quiet \
+ image_digest=$(docker inspect --format='{{index .RepoDigests 0}}' \
"$CONTAINER_PUSH_REGISTRY"/"$lfn_umbrella"/"$name":"$VERSION")
- image_digest="$CONTAINER_PUSH_REGISTRY/$lfn_umbrella/$name@$image_sha"
cosign sign -y --key "$COSIGN_PRIVATE_KEY" "$image_digest"
fi
echo "#########################"