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

First branch build always fails with "failed: bad object" from git with Global Shared Libraries

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When using the Multibranch Pipeline and Jenkinsfile, and with a Global Shared Library configuration, the initial build of a new branch of a multi-branch pipeline fails with the message: "fatal: bad object XXXXX". Doing the build manually or pushing a new change to trigger the build, and everything works without issue.

      As far as I can tell, the issue is that we are using Global Shared Libraries that are set to load automatically as well as the Remote Jenkinsfile plugin to manage the build. The logs show that the process the job uses is:

      1. Checkout using the normal Git Plugin the repo with the Jenkinsfile to use for the job. The relevant lines are:

        1. Checking out Revision 80c4c1bcf8a763c1edb16e1fb32f921008b87e1b (origin/main)10:10:06 > git config core.sparsecheckout # timeout=10*10:10:06* > git checkout -f 80c4c1bcf8a763c1edb16e1fb32f921008b87e1b # timeout=10
      2. Checkout the Global Shared Library repo using the Git Plugin for the shared libraries to load. The relevant lines are:

        1. Checking out Revision 092d776fba95a9818c68c80f40b1afcc6273f553 (main)10:10:08 > git config core.sparsecheckout # timeout=10*10:10:08* > git checkout -f 092d776fba95a9818c68c80f40b1afcc6273f553 # timeout=10
      3. Right after this checkout, the message: fatal: bad object 80c4c1bcf8a763c1edb16e1fb32f921008b87e1b is shown. Note that the the refspec is the one for the Remote Jenkinsfile that was used.

      We have tried turning off the implicit loading of the Shared Libraries, and we get the same issue when the main codeline is checked out, using the Bitbucket plugin instead of the main git plugin. So it would seem that the issue is somehow related to using the "Remote Jenkinsfile" plugin to read the Jenkinsfile, though it is not clear why.

       

        Attachments

          Activity

          Hide
          macdrega Joerg Schwaerzler added a comment - - edited

          Actually, I can confirm this issue. We face the same thing. What I found was:

          • It only happens in the first feature branch or PR build
          • The bad object referred to is the git hash of the shared library (tried with different libraries) being checked out
          • It happens when we load the library implicitly or explicitly
          • As soon as we do not load the library (it actually does not matter whether the library is being used), the message disappears
          • This issue is independent on whether we use the declarative Pipeline implicit checkout, or and explicit checkout in a scripted pipeline. I assume that the git and checkout scm steps will show the same behavior

          I assume that the calculation of the change history somehow is responsible. Probably tries to find the git hash the library was checked out to in the current repo.

          Show
          macdrega Joerg Schwaerzler added a comment - - edited Actually, I can confirm this issue. We face the same thing. What I found was: It only happens in the first feature branch or PR build The bad object referred to is the git hash of the shared library (tried with different libraries) being checked out It happens when we load the library implicitly or explicitly As soon as we do not load the library (it actually does not matter whether the library is being used), the message disappears This issue is independent on whether we use the declarative Pipeline implicit checkout, or and explicit checkout in a scripted pipeline. I assume that the git and checkout scm steps will show the same behavior I assume that the calculation of the change history somehow is responsible. Probably tries to find the git hash the library was checked out to in the current repo.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            mzampetti Marc Zampetti
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: