-
Notifications
You must be signed in to change notification settings - Fork 0
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
Initial implementation #1
Conversation
42ed19e
to
efd8837
Compare
|
action.yaml
Outdated
# Determine commit SHA | ||
sha="$(git rev-parse HEAD)" | ||
echo "sha=$sha" | tee -a "$GITHUB_OUTPUT" | ||
|
||
case "$sha" in | ||
"${{ github.event.pull_request.head.sha }}") | ||
is_pr_head_sha=true | ||
;; | ||
"${{ github.sha }}") | ||
is_pr_head_sha=false | ||
;; | ||
*) | ||
echo "Context uses unexpected commit SHA" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
echo "is-pr-head-sha=${is_pr_head_sha}" | tee -a "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more time to check my understanding: this is meant to run on checked out code. when it's run in a workflow that's triggered by a PR, because this workflow doesn't do the checking out, we need to be able to handle both the case where the checked out code is hte merge commit and the case where it's the head commit, is that right? could you add a comment to explain that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Docker image we build is intended to use a directory base context
. With this the image which is built is based upon the commit used in actions/checkout
. I intended to just simply do git rev-parse HEAD
to get the checked out commit but the issue is that the docker/metadata-action
when generating tags and annotations will end up pulling details about the commit SHA from the workflow metadata. This is why we need to use DOCKER_METADATA_PR_HEAD_SHA
at all to instruct the action which SHA to use when running as a PR.
I did some experimenting here and tried to create the tags more manually using type=raw
but ran into issue where the docker/metadata-action
would fail when trying to use an arbitrary commit. As this was turning into a rabbit hole I didn't want to keep going down I opted to limit this action to only support PR merge commits and the head commit which are only use cases we use internally.
The primary point of concern is we don't want to have our image tags or annotations stating the were built with one commit SHA when in reality they were built with another.
I'll open an issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to get some other work done and then come back to these tests. I think I'd like to test all of these in parallel:
Getting this to work in a matrix is weird so I may need to deal with the limiting parallel testing factors or consider some other options. |
|
I've revised the tests fairly heavily to allow for more parallelism and testing on both |
TODO: