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

#370 breaks GitHub Actions build example #381

Closed
3 tasks done
krcm0209 opened this issue Jan 30, 2024 · 3 comments · Fixed by #382
Closed
3 tasks done

#370 breaks GitHub Actions build example #381

krcm0209 opened this issue Jan 30, 2024 · 3 comments · Fixed by #382

Comments

@krcm0209
Copy link

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

@paddatrapper
Copy link

We have the same issue when trying to use upload-artifact to upload bake json files for use elsewhere

paddatrapper added a commit to libretime/libretime that referenced this issue Jan 30, 2024
github-actions bot pushed a commit to libretime/libretime that referenced this issue Jan 30, 2024
Pin docker/metadata-action to 5.4 until
docker/metadata-action#381 is fixed

(cherry picked from commit 3d13f41)
@fhoeben
Copy link

fhoeben commented Jan 31, 2024

I've run into the same issue.

I also see that the example in https://github.com/docker/metadata-action?tab=readme-ov-file#bake-definition still uses ${{ steps.meta.outputs.bake-file }}, but in https://github.com/docker/metadata-action?tab=readme-ov-file#outputs bake-file is no longer listed as an output. Is the usage of this output no longer supported?

@crazy-max
Copy link
Member

I will update the example with this new behavior since 5.5.0. In the meantime you can do:

      -
        name: Rename meta bake definition file
        run: |
          bakeFile="${{ steps.meta.outputs.bake-file }}"
          mv "${bakeFile#cwd://}" "/tmp/bake-meta.json"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants