Skip to content

Tag's sha hash is not long enough in the hash collision case #453

@jung-kim

Description

@jung-kim

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

Our repository has grown and we now see git sha hash collisions and 7 characters are not enough. In our case 7 character long git sha hash we receive at the tag output isn't enough to uniquely tag an image.

> git checkout  356defb
error: short object ID 356defb is ambiguous
hint: The candidates are:
hint:   356defb93 commit 2024-09-11 - Merge remote-tracking branch 'origin/master' into release/v3.4
hint:   356defbc8 blob
error: pathspec '356defb' did not match any file(s) known to git

Can we use the output of the git rev-parse --short=7 to generate the tag so we can uniquely tag?

Expected behaviour

Tags output to be unique for all git commits

Actual behaviour

Tage output is not unique for all git commits

Repository URL

No response

Workflow run URL

No response

YAML workflow

# our github action step
      - name: Docker meta for ui
        id: docker_meta_ui
        uses: docker/metadata-action@v5
        with:
          images: |
            gcr.io/affable-ray-226821/streamnative/cloud-manager-ui
          tags: |
            type=sha
      # outputs JSON outputs tags with `sha-356defb` not `sha-356defb9` or `sha-356defbc` and causes collision

Workflow logs

No response

BuildKit logs

No response

Additional info

No response

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