File tree 3 files changed +35
-2
lines changed
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 85
85
docker image push "$IMAGE_MANIFEST_URI"
86
86
87
87
# 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"
89
89
90
90
- name : Sign the container image (${{ env.IMAGE_REPO_DIGEST }})
91
91
shell : bash
Original file line number Diff line number Diff line change 97
97
set -euo pipefail
98
98
99
99
# 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")
101
101
102
102
# Construct the image repo digest, which for example contains:
103
103
# docker.stackable.tech/stackable/kafka@sha256:91...
You can’t perform that action at this time.
0 commit comments