-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add option to choose between git or workflow context to generate metadata #139
Comments
git sha used by the metadata action is the one from the context when the workflow is triggered (before any job). So yes in your case it might not be accurate because the ref is desync from the context. What you can do is overriding this label with something like: labels: |
org.opencontainers.image.revision=${{ steps.kic.outputs.sha }} See also actions/checkout#281 |
@crazy-max yeah that would work, I just thought it would be more consistent to get the info from the actual commit/tag/branch that was checked out since there's always a checkout in the job, but probably I don't have the full picture of all the different Maybe an input flag to enable getting the info from the current commit? Just throwing it out there 😄 |
Not always. You can build a Docker image using a Git context so it does not require the checkout step.
Yeah I understand what you mean but the action heavily relies on the current context via the hydrated Octokit client (aka I will think about it, maybe something like: - name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
context: <workflow|git> |
Ah good to know.
yeah something like that would be great! |
If I could +1 this, I'd be very much interested in it too! |
+1 for that, we have a workflow that uses |
So if you use the |
Behaviour
I have a workflow that checks out the latest tag and rebuilds the Docker image if the base image was updated. Context info contains info from master:
Steps to reproduce this issue
Expected behavior
org.opencontainers.image.revision
contains the sha from the tag that was checked outActual behaviour
org.opencontainers.image.revision
contains the sha from the latest commit onmaster
Configuration
Logs
logs_11965.zip
The text was updated successfully, but these errors were encountered: