Skip to content

Commit

Permalink
Split push image manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirakis committed Jul 8, 2024
1 parent 90fdf7b commit 62d5306
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/push-to-gar-docker-multiarch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ jobs:
with:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: grafana/shared-workflows
ref: multiarch-docker-builds-using-sh-runners
path: shared-workflows
- name: Download digests
uses: actions/download-artifact@v4
- name: Create and push image manifests
uses: ./shared-workflows/actions/create-and-push-image-manifests
with:
<<<<<<< Updated upstream
path: /tmp/digests
pattern: digests-*-${{ matrix.tags }}
merge-multiple: true
Expand All @@ -147,3 +153,7 @@ jobs:
- name: Inspect image
run: |
"docker buildx imagetools inspect ${{ needs.build-multi-arch.outputs.full_image_name }}:${{ steps.meta.outputs.version }}"
=======
full-image-name: ${{ needs.build-multi-arch.outputs.full_image_name }}
tag: ${{ matrix.tags }}
>>>>>>> Stashed changes
42 changes: 42 additions & 0 deletions actions/create-and-push-image-manifests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
description: Pulls image digests from GitHub and pushes manifests to GAR
inputs:
full-image-name:
description: Image name to push the manifest for
required: true
tag:
description: Tag to create and push the manifest for
required: true
name: Create and push image manifest

runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Download digests
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: /tmp/digests
pattern: digests-*-${{ inputs.tag }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- id: meta
name: Docker meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.full-image-name }}
tags: ${{ inputs.tag }}
- id: login-to-gar
uses: grafana/shared-workflows/actions/login-to-gar@main
- name: Create manifest list and push
working-directory: /tmp/digests
shell: bash
run: |
"docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf '${{ inputs.full-image-name }}@sha256:%s ' *)"
- name: Inspect image
shell: bash
run: |
"docker buildx imagetools inspect ${{ inputs.full-image-name }}:${{ steps.meta.outputs.version }}"

0 comments on commit 62d5306

Please sign in to comment.