github-plugin icon indicating copy to clipboard operation
github-plugin copied to clipboard

[JENKINS-28177] Incorrect revision in commit status notifier when multiple SCMs are used

Open jenkins-infra-bot opened this issue 10 years ago • 3 comments

When using Multiple SCMs to check out several Git repositories in a single build job, the "revision" of the Build (https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/util/Build.java) will be the revision of the first repository in the list in Multiple SCMs.

However, the Github commit status updater will use the same revision for all repositories (https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/com/cloudbees/jenkins/GitHubCommitNotifier.java#L102). This will cause failures on all repositories other than the first repository.

Workaround: set "Result on failure" to SUCCESS in the Advanced part of the plugin in the Job Configuration.

Exception:
ERROR: Publisher com.cloudbees.jenkins.GitHubCommitNotifier aborted due to exception
java.io.IOException: {"message":"No commit found for SHA: ","documentation_url":"https://developer.github.com/v3/repos/statuses/"}
	at org.kohsuke.github.Requester.handleApiError(Requester.java:440)
	at org.kohsuke.github.Requester._to(Requester.java:219)
	at org.kohsuke.github.Requester.to(Requester.java:173)
	at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:731)
	at com.cloudbees.jenkins.GitHubCommitNotifier.updateCommitStatus(GitHubCommitNotifier.java:127)
	at com.cloudbees.jenkins.GitHubCommitNotifier.perform(GitHubCommitNotifier.java:84)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
	at hudson.model.Build$BuildExecution.post2(Build.java:183)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
	at hudson.model.Run.execute(Run.java:1784)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:89)
	at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: Server returned HTTP response code: 422 for URL: https://api.github.com/repos//statuses/
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1627)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at org.kohsuke.github.Requester.parse(Requester.java:396)
	at org.kohsuke.github.Requester._to(Requester.java:198)
	... 13 more

Originally reported by abelhegedus, imported from: Incorrect revision in commit status notifier when multiple SCMs are used
  • status: Open
  • priority: Minor
  • component(s): github-plugin
  • label(s): commit-status, exception, github, plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 4
  • imported: 2025-12-08
Raw content of original issue

When using Multiple SCMs to check out several Git repositories in a single build job, the "revision" of the Build (https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/util/Build.java) will be the revision of the first repository in the list in Multiple SCMs.

However, the Github commit status updater will use the same revision for all repositories (https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/com/cloudbees/jenkins/GitHubCommitNotifier.java#L102). This will cause failures on all repositories other than the first repository.

Workaround: set "Result on failure" to SUCCESS in the Advanced part of the plugin in the Job Configuration.

Exception:
ERROR: Publisher com.cloudbees.jenkins.GitHubCommitNotifier aborted due to exception
java.io.IOException: {"message":"No commit found for SHA: <revision>","documentation_url":"https://developer.github.com/v3/repos/statuses/"}
	at org.kohsuke.github.Requester.handleApiError(Requester.java:440)
	at org.kohsuke.github.Requester._to(Requester.java:219)
	at org.kohsuke.github.Requester.to(Requester.java:173)
	at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:731)
	at com.cloudbees.jenkins.GitHubCommitNotifier.updateCommitStatus(GitHubCommitNotifier.java:127)
	at com.cloudbees.jenkins.GitHubCommitNotifier.perform(GitHubCommitNotifier.java:84)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
	at hudson.model.Build$BuildExecution.post2(Build.java:183)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
	at hudson.model.Run.execute(Run.java:1784)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:89)
	at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: Server returned HTTP response code: 422 for URL: https://api.github.com/repos/<myrepo>/statuses/<revision>
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1627)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at org.kohsuke.github.Requester.parse(Requester.java:396)
	at org.kohsuke.github.Requester._to(Requester.java:198)
	... 13 more

jenkins-infra-bot avatar Apr 30 '15 16:04 jenkins-infra-bot

integer:
  • Original comment link
  • Raw content of original comment:

    multiple-scm is pain in ass. There is no clear design how it should be integrated with SCMs and their features. Probably scm-api plugin and migration to it somehow can help, but atm i have no ideas.

multiple-scm is pain in ass. There is no clear design how it should be integrated with SCMs and their features.
Probably scm-api plugin and migration to it somehow can help, but atm i have no ideas.

jenkins-infra-bot avatar May 05 '15 09:05 jenkins-infra-bot

abelhegedus:
  • Original comment link
  • Raw content of original comment:

    Thanks for the reply, I mainly reported the issue as it seemed like the best way to allow others with the same problem to find the cause/workaround. I'm not sure which documentation page would be a good place to add this info.

Thanks for the reply, I mainly reported the issue as it seemed like the best way to allow others with the same problem to find the cause/workaround. I'm not sure which documentation page would be a good place to add this info.

jenkins-infra-bot avatar May 06 '15 19:05 jenkins-infra-bot

ltagliamonte:
  • Original comment link
  • Raw content of original comment:

    For the post build action in the latest plugin version you can configure the Repository URL. I'm having instead a similar problem with the the pre-build step `Set build status to pending on Github commit` can you also add there the support to specify the repo URL to use?

For the post build action in the latest plugin version you can configure the Repository URL.
I'm having instead a similar problem with the the pre-build step `Set build status to pending on Github commit` can you also add there the support to specify the repo URL to use?

jenkins-infra-bot avatar Sep 29 '16 00:09 jenkins-infra-bot