-
Notifications
You must be signed in to change notification settings - Fork 121
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
Increasing short commit hash length is a breaking change #479
Comments
Came here to post the same. Good news is that there is the ENV you can set to get it working again, but feels like it could have kept the default until a more major version bump. Workaround is to add the env to the action:
|
I guess in your case it breaks for You can either enforce commit sha length with - name: Docker image metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: |
${{ steps.ghcr_image_name.outputs.name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=sha
env:
DOCKER_METADATA_SHORT_SHA_LENGTH: 7 Or rely on the actual metadata outputs https://github.com/docker/metadata-action?tab=readme-ov-file#outputs to get a usable tag like |
In my case, i use a different action for rendering k8s yamls (skaffold...and yeah, i don't like skaffold), and for that tool, I cannot (easily) configure/pass in the sha...it has its own internal opinion about what a short sha is. I get that probably isn't common, but wanted the team to be aware it /is/ breaking peoples flows, and a safer approach would have been to not change a default in a non-major version bump. |
The previous version relying on hardcoded short commit sha to length 7 is a bug on its own as it would be unreliable for huge repositories. As stated in git documentation: https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt---shortltlengthgt
So it defaults to 4 but based on repo size can be higher. We choose 12 as it seems a good defaults which is what Go modules use when computing untagged dependencies. |
I'm going to set the defaults back to 7 but keep the environment variable for people who want to rely on a higher value. |
Should be good with latest patch release. Let us know if that fixes the issue on your side 🙏 |
Thanks @crazy-max . I've tested and can confirm the latest works w/o the ENV. (i'm planning to keep the ENV specified moving forward, fwiw). |
Thank you @crazy-max! I agree that increasing the default from 7-characters is desirable. In my case we don't really need the shortened hash, so I took the opportunity to switch to the full length, using:
|
Contributing guidelines
I've found a bug, and:
Description
#467 increased the default length of the commit hash created by the
sha
directiveThis was released in v5.6.0 which made it immediately apply to everyone whose workflow specified release
v5
in their actions.This change unfortunately broke my workflows, because other parts of our workflows were hard-coded to match the size of the tags created by this action.
Please consider pulling this release and re-releasing it as v6.
Expected behaviour
v5 creates short "sha" tags with 7-character commit hash
Actual behaviour
v5 suddenly creates short "sha" tags with 12-character commit hash
Repository URL
No response
Workflow run URL
No response
YAML workflow
Workflow logs
No response
BuildKit logs
Additional info
No response
The text was updated successfully, but these errors were encountered: