diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 3eea64f185f..6389b4d8ceb 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -14,9 +14,6 @@ inputs: build-args: description: "" required: false - tag-prefix: - description: "" - required: false tag-suffix: description: "" required: false @@ -70,22 +67,9 @@ 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 @@ -93,110 +77,120 @@ runs: 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 diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 9a4dcc46950..245eb563951 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -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 diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 9199634b8c2..1057b5d238a 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -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 @@ -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: |