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

Null value for tags when using with docker/metadata-action bake file output #189

Open
3 tasks done
tk-nguyen opened this issue Feb 29, 2024 · 0 comments
Open
3 tasks done

Comments

@tk-nguyen
Copy link

tk-nguyen commented Feb 29, 2024

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

Hello! I'm using this action together with docker/metadata-action bake file output. I'm using the tags from docker-metadata-action target to generate image name.

Expected behaviour

It should build normally, using the tags from meta action.

Actual behaviour

The action errors out:

Error: #1 [internal] load local bake definitions
#1 reading ./docker-bake.hcl 320B / 320B done
#1 reading /home/runner/work/_temp/docker-actions-toolkit-ZPTkvi/docker-metadata-action-bake-tags.json 247B / 247B done
#1 reading /home/runner/work/_temp/docker-actions-toolkit-ZPTkvi/docker-metadata-action-bake-labels.json 643B / 643B done
#1 reading /home/runner/work/_temp/docker-actions-toolkit-ZPTkvi/docker-metadata-action-bake-annotations.json 696B / 696B done
#1 DONE 0.0s
./docker-bake.hcl:14
--------------------
  12 |     target "test" {
  13 |       inherits = ["_common"]
  14 | >>>   tags = generate_tags("docker.io", target.docker-metadata-action.tags)
  15 |     }
  16 |     
--------------------
ERROR: ./docker-bake.hcl:14,37-71: Invalid function argument; Invalid value for "tags" parameter: argument must not be null., and 1 other diagnostic(s)

Repository URL

https://github.com/tk-nguyen/docker-bake-demo (master branch is after when I moved the bake file with the tags last)

Workflow run URL

https://github.com/tk-nguyen/docker-bake-demo/actions/runs/8098999772/job/22133738961

YAML workflow

on:
  push:
    tags:
      - v*.*.*

name: Docker bake test

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          tags: |
            type=semver,pattern=v{{version}}
            type=semver,pattern=v{{major}}
            type=semver,pattern=v{{major}}.{{minor}}

      - name: Build and push
        uses: docker/bake-action@v4
        with:
          files: |
            ./docker-bake.hcl
            ${{ steps.meta.outputs.bake-file }}
            ${{ steps.meta.outputs.bake-file-annotations }}
          targets: test

Additional info

When I put the bake file with the tags last (either ${{ steps.meta.outputs.bake-file }} or ${{ steps.meta.outputs.bake-file-tags }}), it works perfectly, as seen here: https://github.com/tk-nguyen/docker-bake-demo/actions/runs/8099076031/job/22133989604

@tk-nguyen tk-nguyen changed the title Tags merging problem when using with docker/metadata-action Null value for tags when using with docker/metadata-action bake file output Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant