-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
CI: logformatter: link to correct PR base #23081
CI: logformatter: link to correct PR base #23081
Conversation
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.
Thanks I assume this is in reply to #23068 (comment)
I also couldn't find anything documenting the purpose of CIRRUS_BASE_SHA.
I do wonder now should this not remove all CIRRUS_BASE_SHA references from lib.sh, per comment it was only set there to use it for EPOCH_TEST_COMMIT. Now that you removed that part I would assume we can remove the entire block there.
Yes, thank you for reporting that. I left |
This value is only relevant for PRs. It's simply the sha of the branch the PR derived from. Since it's coming from the CI system, I considered it more authoritative than a value derived from
As-is today, it wouldn't surprise me if many/most of these original use-cases have been moved/removed.
This isn't too hard to get your head around 😉
So, the hack script only indirectly depends on any Edit: Opened containers/automation_images#362 |
ca4be5d
to
ace26ed
Compare
It actually isn't: that's the purpose of this PR. I interpret your comments as meaning "we don't care about CIRRUS_BASE_SHA" so I've removed it and re-pushed |
ace26ed
to
e1a0959
Compare
I'm misunderstanding something. Are you saying if a branch has commits 1, 2, and 3. CI running on a PR based on commit 2, will have If so, that is indeed astonishing. To the point I would call it a Cirrus-CI bug.
We only care about it to the extent that all of the other CI scripts and Makefile and whatnot care about it. The That said, the CI simulation isn't perfect and interactions w/ |
As I'm understanding it,
Then if time passes, three more PRs merge into main (F, G, H), and you repush your PR without rebasing, CIRRUS_BASE_SHA = H |
Ewww, yes, that is indeed broken. I would/have expected it to remain "C" in your example, regardless of what happens on main. I'll report this to Cirrus as a bug and if they can't/won't fix it, recommend they update the docs instead. "Base SHA if current build was triggered by a PR" isn't specific enough regardless. Edit: Filed cirruslabs/cirrus-ci-docs#1279 |
e1a0959
to
2ceb298
Compare
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.
LGTM
Thanks, but it's not working! It's skipping all CI tests. EPOCH_TEST_COMMIT must be wonky but I can't find an envariable dump in which to see what it is. Marking draft to avoid merging this yet. |
2e8ae3d
to
39ebb5e
Compare
Two enormous misunderstandings: 1) $CIRRUS_BASE_SHA is worthless. I thought it was, you know, the BASE SHA of the current commit, but (as best I can tell) it seems to be the SHA of the most recent commit on the destination branch. Cirrus docs are unhelpful. Anyhow, it's clearly not anything useful. Stop using it. 2) $EPOCH_TEST_COMMIT is closer to what we want. It is defined in Makefile as the git merge-base. But for unknown reasons it was being clobbered in CI scripts, and it doesn't seem to work in all contexts, so, eliminate it from CI setup scripts. Leave it only in Makefile. This leaves us with no option other than defining our own merge-base variable, PR_BASE_SHA. Do so and pass it along to rootless jobs. Signed-off-by: Ed Santiago <[email protected]>
39ebb5e
to
1a6a200
Compare
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.
After much hairpulling, I believe this is working and ready for review. Sample log, scroll to top and note the Base commit
link.
@@ -276,7 +276,6 @@ help: ## (Default) Print listing of key targets with their descriptions | |||
|
|||
.PHONY: lint | |||
lint: golangci-lint | |||
@echo "Linting vs commit '$(call err_if_empty,EPOCH_TEST_COMMIT)'" |
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.
As best I can tell, PRE_COMMIT
does not use EPOCH_TEST_COMMIT
. This echo
was added in #5066, back in February 2020, but I think it was a mistake.
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 pretty sure pre-cmmit doesn't. I know vbatts/gitvalidate does use it though (in case that matters here).
base=$(git merge-base $DEST_BRANCH $head) | ||
# shellcheck disable=SC2154 | ||
base=$PR_BASE_SHA | ||
echo "_bail_if_test_can_be_skipped: head=$head base=$base" |
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.
debugging printf. Does anyone mind if I leave it in for a little while?
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.
It's fine IMO
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.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: edsantiago, Luap99 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
Followup to containers#23081, which broke this test on nightly cron. Signed-off-by: Ed Santiago <[email protected]>
Two enormous misunderstandings:
$CIRRUS_BASE_SHA is worthless. I thought it was, you know, the BASE SHA of the current commit, but (as best I can tell) it seems to be the SHA of the most recent commit on the destination branch. Cirrus docs are unhelpful. Anyhow, it's clearly not anything useful. Stop using it.
$EPOCH_TEST_COMMIT is closer to what we want. It is defined in Makefile as the git merge-base. But for unknown reasons it was being clobbered in CI scripts, and it doesn't seem to work in all contexts, so, eliminate it from CI setup scripts. Leave it only in Makefile.
This leaves us with no option other than defining our own merge-base variable, PR_BASE_SHA. Do so and pass it along to rootless jobs.
Signed-off-by: Ed Santiago [email protected]