Add option to choose between git or workflow context to generate metadata
See original GitHub issueBehaviour
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:
Context info
eventName: schedule
sha: 1c0577d958b4b4bed278593872a3c29f02981a0d
ref: refs/heads/master
workflow: Update Docker Images
action: meta
actor: lucacome
runNumber: 134
runId: 1335539062
Steps to reproduce this issue
- Run the workflow on a schedule
- Checkout a tag
- The sha is not the correct one
Expected behavior
org.opencontainers.image.revision
contains the sha from the tag that was checked out
Actual behaviour
org.opencontainers.image.revision
contains the sha from the latest commit on master
Configuration
- Repository URL (if public): https://github.com/nginxinc/kubernetes-ingress/blob/master/.github/workflows/update-docker-images.yml
- Build URL (if public): https://github.com/nginxinc/kubernetes-ingress/runs/3877415389?check_suite_focus=true#step:11:20
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
ref: v${{ needs.variables.outputs.kic-tag }}
....
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
nginx/nginx-ingress
ghcr.io/nginxinc/kubernetes-ingress
flavor: |
latest=true
suffix=...not relevant...
tags: |
type=raw,value=${{ needs.variables.outputs.kic-tag }}
type=raw,value=${{ steps.tag.outputs.short }}
labels: ...not relevant...
Logs
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:7 (2 by maintainers)
Top Results From Across the Web
git-config Documentation - Git
git -config - Get and set repository or global options ... Take the configuration from the given files instead from global or system-level...
Read more >Field Reference - The workflow engine for Kubernetes
External Fields¶. ObjectMeta¶. ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create. Examples with this ...
Read more >EGit/User Guide - Eclipsepedia
1.3.1 Create Local Repository; 1.3.2 Create Repository at GitHub ... If you selected one of the options to use Git from the Command...
Read more >How to Create a Custom GitHub Action with Node & JavaScript
GitHub Actions are a powerful tool to automate all kinds of tasks in your workflow. While there are a ton of options available...
Read more >Context Object - AWS Step Functions
You can access the context object from the following fields: InputPath. OutputPath. ItemsPath (in Map states). Variable (in Choice states). ResultSelector.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If I could +1 this, I’d be very much interested in it too!
@lucacome
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
@actions/github
).I will think about it, maybe something like: