jenkins: add check for checked out commit#4046
Merged
richardlau merged 3 commits intomainfrom Mar 25, 2025
Merged
Conversation
Add a check that the gitref being built has not been updated since the build was requested. Requires `COMMIT_SHA_CHECK` to be set to the SHA of the commit to build/test.
richardlau
commented
Mar 21, 2025
Comment on lines
+30
to
+35
| # COMMIT_SHA_CHECK needs to be set in the job. Check that the gitref | ||
| # that is checked out hasn't been updated since the job was requested. | ||
| if [ "$(git rev-parse HEAD)" != "$(git rev-parse ${COMMIT_SHA_CHECK})" ]; then | ||
| echo "HEAD does not match expected COMMIT_SHA_CHECK" | ||
| exit 1 | ||
| fi |
Member
Author
There was a problem hiding this comment.
We might be able to change the checkout on L20 above to checkout $COMMIT_SHA_CHECK but I don't know if anything will break (for example, the subsequent possible rebase?) if the checkout is a "detached HEAD" state and not a checkout of a branch.
Member
There was a problem hiding this comment.
We can deploy the change and monitor for errors.
UlisesGascon
approved these changes
Mar 21, 2025
Member
Author
|
I've added an extra check that |
UlisesGascon
approved these changes
Mar 24, 2025
richardlau
pushed a commit
that referenced
this pull request
Mar 25, 2025
richardlau
added a commit
that referenced
this pull request
Mar 27, 2025
Only enforce the COMMIT_SHA_CHECK verification when: - The org/repo is not nodejs/node (i.e. outside of our project). - The org/repo is nodejs/node and the reference is for a pull request. Refs: #4046
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a check that the gitref being built has not been updated since the build was requested. Requires
COMMIT_SHA_CHECKto be set to the SHA of the commit to build/test.