-
-
Notifications
You must be signed in to change notification settings - Fork 170
jenkins: add check for checked out commit #4046
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
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.
| # 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 |
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.
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.
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.
We can deploy the change and monitor for errors.
|
I've added an extra check that |
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
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.