Skip to content

Commit 06a1708

Browse files
committed
ci: add OCI image annotations to docker images
See: https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys Closes: moby#3553 Signed-off-by: Craig Andrews <[email protected]>
1 parent e83d79a commit 06a1708

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

hack/images

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ if [ -n "$localmode" ]; then
5252
attestFlags=""
5353
fi
5454

55+
if [ -z "$localmode" ] && [ "$GITHUB_ACTIONS" = "true" ]; then
56+
outputFlag="${outputFlag},annotation.org.opencontainers.image.title=BuildKit"
57+
if [ -n "$GITHUB_SHA" ]; then
58+
outputFlag="${outputFlag},annotation.org.opencontainers.image.revision=$GITHUB_SHA"
59+
fi
60+
if [ -n "$GITHUB_REPOSITORY" ] && [ -n "$GITHUB_SERVER_URL" ]; then
61+
outputFlag="${outputFlag},annotation.org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
62+
outputFlag="${outputFlag},annotation.org.opencontainers.image.url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"
63+
fi
64+
if [ -n "$versionTag" ]; then
65+
outputFlag="${outputFlag},annotation.org.opencontainers.image.version=$versionTag"
66+
fi
67+
fi
68+
5569
targetFlag=""
5670
if [ -n "$TARGET" ]; then
5771
targetFlag="--target=$TARGET"

0 commit comments

Comments
 (0)