Skip to content

Commit

Permalink
ci(update-docker-manifest): create main distro manifest (autowarefoun…
Browse files Browse the repository at this point in the history
…dation#335)

* ci(update-docker-manifest): create main distro manifest

Signed-off-by: Kenji Miyake <[email protected]>

* fix grep

Signed-off-by: Kenji Miyake <[email protected]>

* add latest-prebuilt

Signed-off-by: Kenji Miyake <[email protected]>
  • Loading branch information
kenji-miyake authored May 23, 2022
1 parent acf4ac6 commit 56b9dc9
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: update-docker-manifest
name: combine-multi-arch-images
description: ""

inputs:
Expand Down Expand Up @@ -72,8 +72,8 @@ runs:
for base_tag in $BASE_TAGS; do
echo -e "\nbase_tag: $base_tag"
amd64_tag=$(printf "%s\n" $ALL_TAGS | grep "$base_tag\-amd64" || true)
arm64_tag=$(printf "%s\n" $ALL_TAGS | grep "$base_tag\-arm64" || true)
amd64_tag=$(printf "%s\n" $ALL_TAGS | grep "^$base_tag\-amd64" || true)
arm64_tag=$(printf "%s\n" $ALL_TAGS | grep "^$base_tag\-arm64" || true)
echo "amd64_tag: $amd64_tag"
echo "arm64_tag: $arm64_tag"
Expand Down
67 changes: 67 additions & 0 deletions .github/actions/create-main-distro-alias/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: create-main-distro-alias
description: ""

inputs:
package-name:
description: ""
required: true
rosdistro:
description: ""
required: true

runs:
using: composite
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Set image name
id: set-image-name
run: echo "::set-output name=image-name::ghcr.io/${{ github.repository_owner }}/${{ inputs.package-name }}"
shell: bash

- name: Create Docker manifest for latest
run: |
# Check image existence
distro_image="${{ steps.set-image-name.outputs.image-name }}:${{ inputs.rosdistro }}-latest"
if docker manifest inspect "$distro_image-amd64" >/dev/null 2>&1; then
amd64_image="$distro_image-amd64"
fi
if docker manifest inspect "$distro_image-arm64" >/dev/null 2>&1; then
amd64_image="$distro_image-arm64"
fi
echo "amd64_image: $amd64_image"
echo "arm64_image: $arm64_image"
docker manifest create --amend ${{ steps.set-image-name.outputs.image-name }}:latest \
$amd64_image \
$arm64_image
docker manifest push ${{ steps.set-image-name.outputs.image-name }}:latest
shell: bash

- name: Create Docker manifest for latest-prebuilt
run: |
# Check image existence
distro_image="${{ steps.set-image-name.outputs.image-name }}:${{ inputs.rosdistro }}-latest-prebuilt"
if docker manifest inspect "$distro_image-amd64" >/dev/null 2>&1; then
amd64_image="$distro_image-amd64"
fi
if docker manifest inspect "$distro_image-arm64" >/dev/null 2>&1; then
amd64_image="$distro_image-arm64"
fi
echo "amd64_image: $amd64_image"
echo "arm64_image: $arm64_image"
docker manifest create --amend ${{ steps.set-image-name.outputs.image-name }}:latest-prebuilt \
$amd64_image \
$arm64_image
docker manifest push ${{ steps.set-image-name.outputs.image-name }}:latest-prebuilt
shell: bash
10 changes: 8 additions & 2 deletions .github/workflows/update-docker-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ jobs:
- name: Check out repository
uses: actions/checkout@v3

- name: Update Docker manifest for 'autoware-universe'
uses: ./.github/actions/update-docker-manifest
- name: Combine multi arch images for 'autoware-universe'
uses: ./.github/actions/combine-multi-arch-images
with:
package-name: autoware-universe

- name: Create main distro alias for 'autoware-universe'
uses: ./.github/actions/create-main-distro-alias
with:
package-name: autoware-universe
rosdistro: galactic

0 comments on commit 56b9dc9

Please sign in to comment.