[JIRA] (JENKINS-54249) GitHub Commit Status Setter - Cannot retrieve Git metadata

25 views
Skip to first unread message

fatmcgav@gmail.com (JIRA)

unread,
Oct 25, 2018, 7:36:02 AM10/25/18
to jenkinsc...@googlegroups.com
Gavin Williams created an issue
 
Jenkins / Bug JENKINS-54249
GitHub Commit Status Setter - Cannot retrieve Git metadata
Issue Type: Bug Bug
Assignee: Kirill Merkushev
Components: github-plugin
Created: 2018-10-25 11:35
Priority: Critical Critical
Reporter: Gavin Williams

Upon upgrading a number of plugins on one of our Jenkins clusters, we observed that builds were failing with the following exceptions:

 

ERROR: [GitHub Commit Status Setter] - Cannot retrieve Git metadata for the build, setting build result to UNSTABLE

 

Rolling the `GitHub` plugin back from '1.29.3' to '1.29.2' removes the error and builds now function as expected. 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

meyerbro@gmail.com (JIRA)

unread,
Nov 6, 2018, 6:24:05 PM11/6/18
to jenkinsc...@googlegroups.com
Felipe Lopes commented on Bug JENKINS-54249
 
Re: GitHub Commit Status Setter - Cannot retrieve Git metadata

+1 here...

Downgrading the Github Plugin to 1.29.2 solved the issue here too...

alexeygrigorov@gmail.com (JIRA)

unread,
Nov 15, 2018, 11:25:02 AM11/15/18
to jenkinsc...@googlegroups.com

+1
org/jenkinsci/plugins/github/util/BuildDataHelper.java:59 it compare github repo name with jekins job name which is epic fail

yoanlin93@gmail.com (JIRA)

unread,
Dec 22, 2018, 11:53:02 PM12/22/18
to jenkinsc...@googlegroups.com

Same here. the project should not be compared with the repo name because they might be different.

yoanlin93@gmail.com (JIRA)

unread,
Dec 23, 2018, 7:26:03 AM12/23/18
to jenkinsc...@googlegroups.com

still got the same result if I use ManuallyEnteredRepositorySource

AdamStracener@GMail.com (JIRA)

unread,
Jan 31, 2019, 3:02:03 PM1/31/19
to jenkinsc...@googlegroups.com

johan@andersson.net (JIRA)

unread,
Jan 31, 2019, 5:09:24 PM1/31/19
to jenkinsc...@googlegroups.com

Same here! Error both when starting end finishing a build.

 

ERROR: [GitHub Commit Status Setter] Failed to update commit state on GitHub. Ignoring exception [Cannot retrieve Git metadata for the build]

I was using GitHub plugin v1.29.3 both before and after my upgrade when this started. Some of the plugin upgrades I had pending that after installing forced me to do a rollback:

Git 3.9.1 -> 4.0.0rc

Git client 2.7.3 -> 3.0.0rc

GitHub API 1.92 -> 1.95

 

 

 

jpstrydom8@gmail.com (JIRA)

unread,
Feb 4, 2019, 6:40:03 AM2/4/19
to jenkinsc...@googlegroups.com

We're experiencing the same issue but rolling back to GitHub 1.9.2 did not fix our issue. Everything worked fine before, but it suddenly stopped working today and I suspect a few updates caused the issue (I'm not sure which ones did unfortunately).

Our JenkinsFile looks as follows:

#!/usr/bin/env groovy 
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5')), [$class: 'ScannerJobProperty', doNotScan: false]])
node {
    stage('JENKINS - Initialize') {
        echo 'Initializing...'
        def node = tool name: 'node-lts', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
        env.PATH = "${node}/bin:${env.PATH}"
     }
 
     stage('JENKINS - Checkout') {
        echo 'Getting out source code...'
        checkout scm
     }
    customStage('JENKINS - Install Dependencies') {
        echo 'Retrieving tooling versions...'
        sh 'node --version'
        sh 'npm --version'
        sh 'yarn --version'
        echo 'Installing node dependencies...'
        sh 'yarn install'
     }
    customStage('JENKINS - Tests') {
        echo 'Running tests...'
        sh 'npm test'
    }
}
void customStage(String context, Closure closure) {
     stage(context);
     try {
         setBuildStatus(context, "In progress...", "PENDING");
         closure();
     } catch (Exception e) {
         setBuildStatus(context, e.take(140), "FAILURE");
     }
     setBuildStatus(context, "Success", "SUCCESS");
}
void setBuildStatus(String context, String message, String state) {
     step([
         $class: "GitHubCommitStatusSetter",
         contextSource: [$class: "ManuallyEnteredCommitContextSource", context: context],
         reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/REPO_URL"],
         errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
         statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
     ]);
}

Any suggestions would be welcome. 
Thanks!

jpstrydom8@gmail.com (JIRA)

unread,
Feb 4, 2019, 6:54:02 AM2/4/19
to jenkinsc...@googlegroups.com
JP Strydom edited a comment on Bug JENKINS-54249
We're experiencing the same issue but rolling back to GitHub 1.9.2 did not fix our issue. Everything worked fine before, but it suddenly stopped working today and I suspect a few updates caused the issue (I'm not sure which ones did unfortunately).

Our JenkinsFile looks as follows:
{code:java}

   
customStage('JENKINS - Install Dependencies') {

   
customStage('JENKINS - Tests') {
{code}
I receive a "{color:#FF0000}ERROR: [GitHub Commit Status Setter] - Cannot retrieve Git metadata for the build, setting build result to UNSTABLE{color:#172b4d}"{color} {color:#172b4d}error message everytime the *setBuildStatus* method is called (i.e. at the end of every *customStage*).{color}{color}

Any suggestions would be welcome. 
Thanks!

gabor.farkas@aliz.ai (JIRA)

unread,
Feb 4, 2019, 9:50:02 AM2/4/19
to jenkinsc...@googlegroups.com

Are there any alternatives to using this status setter?

ostov@softserveinc.com (JIRA)

unread,
Feb 4, 2019, 12:59:03 PM2/4/19
to jenkinsc...@googlegroups.com

Downgrading versions of these plugins solved the issue:

Git 4.0.0rc

Git client 3.0.0rc

gabor.farkas@aliz.ai (JIRA)

unread,
Feb 5, 2019, 3:56:04 AM2/5/19
to jenkinsc...@googlegroups.com

I couldn't downgrade due to some plugin interdependencies.

But here's a solution with sh: https://gist.github.com/gabor-farkas/4d02c7b2afdc23addfc22a333bbb6cf6

w.deborger@gmail.com (JIRA)

unread,
Feb 5, 2019, 5:12:02 AM2/5/19
to jenkinsc...@googlegroups.com

I can confirm that the issue is resolved by downgrading 

  • Git 4.0.0rc 
  • Git client 3.0.0rc

 

brice.figureau@daysofwonder.com (JIRA)

unread,
Feb 8, 2019, 5:19:04 AM2/8/19
to jenkinsc...@googlegroups.com

Same issue. Downgrading Git and Git client as explained in previous comments has solved the issue. Note that the 'Set GitHub commit status (universal)' is also affected.

jeremy.baker@northwestern.edu (JIRA)

unread,
Feb 8, 2019, 10:59:02 AM2/8/19
to jenkinsc...@googlegroups.com

+1 for me, downgrading also helped for now.  

rrockers@gmail.com (JIRA)

unread,
Feb 8, 2019, 5:34:02 PM2/8/19
to jenkinsc...@googlegroups.com
brockers commented on Bug JENKINS-54249

+1  for me.  Downgrade isn't an option because of other dependancies.  Probably have 15 broken builds.  I assume the best fix for now is to disable the plugin.

laurent.heirendt@uni.lu (JIRA)

unread,
Feb 21, 2019, 5:40:02 AM2/21/19
to jenkinsc...@googlegroups.com

baptiste.gaillard@gmail.com (JIRA)

unread,
Feb 21, 2019, 10:29:03 AM2/21/19
to jenkinsc...@googlegroups.com

Hi, as brockers we cannot downgrade because their are too much dependencies between plugins and it breaks our Jenkins setup.

Is somebody planning to work on this issue soon ? For us this is very critical, we have 10th of builds which do not work since the update .

ostov@softserveinc.com (JIRA)

unread,
Feb 21, 2019, 11:00:03 AM2/21/19
to jenkinsc...@googlegroups.com

Baptiste Gaillard & brockers

Downgrade dependencies 1st. Then downgrade Git 4.0.0rc and Git client 3.0.0rc.

After restart you will be able to upgrade everything back to latest versions - Git 3.9.3 and Git client 2.7.6.

 

ostov@softserveinc.com (JIRA)

unread,
Feb 21, 2019, 11:06:03 AM2/21/19
to jenkinsc...@googlegroups.com
Oleksandr Stovbenko edited a comment on Bug JENKINS-54249
[~bgaillard] & [~brockers]


Downgrade dependencies 1st. Then downgrade Git 4.0.0rc and Git client 3.0.0rc.

After restart you will be able to upgrade everything back to latest versions - Git 3.9.3 and Git client 2.7.6 (rc version not available anymore) .
h1.  

ostov@softserveinc.com (JIRA)

unread,
Feb 21, 2019, 11:06:06 AM2/21/19
to jenkinsc...@googlegroups.com
Oleksandr Stovbenko edited a comment on Bug JENKINS-54249
[~bgaillard] & [~brockers]

Downgrade dependencies 1st. Then downgrade Git 4.0.0rc and Git client 3.0.0rc.

After restart you will be able to upgrade everything back to latest versions - Git 3.9.3 and Git client 2.7.6 (rc version versions not available anymore).
h1.  

ostov@softserveinc.com (JIRA)

unread,
Feb 21, 2019, 11:07:04 AM2/21/19
to jenkinsc...@googlegroups.com
Oleksandr Stovbenko edited a comment on Bug JENKINS-54249
[~bgaillard] & [~brockers]

Downgrade dependencies 1st. Then downgrade Git 4.0.0rc and Git client 3.0.0rc.

After restart you will be able to upgrade everything back to latest versions - Git 3.9.3 and Git client 2.7.6 (rc are versions not available anymore).
h1.  

baptiste.gaillard@gmail.com (JIRA)

unread,
Jun 11, 2019, 4:35:03 PM6/11/19
to jenkinsc...@googlegroups.com

Oleksandr Stovbenko thanks for the suggestions, I already tried this few months ago without success.

Today I tried to update the https://github.com/jenkinsci/github-plugin to find the problem and fix it.

It seems that the problem came from the fact that the https://github.com/jenkinsci/git-plugin replaced the BuildData class by the BuildDetails class (this is explained here https://github.com/jenkinsci/git-plugin/commit/07cfa5ddef698838b01d4214915f98d4e902c0f8#diff-6cb4dc50342af417dc66c68b45c48fb1).

As a result when Jenkins run a job the Github plugin failed to get the last build (to then retrieve the revision SHA1). 

For now I just implemented VERY UGLY updates (i'll take the time to propose a clean PR later), the repo is here https://github.com/bgaillard/github-plugin.

If you would like to test it compile it with mvn install -Dmaven.test.skip=true (I did not took time to fix the tests).

baptiste.gaillard@gmail.com (JIRA)

unread,
Jun 13, 2019, 4:24:03 AM6/13/19
to jenkinsc...@googlegroups.com

For those who do not want to compile the project from my fork you can find the HPI file here https://github.com/bgaillard/github-plugin/releases/tag/v1.30.0-alpha-1 and install it manually in Jenkins.

Hope this helps.

baptiste.gaillard@gmail.com (JIRA)

unread,
Jun 15, 2019, 11:17:03 AM6/15/19
to jenkinsc...@googlegroups.com

High, I created a PR on the github plugin project here https://github.com/jenkinsci/github-plugin/pull/216. Hope this one will be reviewed and accepted quickly

baptiste.gaillard@gmail.com (JIRA)

unread,
Jun 15, 2019, 11:19:04 AM6/15/19
to jenkinsc...@googlegroups.com
Baptiste Gaillard edited a comment on Bug JENKINS-54249
High Hi , I created a PR on the github plugin project here [https://github.com/jenkinsci/github-plugin/pull/216]. Hope this one will be reviewed and accepted quickly ;)

jcarsique@java.net (JIRA)

unread,
Jun 20, 2019, 11:10:03 AM6/20/19
to jenkinsc...@googlegroups.com

Baptiste Gaillard Thank you! However, this ticket is missing a stack trace for accuracy. The PR you submitted does not match our current install while we do have the same/similar issue.

As I wrote in the PR thread: we're encountering the same issue symptom with lower plugin versions (see https://jira.nuxeo.com/browse/NXBT-2867).
Our current versions are:

  • CloudBees Jenkins Enterprise 2.164.3.2-rolling
  • Git client plugin 2.7.6
  • Git plugin 3.9.3
  • SCM API Plugin 2.4.0

What is your stacktrace and reproduction case please? Is it the same?

  java.io.IOException: Cannot retrieve Git metadata for the build
  	at org.jenkinsci.plugins.github.util.BuildDataHelper.getCommitSHA1(BuildDataHelper.java:87)
  	at org.jenkinsci.plugins.github.status.sources.BuildDataRevisionShaSource.get(BuildDataRevisionShaSource.java:32)
  	at org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter.perform(GitHubCommitStatusSetter.java:135)
  Caused: org.jenkinsci.plugins.github.common.CombineErrorHandler$ErrorHandlingException
  	at org.jenkinsci.plugins.github.common.CombineErrorHandler.handle(CombineErrorHandler.java:74)
  	at org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter.perform(GitHubCommitStatusSetter.java:164)
  	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
  	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
  	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
  	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  	at java.lang.Thread.run(Thread.java:748)

when running

    step([$class: 'GitHubCommitStatusSetter', reposSource: [$class: 'ManuallyEnteredRepositorySource', url: repos_url],
        contextSource: [$class: 'ManuallyEnteredCommitContextSource', context: '...'],
        statusResultSource: [$class: 'ConditionalStatusResultSource',
            results: [[$class: 'AnyBuildResult', message: status_msg.get(status), state: status]]]]) 

baptiste.gaillard@gmail.com (JIRA)

unread,
Jun 20, 2019, 4:43:04 PM6/20/19
to jenkinsc...@googlegroups.com

 Hi Julien Carsique, no need to provide a Stack Trace in my case.

I explained the problem in my previous comment, in our case the problem is caused by the version `4.0.x` of the Jenkins git-plugin. 

It seems that your Exception is thown at the same place than our, in our case at line L78 the method returns an empty list.

As a result at L82 the `buildData` returned is `null` and then at L87 an `IOException` is thrown.

The problem in our case is that the git-plugin does not create `BuildData` objects since version `4.0.x`, instead it creates instances of class `BuildDetails`. So using `build.getActions(BuildData.class)` does not work, I used ``build.getActions(BuildDetails.class)` instead at L78 and adapted the code in consequence to fix the problem.

I think you can try to debug the problem as I did. What your can do is to update the Github Plugin by adding a logger and logging the class names of the actions you'll receive when calling https://javadoc.jenkins-ci.org/hudson/model/Actionable.html#getActions-- at the beginning of the `getCommitSHA1` function.

Their are chances you have an `Action` describing your build which is not of same class as the `BuildData` class and that's why its not working as expected.

Let me know if you tried to fix the problem and what is the class name of your action in your case. 

Hope this helps

baptiste.gaillard@gmail.com (JIRA)

unread,
Jun 20, 2019, 4:44:06 PM6/20/19
to jenkinsc...@googlegroups.com
Baptiste Gaillard edited a comment on Bug JENKINS-54249
 Hi [~jcarsique], no need to provide a Stack Trace in my case.


I explained the problem in my previous comment, in our case the problem is caused by the version
` {{ 4.0.x ` }}  of the Jenkins git-plugin. 

It seems that your Exception is thown at the same place than our, in our case at line [L78|
[https://github.com/jenkinsci/github-plugin/blob/v1.29.3/src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java #L78]] the method returns an empty list.

As a result at [L82|
[https://github.com/jenkinsci/github-plugin/blob/v1.29.3/src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java #L82]] the ` {{ buildData ` }}  returned is ` {{ null ` }}  and then at [L87| [https://github.com/jenkinsci/github-plugin/blob/v1.29.3/src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java #L87]] an ` {{ IOException ` }}  is thrown.

The problem in our case is that the git-plugin does not create
` {{ BuildData ` }}  objects since version ` {{ 4.0.x ` }} , instead it creates instances of class ` {{ BuildDetails ` }} . So using ` {{ build.getActions(BuildData.class) ` }}  does not work, I used `` {{ build.getActions(BuildDetails.class) ` }}  instead at [L78| [https://github.com/jenkinsci/github-plugin/blob/v1.29.3/src/main/java/org/jenkinsci/plugins/github/util/BuildDataHelper.java #L78]] and adapted the code in consequence to fix the problem.


I think you can try to debug the problem as I did. What your can do is to update the Github Plugin by adding a logger and logging the class names of the actions you'll receive when calling [https://javadoc.jenkins-ci.org/hudson/model/Actionable.html#getActions--] at the beginning of the
` {{ getCommitSHA1 ` }}  function.


Their are chances you have an
` {{ Action ` }}  describing your build which is not of same class as the ` {{ BuildData ` }}  class and that's why its not working as expected.


Let me know if you tried to fix the problem and what is the class name of your action in your case. 

Hope this helps

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 16, 2019, 6:15:03 AM9/16/19
to jenkinsc...@googlegroups.com

Git plugin 4.0.0rc was mistakenly released to the Jenkins update center when it was expected to only be released to the Jenkins experimental update center. Git plugin 4.0.0-beta10 and git plugin 4.0.0-beta11 both include the BuildDetails capability that had been removed from Git plugin 4.0.0rc. Refer to JENKINS-19022 for the reasons it would be desirable to remove BuildData from the plugin.

When git plugin 4.0.0 officially releases, it will include BuildData. The attempt to remove BuildData was unsuccessful during the pre-release phase of git plugin 4.0.0, so it has been reinstated into the git plugin.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

byungho.alan.lee@gmail.com (JIRA)

unread,
Sep 19, 2019, 12:31:02 AM9/19/19
to jenkinsc...@googlegroups.com
Alan Lee commented on Bug JENKINS-54249

Could someone summarize the latest status of this issue?

I'm looking for a solution that does not require downgrading any of the plugins.

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 19, 2019, 6:20:03 AM9/19/19
to jenkinsc...@googlegroups.com

Alan Lee the latest release of the GitHub plugin (1.29.3) depends on git plugin 3.4.0 or newer. The GitHub plugin expects the git plugin to write BuildData.

All releases of git plugin 3.x write BuildData. Git plugin 4.0.0-beta10 (pre-release delivered July 5, 2019) and git plugin 4.0.0-beta11 (pre-release delivered Sep 13, 2019) write BuildData.

Git plugin 4.0.0-rc (pre-release delivered Jan 30, 2019) does not write BuildData. Git plugin 4.0.0-rc was a failed attempt to resolve the memory bloat caused by the git plugin (JENKINS-19022). The attempt introduced too many incompatibilities and had to be reverted. My sincere apologies that I released git plugin 4.0.0-rc. The poor choice of version string caused it to appear in the Jenkins update center rather than in the Jenkins experimental update center.

If you are running git plugin 4.0.0-rc and cannot downgrade, then I assume that means some plugin in your installation has declared a dependency on git plugin 4.0.0-rc. That plugin needs to be updated to not depend on git plugin 4.0.0-rc. The BuildData related changes in git plugin 4.0.0-rc are not included in git plugin 4.0.0-beta10 and are not included in git plugin 4.0.0-beta11 and will not be included in the final release of git plugin 4.0.0. The git plugin 4.0.0-rc release was a terrible mistake that I made which delivered pre-release code to the production Jenkins update center. The git plugin 4.0.0-rc release was also the clear proof that the API changes proposed in git plugin 4.0.0 pre-releases introduced too much incompatibility for other plugins that use the BuildData provided by the git plugin.

If you cannot downgrade because an installed plugin has an explicit dependency on 4.0.0-rc, then you should still be able to upgrade to git plugin 4.0.0-beta11 from the experimental upgrade center. However, if one of your installed plugins truly has a dependency on git plugin 4.0.0-rc, it seems likely that the reason it depends on git plugin 4.0.0-rc is because it is using the API changes that were included in git plugin 4.0.0-rc. Those API changes are not available in newer pre-releases of git plugin 4.0.0 like git plugin 4.0.0-beta10 and git plugin 4.0.0-beta11.

In summary, if you cannot downgrade because one of your plugins explicitly depends on git plugin 4.0.0-rc, then that plugin must be changed to not depend on git plugin 4.0.0-rc. If you cannot downgrade for some other reason, then you can likely upgrade to git client plugin 3.0.0-beta11 and git plugin 4.0.0-beta11.

byungho.alan.lee@gmail.com (JIRA)

unread,
Sep 19, 2019, 11:25:03 AM9/19/19
to jenkinsc...@googlegroups.com
Alan Lee commented on Bug JENKINS-54249

Mark Waite Thanks for a comprehensive summary of the issue. I think what I need is the last paragraph. Will try it out.

mark.earl.waite@gmail.com (JIRA)

unread,
Sep 19, 2019, 11:42:05 AM9/19/19
to jenkinsc...@googlegroups.com

If you have a publicly available plugin that explicitly depends on git plugin 4.0.0-rc (and not on earlier released versions), then the plugin maintainer needs to be notified that 4.0.0-rc is a dead and removed release.

baptiste.gaillard@gmail.com (JIRA)

unread,
Nov 16, 2019, 5:06:04 AM11/16/19
to jenkinsc...@googlegroups.com

Hi, with the release of Git plugin 4.0.0 it appears to work now (and no more Jenkins crashes after downgrading plugins).

Here are the steps i followed to fix the problem.

  1. Upgrade Jenkins master to the last version (we use the Blue Ocean Docker container in version 1.21.0)
  2. Execute the following in Manage Jenkins -> Script Console, this allows to identify the Jenkins plugins which depend on version 4.0.0-rc of Git Plugin
     def plugins = jenkins.model.Jenkins.instance.getPluginManager().getPlugins()
    plugins.each {
        println "${it.getShortName()} (${it.getVersion()}) => ${it.getDependencies()}\n"
    }
  3. {{}}Downgrade the plugins with a dependency to Git Plugin 4.0.0-rc
  4. Upgrade Git Plugin to version 4.0.0 and the other plugins which depend on it (most probably those found in step 3.)

Hope this helps.

mark.earl.waite@gmail.com (JIRA)

unread,
Nov 16, 2019, 9:15:05 AM11/16/19
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Fixed
 

Resolved regression in git plugin 4.0.0-rc by releasing git plugin 4.0.0

Jenkins / Bug JENKINS-54249
Change By: Mark Waite
Status: Open Closed
Resolution: Fixed
Reply all
Reply to author
Forward
0 new messages