Skip to content

refs with uppercase characters trigger an error in buildx (branch names with uppercase characters) #405

Open

Description

@WarpedPixel

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

I have a mixed case user name. This means that a branch might be called WarpedPixel/issue200, which generates a ref WarpedPixel-issue200. This triggers an error in buildx:

ERROR: invalid tag "WarpedPixel-issue455": repository name must be lowercase

Expected behaviour

metadata action should generate sanitized, valid tags only. In this situation it should convert the branch name/ref to lower case.

Actual behaviour

Throws an error. I can't really use branch names with mixed case (which are created automatically by other tools like vscode). For such branches, I don't know what the workaround that would allow me to use the metadata action in a GitHub Actions build.

Repository URL

No response

Workflow run URL

No response

YAML workflow

- name: Docker metadata
  id: meta
  uses: docker/metadata-action@v5
  with:
    tags: |
      type=ref,event=branch
      type=ref,event=pr
      type=semver,pattern={{version}},enable={{is_default_branch}}
      type=sha
      type=sha,format=long

- name: Build Frontend
  id: build_frontend
  uses: docker/build-push-action@v5.3.0
  with:
    context: ./frontend
    build-args: VERSION=${{ needs.versioning.outputs.version }}
    push: false
    cache-from: type=gha
    cache-to: type=gha,mode=max
    target: production
    outputs: type=image
    tags: |
      ${{ needs.versioning.outputs.tags }}
      frontend:production
    labels: ${{ needs.versioning.outputs.labels }}

Workflow logs

No response

BuildKit logs

No response

Additional info

No response

Activity

  1. jamesiarmes commented on May 8, 2024

    @jamesiarmes

    I just ran into this issue as well. It seems the tag should be put through the same sanitation as the name.

  2. crazy-max commented on Mar 31, 2025

    @crazy-max
    Member

    metadata action should generate sanitized, valid tags only

    The actions already does it:

    images.push(Meta.sanitizeImageName(image.name));

    metadata-action/src/meta.ts

    Lines 622 to 624 in 902fa8e

    private static sanitizeImageName(name: string): string {
    return name.toLowerCase();
    }

    - name: Docker metadata
      id: meta
      uses: docker/metadata-action@v5
      with:
        tags: |
          type=ref,event=branch
          type=ref,event=pr
          type=semver,pattern={{version}},enable={{is_default_branch}}
          type=sha
          type=sha,format=long

    This step is not valid, image input is required.

    If you have a repro with workflow logs we can look at it. Best would a link to your repo.

  3. Georgegriff commented on Jul 30, 2025

    @Georgegriff

    i'm also seeing upper case characters in branches slipping through to my build and push step on tags.

    I see the code you reference about was sanitising images, not tags?

    Branch that fails: FIX/Caps-in-branches

    Config:

          - name: Docker metadata
            id: docker-metadata
            uses: docker/metadata-action@v5
            with:
              images: |
                ${{ steps.set-registry.outputs.registry }}/my-repo
              tags: |
                type=sha
                type=sha,format=long,prefix=,
                type=ref,event=branch

    Expected docker image tag fix-caps-in-branches actual FIX-Caps-in-branches

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions