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

Slash in tag converted to hyphen #189

Closed
aaronadamsCA opened this issue Apr 19, 2022 · 4 comments · Fixed by #201
Closed

Slash in tag converted to hyphen #189

aaronadamsCA opened this issue Apr 19, 2022 · 4 comments · Fixed by #201

Comments

@aaronadamsCA
Copy link

Behaviour

Steps to reproduce this issue

  1. Use tags: type=match,pattern=devcontainer/v(.*),group=1.
  2. Push tag devcontainer/v1.0.0.

Expected behaviour

Docker image version is 1.0.0.

Actual behaviour

Warning: devcontainer/v(.*) does not match devcontainer-v1.0.0.
Warning: No Docker image version has been generated. Check tags input.
Warning: No Docker tag has been generated. Check tags input.

Directory separator / is transformed to a hyphen -. This is unexpected and (I'm pretty sure) undocumented, so it should either be fixed or documented. Thanks!

Configuration

name: Build and push development container image
on:
  push:
    tags:
      - devcontainer/v*
jobs:
  build-and-push-image:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v3.0.1

      - uses: docker/setup-qemu-action@v1.2.0
        with:
          platforms: arm64

      - uses: docker/setup-buildx-action@v1.6.0

      - uses: docker/login-action@v1.14.1
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - id: meta
        uses: docker/metadata-action@v3.7.0
        with:
          images: ghcr.io/${{ github.repository }}/devcontainer
          # This is the line that isn't working
          tags: type=match,pattern=devcontainer/v(.*),group=1

      - uses: docker/build-push-action@v2.10.0
        with:
          context: .devcontainer
          labels: ${{ steps.meta.outputs.labels }}
          platforms: linux/amd64,linux/arm64
          push: true
          tags: ${{ steps.meta.outputs.tags }}
@crazy-max
Copy link
Member

@aaronadamsCA This pattern is documented in the type=match section:

Git tag Pattern Group Output
p1/v1.2.3 p1-v(\d.\d.\d) 1 1.2.3

@aaronadamsCA
Copy link
Author

Thank you! That is well hidden in plain sight.

A clear note would be helpful; it probably makes sense to convert path separators to hyphens so tags are usable sans transformation, but it does violate expectations when pattern matching.

@crazy-max
Copy link
Member

crazy-max commented Apr 20, 2022

A clear note would be helpful; it probably makes sense to convert path separators to hyphens so tags are usable sans transformation, but it does violate expectations when pattern matching.

Agree. I was thinking about it but it will be a breaking change unfortunately. With #176 switch we might consider to solve it as it involves a major update anyway. Keep you in touch.

@crazy-max
Copy link
Member

@aaronadamsCA Oh btw, just recall it was already an issue in the past: #56 (comment)

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

Successfully merging a pull request may close this issue.

2 participants