Skip to content
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

fix(docker): remove rosdistro tag and add date as suffix #5216

Merged
merged 5 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 33 additions & 39 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ inputs:
build-args:
description: ""
required: false
tag-prefix:
description: ""
required: false
tag-suffix:
description: ""
required: false
Expand Down Expand Up @@ -70,133 +67,130 @@ runs:
}
skip-extraction: true

- name: Set Docker tags
id: set-docker-tags
run: |
tags=()
if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref_type }}" == "tag" ]; then
tags+=("$(echo "${{ github.ref }}" | sed -E 's/.*([vV][0-9]+\.[0-9]+\.[0-9]+).*/\1/')")
fi

tags+=("{{date 'YYYYMMDD'}}")
tags+=("${{ inputs.tag-prefix }}")

# Output multiline strings: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "tags<<$EOF" >> $GITHUB_OUTPUT
echo "$(printf "%s\n" "${tags[@]}")" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash

- name: Docker meta for autoware:base
id: meta-base
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=base${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=base${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-base
flavor: |
latest=false
suffix=-base${{ inputs.tag-suffix }}

- name: Docker meta for autoware:core-devel
id: meta-core-devel
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=core-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=core-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-core-devel
flavor: |
latest=false
suffix=-core-devel${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe-sensing-perception-devel
id: meta-universe-sensing-perception-devel
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe-sensing-perception-devel
flavor: |
latest=false
suffix=-universe-sensing-perception-devel${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe-sensing-perception
id: meta-universe-sensing-perception
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe-sensing-perception${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe-sensing-perception${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe-sensing-perception
flavor: |
latest=false
suffix=-universe-sensing-perception${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe-localization-mapping-devel
id: meta-universe-localization-mapping-devel
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe-localization-mapping-devel
flavor: |
latest=false
suffix=-universe-localization-mapping-devel${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe-localization-mapping
id: meta-universe-localization-mapping
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe-localization-mapping${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe-localization-mapping${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe-localization-mapping
flavor: |
latest=false
suffix=-universe-localization-mapping${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe-planning-control-devel
id: meta-universe-planning-control-devel
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe-planning-control-devel
flavor: |
latest=false
suffix=-universe-planning-control-devel${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe-planning-control
id: meta-universe-planning-control
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe-planning-control${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe-planning-control${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe-planning-control
flavor: |
latest=false
suffix=-universe-planning-control${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe-devel
id: meta-universe-devel
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe-devel
flavor: |
latest=false
suffix=-universe-devel${{ inputs.tag-suffix }}

- name: Docker meta for autoware:universe
id: meta-universe
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }}
tags: ${{ steps.set-docker-tags.outputs.tags }}
tags: |
type=raw,value=universe${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}
type=raw,value=universe${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}
bake-target: docker-metadata-action-universe
flavor: |
latest=auto
suffix=-universe${{ inputs.tag-suffix }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-and-push-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
platform: arm64
base_image_env: base_image
lib_dir: aarch64
additional-tag-suffix: -cuda
additional-tag-suffix: cuda
steps:
# https://github.com/actions/checkout/issues/211
- name: Change permission of workspace
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/docker-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
platform: amd64
base_image_env: base_image
lib_dir: x86_64
additional-tag-suffix: -cuda
additional-tag-suffix: cuda
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -75,8 +75,7 @@ jobs:
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }}
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main
*.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }},mode=max
tag-suffix: ${{ matrix.additional-tag-suffix }}-${{ matrix.platform }}
tag-prefix: ${{ needs.load-env.outputs.rosdistro }}
tag-suffix: ${{ matrix.additional-tag-suffix }}

- name: Show disk space
run: |
Expand Down
Loading