-
Notifications
You must be signed in to change notification settings - Fork 34
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
Bug: Autostatus does not work when pipeline is triggered by PR comment #50
Comments
The same issue occurs when a user manually clicks the "build" button in a pull request job. So the SHA1 not being initially available is due to other causes like Manually triggered builds also have a lazy |
Seems like we have a pipeline step that causes the SCM to not be available in certain conditions. I think I'll be able to post reproducible steps for devs. It happens under specific pipeline steps. When I have something reproducible I will comment here how to reproduce. I think this is a github-autostatus bug because Jenkins logs show
And then the pull requests never gets stages voted. I think it should retry to find the SCM and not give up on the whole pipeline. I'll figure out what the sequence of steps that are the exact root cause and post another update here. |
Let me know. There could be a bug in the plugin, but that log is informational level, so I don't know it's an indication. That seems more a symptom of the SCM being unavailable than the cause. But I'm happy to look at any repros |
Thanks for reminding me I need to look at this issue :-) |
Just updating that I haven't had a chance to look further into this, yet. It's top of mind for me. |
I'm still able to replicate this; I'm not sure of the exact cause still. However, when I run an SCM checkout at the beginning of the pipeline there are issues. |
Bug
Triggering builds with PR comments is provided by the pipeline-github-plugin.
When a build is triggered by the cause
org.jenkinsci.plugins.pipeline.github.trigger.IssueCommentCause
then the GitHub autostatus plugin logsAnd does not vote status contexts to GitHub.
Additional information
However, after the build is completed (finished entirely) I can run the script console command to get the revision in a similar manner as this plugin.
More details (Click to expand)
Some investigation using the Jenkins script console.
Which the println statements return (in order)
org.jenkinsci.plugins.pipeline.github.trigger.IssueCommentCause@14ba189
true
class org.jenkinsci.plugins.github_branch_source.PullRequestSCMRevision
Possible solution
It appears that
build.getAction(SCMRevisionAction)
isnull
when a build is first initiated but the first time anscm checkout
occurs the run is populated with anSCMRevisionAction
. This seems to be a unique situation whenIssueCommentCause
is the cause for triggering a build (so no SCM information is available, yet).Does it make sense to add protective code where if
GithubNotificationConfig.java
gets a null result then to put in a "dummy" config which tries to update itself as revision information becomes available?Reproduce Error
Setup environment
pipeline-github
plugin.Reproduce issue
retest this please
.continuous-integration/jenkins/pr-merge
orcontinuous-integration/jenkins/pr-head
depending on what you have configured in the multibranch job.pr-merge
(orpr-head
) context will have the latest build but the stages will have the older build.More info
I'm on github-autostatus plugin 3.2 so the relevant code from my Jenkins logging is https://github.com/jenkinsci/github-autostatus-plugin/blob/github-autostatus-3.2/src/main/java/org/jenkinsci/plugins/githubautostatus/GithubNotificationConfig.java#L148-L165
I looked at #29 which is the only update to that code in newer releases. I don't think upgrading will resolve my issue.
The text was updated successfully, but these errors were encountered: