-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(publish-image-index-manifest)!: Support other/additional tags #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Techassi
wants to merge
5
commits into
main
Choose a base branch
from
feat/publish-image-index-manifest-multiple-tags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−44
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
55372e6
feat(publish-image-index-manifest)!: Support other/additional tags
Techassi 7027bb2
docs: Adjust definition name
Techassi 7afd69d
ci: Wire up floating image index manifest tag
Techassi 4809682
ci: Use setup-tools action
Techassi 4f7f47d
ci: Use full image index manifest tag
Techassi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,10 +18,16 @@ inputs: | |||||
| Last segment of the path, for example `stackable/kafka` or | ||||||
| `k8s/sig-storage/csi-provisioner` | ||||||
| required: true | ||||||
| image-index-manifest-tag: | ||||||
| canonical-image-index-manifest-tag: | ||||||
| description: | | ||||||
| Human-readable tag (usually the version) without architecture information, | ||||||
| for example: `3.4.1-stackable0.0.0-dev` | ||||||
| The canonical image index manifest tag which doesn't contain any architecture specific | ||||||
| suffixes, like: `3.4.1-stackable0.0.0-dev` | ||||||
| required: true | ||||||
| other-image-index-manifest-tags: | ||||||
| description: | | ||||||
| A JSON string containing a list of other/additional tags which should be added to the image | ||||||
| index manifest alongside the always present canonical tag. | ||||||
| default: "[]" | ||||||
| image-architectures: | ||||||
| description: | | ||||||
| A JSON array of architectures to add to the image index manifest, like | ||||||
|
|
@@ -38,15 +44,19 @@ inputs: | |||||
| See `sleep --help` for the full details. | ||||||
| default: "30s" | ||||||
| outputs: | ||||||
| image-index-uri: | ||||||
| description: The Image Index URI. | ||||||
| value: ${{ steps.create-index.outputs.IMAGE_INDEX_URI }} | ||||||
| canonical-image-index-manifest-uri: | ||||||
| description: | | ||||||
| The canonical image index manifest URI, like oci.stackable.tech/sdp/kafka:3.4.1-stackable0.0.0-dev | ||||||
| value: ${{ steps.create-index.outputs.CANONICAL_IMAGE_INDEX_MANIFEST_URI }} | ||||||
| image-index-manifest-digest: | ||||||
| description: The digest (sha256:...) of the pushed image index manifest. | ||||||
| value: ${{ steps.create-index.outputs.IMAGE_INDEX_MANIFEST_DIGEST }} | ||||||
| runs: | ||||||
| using: composite | ||||||
| steps: | ||||||
| - name: Setup Docker Buildx | ||||||
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | ||||||
|
|
||||||
| - name: Set up Cosign | ||||||
| uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2 | ||||||
|
|
||||||
|
|
@@ -61,7 +71,8 @@ runs: | |||||
| id: create-index | ||||||
| shell: bash | ||||||
| env: | ||||||
| IMAGE_INDEX_MANIFEST_TAG: ${{ inputs.image-index-manifest-tag }} | ||||||
| CANONICAL_IMAGE_INDEX_MANIFEST_TAG: ${{ inputs.canonical-image-index-manifest-tag }} | ||||||
| OTHER_IMAGE_INDEX_MANIFEST_TAGS: ${{ inputs.other-image-index-manifest-tags }} | ||||||
| IMAGE_ARCHITECTURES: ${{ inputs.image-architectures }} | ||||||
| IMAGE_REPOSITORY: ${{ inputs.image-repository }} | ||||||
| REGISTRY_URI: ${{ inputs.image-registry-uri }} | ||||||
|
|
@@ -70,36 +81,49 @@ runs: | |||||
|
|
||||||
| # Construct the image index uri, which for example contains: | ||||||
| # oci.stackable.tech/sdp/kafka:3.4.1-stackable0.0.0-dev | ||||||
| IMAGE_INDEX_URI="$REGISTRY_URI/$IMAGE_REPOSITORY:$IMAGE_INDEX_MANIFEST_TAG" | ||||||
| echo "IMAGE_INDEX_URI=$IMAGE_INDEX_URI" | tee -a "$GITHUB_OUTPUT" | ||||||
| IMAGE_REGISTRY_URI="${REGISTRY_URI}/${IMAGE_REPOSITORY}" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Maybe rename this? Since it includes the repo |
||||||
| CANONICAL_IMAGE_INDEX_MANIFEST_URI="${IMAGE_REGISTRY_URI}:$CANONICAL_IMAGE_INDEX_MANIFEST_TAG" | ||||||
| echo "CANONICAL_IMAGE_INDEX_MANIFEST_URI=$CANONICAL_IMAGE_INDEX_MANIFEST_URI" | tee -a "$GITHUB_OUTPUT" | ||||||
|
|
||||||
| AMEND_OPTIONS=$( | ||||||
| MANIFEST_SOURCES=$( | ||||||
| jq \ | ||||||
| --raw-output \ | ||||||
| --null-input \ | ||||||
| --arg image_index_uri "$IMAGE_INDEX_URI" \ | ||||||
| --arg canonical_image_index_uri "$CANONICAL_IMAGE_INDEX_MANIFEST_URI" \ | ||||||
| --arg arch_list "$IMAGE_ARCHITECTURES" \ | ||||||
| ' | ||||||
| $arch_list | ||||||
| | fromjson | ||||||
| | [ | ||||||
| .[] as $arch | "--amend \($image_index_uri)-\($arch)" | ||||||
| .[] as $arch | "\($canonical_image_index_uri)-\($arch)" | ||||||
| ] | ||||||
| | join(" ")' | ||||||
| ) | ||||||
|
|
||||||
| # `docker manifest push` directly returns the digest of the manifest list | ||||||
| # As it is an experimental feature, this might change in the future. | ||||||
| # We use --amend because the manifest list would be updated since we use | ||||||
| # the same tag: 0.0.0-dev | ||||||
| OTHER_TAGS=$( | ||||||
| echo "$OTHER_IMAGE_INDEX_MANIFEST_TAGS" | jq \ | ||||||
| --raw-output \ | ||||||
| --arg image_registry_uri "$IMAGE_REGISTRY_URI" \ | ||||||
| ' | ||||||
| [ | ||||||
| .[] as $tag | "--tag \($image_registry_uri):\($tag)" | ||||||
| ] | ||||||
| | join(" ")' | ||||||
| ) | ||||||
|
|
||||||
| # Create an image index manifest based on the manifest sources (currently two images for | ||||||
| # amd64 and arm64). The canonical tag is always present. Other/additional tags are added | ||||||
| # as needed. This command also directly pushes the index manifest to the remote registry. | ||||||
| # | ||||||
| # Further reading: https://docs.docker.com/reference/cli/docker/manifest/push/ | ||||||
| docker manifest create "$IMAGE_INDEX_URI" ${AMEND_OPTIONS[@]} | ||||||
| docker manifest push "$IMAGE_INDEX_URI" | ||||||
| # Further reading: https://docs.docker.com/reference/cli/docker/buildx/imagetools/create/ | ||||||
| docker buildx imagetools create \ | ||||||
| --tag "$CANONICAL_IMAGE_INDEX_MANIFEST_URI" \ | ||||||
| ${OTHER_TAGS[@]} \ | ||||||
| ${MANIFEST_SOURCES[@]} | ||||||
|
|
||||||
| # Get the image index manifest digest and expose it as an output, so | ||||||
| # callers can reference the pushed index by digest. | ||||||
| DIGEST=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_manifest_digest.sh" "$IMAGE_INDEX_URI") | ||||||
| DIGEST=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_manifest_digest.sh" "$CANONICAL_IMAGE_INDEX_MANIFEST_URI") | ||||||
| echo "IMAGE_INDEX_MANIFEST_DIGEST=$DIGEST" | tee -a "$GITHUB_OUTPUT" | ||||||
|
|
||||||
| - name: Sign Image Index Manifest | ||||||
|
|
@@ -108,7 +132,6 @@ runs: | |||||
| RETRY_TIMEOUT: ${{ inputs.cosign-retry-timeout }} | ||||||
| RETRY_COUNT: ${{ inputs.cosign-retries }} | ||||||
| RETRY_ARGS: --verbose | ||||||
| IMAGE_INDEX_URI: ${{ steps.create-index.outputs.IMAGE_INDEX_URI }} | ||||||
| DIGEST: ${{ steps.create-index.outputs.IMAGE_INDEX_MANIFEST_DIGEST }} | ||||||
| IMAGE_REPOSITORY: ${{ inputs.image-repository }} | ||||||
| REGISTRY_URI: ${{ inputs.image-registry-uri }} | ||||||
|
|
@@ -117,6 +140,8 @@ runs: | |||||
|
|
||||||
| # Construct the image repo digest, which for example contains: | ||||||
| # oci.stackable.tech/sdp/kafka@sha256:91... | ||||||
| # TODO (@Techassi): The image repository URI could be constructed once instead of over and | ||||||
| # over again in different steps | ||||||
| IMAGE_REPO_DIGEST="$REGISTRY_URI/$IMAGE_REPOSITORY@$DIGEST" | ||||||
|
|
||||||
| # This generates a signature and publishes it to the registry, next to | ||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.