File tree Expand file tree Collapse file tree 3 files changed +35
-2
lines changed
Expand file tree Collapse file tree 3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # The script outputs the image manifest uri with the SHA256 digest, for example:
4+ # oci.stackable.tech/sdp/hello-world@sha256:917f800259ef4915f976e93987b752fd64debf347568610d7f685d20220fc88a
5+ set -euo pipefail
6+
7+ # There is only one input to this script, which contains the entire image
8+ # manifest uri, like: oci.stackable.tech/sdp/hello-world:0.0.1-SNAPSHOT-stackable0.0.0-dev-arm64
9+ IMAGE_MANIFEST_URI=" $1 "
10+
11+ # Here, we cut off the image manifest tag to get the image repository uri, for
12+ # example: oci.stackable.tech/sdp/hello-world
13+ IMAGE_REPOSITORY_URI=" $( echo " $IMAGE_MANIFEST_URI " | cut -d : -f 1) "
14+
15+ IMAGE_REPO_DIGEST=$(
16+ docker inspect " $IMAGE_MANIFEST_URI " --format json | \
17+ jq -r \
18+ --arg IMAGE_REPOSITORY_URI " $IMAGE_REPOSITORY_URI " \
19+ --arg IMAGE_MANIFEST_URI " $IMAGE_MANIFEST_URI " \
20+ '
21+ map(select(.RepoTags[] | contains($IMAGE_MANIFEST_URI)))[0]
22+ | .RepoDigests[]
23+ | select(. | startswith($IMAGE_REPOSITORY_URI))
24+ '
25+ )
26+
27+ # Ensure IMAGE_REPO_DIGEST is not empty
28+ if [[ -z " $IMAGE_REPO_DIGEST " ]]; then
29+ >&2 echo " Repo Digest is empty, but is required for signing"
30+ exit 1
31+ fi
32+
33+ echo " $IMAGE_REPO_DIGEST "
Original file line number Diff line number Diff line change 8585 docker image push "$IMAGE_MANIFEST_URI"
8686
8787 # Output for the next step
88- echo "IMAGE_REPO_DIGEST=$($GITHUB_ACTION_PATH/.scripts/get_repo_digest.sh $IMAGE_MANIFEST_URI)" | tee -a "$GITHUB_ENV"
88+ echo "IMAGE_REPO_DIGEST=$($GITHUB_ACTION_PATH/../. scripts/get_repo_digest.sh $IMAGE_MANIFEST_URI)" | tee -a "$GITHUB_ENV"
8989
9090 - name : Sign the container image (${{ env.IMAGE_REPO_DIGEST }})
9191 shell : bash
Original file line number Diff line number Diff line change 9797 set -euo pipefail
9898
9999 # Get the image index manifest digest
100- DIGEST=$($GITHUB_ACTION_PATH/.scripts/get_manifest_digest.sh "$IMAGE_INDEX_URI")
100+ DIGEST=$($GITHUB_ACTION_PATH/../. scripts/get_manifest_digest.sh "$IMAGE_INDEX_URI")
101101
102102 # Construct the image repo digest, which for example contains:
103103 # docker.stackable.tech/stackable/kafka@sha256:91...
You can’t perform that action at this time.
0 commit comments