Skip to content

#370 breaks GitHub Actions build example #381

Description

@krcm0209

Contributing guidelines

I've found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

#370 has broken example documentation from Docker on how one could use the metadata action in a larger workflow to build multi-platform images in GitHub Actions. Specifically, attempting to rename the temporary bake file generated by the metadata action in a follow-up step.

mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"

https://docs.docker.com/build/ci/github-actions/multi-platform/#with-bake

Attempting to do so now results in an action error like:

Run mv "cwd:///home/runner/work/_temp/docker-actions-toolkit-HBnX10/docker-metadata-action-bake.json" "/tmp/bake-meta.json"
mv: cannot stat 'cwd:///home/runner/work/_temp/docker-actions-toolkit-HBnX10/docker-metadata-action-bake.json': No such file or directory
Error: Process completed with exit code 1.

Expected behaviour

File is found and renamed.

Actual behaviour

File not found.

Repository URL

No response

Workflow run URL

No response

YAML workflow

name: 'Example'

on:
  workflow_dispatch: ~

env:
  REGISTRY_IMAGE: mydomain.com/registry/image

defaults:
  run:
    working-directory: ./

jobs:
  prepare:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.platforms.outputs.matrix }}
      tag: ${{ steps.meta.outputs.tags }}
    steps:
      -
        name: Checkout
        uses: actions/checkout@v4
      -
        name: Create matrix
        id: platforms
        run: |
          echo "matrix=['linux/amd64','linux/arm64']" >>${GITHUB_OUTPUT}
      -
        name: Show matrix
        run: |
          echo ${{ steps.platforms.outputs.matrix }}
      -
        name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ${{ env.REGISTRY_IMAGE }}
          flavor: |
            latest=false
          tags: |
            type=raw,value=latest-dev
          bake-target: image
      -
        name: Rename meta bake definition file
        run: |
          mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"

Workflow logs

No response

BuildKit logs

No response

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions