Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28177

Incorrect revision in commit status notifier when multiple SCMs are used

XMLWordPrintable

      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
      

            Unassigned Unassigned
            abelhegedus Abel Hegedus
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: