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

Git publisher fails when git tool chooser selects JGit

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.249.1
      Git plugin 4.4.2
    • Similar Issues:
    • Released As:
      Git client plugin 3.5.1 and git plugin 4.4.4

      Description

      I have a job that verified JENKINS-38240 is still resolved and that the git publisher can push a tag even when the freestyle project performs a checkout to a subdirectory. The test is known to only work with command line git. It fails with JGit because JGit does not implement the git publisher.

      Unfortunately, in my case, the repository is small enough that the git tool chooser chooses JGit as the implementation instead of command line git. If I disable the git plugin performance improvements from "Manage Jenkins" -> "Configure System", then the publishing works.

      The git publisher is a post build action, so it cannot be as easily detected as the other implementations that are used to decide if an alternate implementation may be recommended by the git tool chooser.

      If a job uses the git publisher post build action, the git tool chooser should not choose either jgit or jgitapache. See the verification job definition in my private repository.

        Attachments

          Activity

          Hide
          rishabhbudhouliya Rishabh Budhouliya added a comment -

          Mark Waite Thanks for reporting this issue. While designing the GitToolChooser and the UnsupportedCommand I missed to check the compatibility between JGit and Git Publisher, hence it ignores the fact that Git Publisher is not implemented by JGit. 

          However, I am unable to check the verification job definition posted within the issue description, it gives me a 403. It would be great if I can reproduce this issue in my system as I have written the fix but I need to interactively test it.

          Show
          rishabhbudhouliya Rishabh Budhouliya added a comment - Mark Waite Thanks for reporting this issue. While designing the GitToolChooser and the UnsupportedCommand I missed to check the compatibility between JGit and Git Publisher, hence it ignores the fact that Git Publisher is not implemented by JGit.  However, I am unable to check the verification job definition posted within the issue description, it gives me a 403. It would be great if I can reproduce this issue in my system as I have written the fix but I need to interactively test it.
          Hide
          markewaite Mark Waite added a comment - - edited

          Search for that job definition on mark-pc2 and you'll see the job definition. JENKINS-32840-push-fails-from-subdir is the name of the job

          Show
          markewaite Mark Waite added a comment - - edited Search for that job definition on mark-pc2 and you'll see the job definition. JENKINS-32840 -push-fails-from-subdir is the name of the job
          Hide
          markewaite Mark Waite added a comment - - edited

          I've confirmed that git plugin 4.4.4 resolves the issue I was seeing. The git push from the git publisher post build action is now successful.

          I was surprised to see that the initial fetch chose JGit even though the job has git publisher enabled. The git push used command line git as desired and was successful.

          Started by user Mark Waite
          Running as SYSTEM
          [EnvInject] - Loading node environment variables.
          Building remotely on ibm-s390-jagent (s390x-Ubuntu-18.04) in workspace /home/jagent/mark-pc2.markwaite.net-agent/workspace/Bugs-Individual/Bugs-30-000-to-39-999/JENKINS-32570-tag-not-pushed
          The recommended git tool is: jgit
          using credential MarkEWaite-github-username-password
          Cloning the remote Git repository
          remote: Enumerating objects
          remote: Counting objects
          remote: Compressing objects
          Receiving objects
          Resolving deltas
          Avoid second fetch
          Checking out Revision 8b63fd51a638e4529ce5e785d4534a60e2cf0b22 (origin/JENKINS-32570)
          Commit message: "Increment build number from ant script - was 393"
          [Checks API] No suitable checks publisher found.
          [JENKINS-32570-tag-not-pushed] $ /home/jagent/tools/apache-ant-1.10.8/bin/ant
          Buildfile: /home/jagent/mark-pc2.markwaite.net-agent/workspace/Bugs-Individual/Bugs-30-000-to-39-999/JENKINS-32570-tag-not-pushed/build.xml
          
          info:
               [echo] java is 1.8.0_262
               [echo] Build number was 394
               [exec] [detached HEAD 674af87e] Increment build number from ant script - was 394
               [exec]  1 file changed, 2 insertions(+), 2 deletions(-)
          
          BUILD SUCCESSFUL
          Total time: 0 seconds
          The recommended git tool is: NONE
          using credential MarkEWaite-github-username-password
           > git tag -l JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 # timeout=10
           > git tag -a -f -m This tag verifies JENKINS-32570 with 3, with SHA1 for for verification JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 # timeout=10
          Pushing tag JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 to repo origin
           > git --version # timeout=10
           > git --version # 'git version 2.17.1'
          using GIT_ASKPASS to set credentials MarkEWaite github username/password
           > git push https://github.com/MarkEWaite/JENKINS-26197.git JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 # timeout=10
          Pushing HEAD to branch JENKINS-32570 at repo origin
          using GIT_ASKPASS to set credentials MarkEWaite github username/password
           > git push https://github.com/MarkEWaite/JENKINS-26197.git HEAD:JENKINS-32570 # timeout=10
          [Checks API] No suitable checks publisher found.
          Finished: SUCCESS
          
          Show
          markewaite Mark Waite added a comment - - edited I've confirmed that git plugin 4.4.4 resolves the issue I was seeing. The git push from the git publisher post build action is now successful. I was surprised to see that the initial fetch chose JGit even though the job has git publisher enabled. The git push used command line git as desired and was successful. Started by user Mark Waite Running as SYSTEM [EnvInject] - Loading node environment variables. Building remotely on ibm-s390-jagent (s390x-Ubuntu-18.04) in workspace /home/jagent/mark-pc2.markwaite.net-agent/workspace/Bugs-Individual/Bugs-30-000-to-39-999/JENKINS-32570-tag-not-pushed The recommended git tool is: jgit using credential MarkEWaite-github-username-password Cloning the remote Git repository remote: Enumerating objects remote: Counting objects remote: Compressing objects Receiving objects Resolving deltas Avoid second fetch Checking out Revision 8b63fd51a638e4529ce5e785d4534a60e2cf0b22 (origin/JENKINS-32570) Commit message: "Increment build number from ant script - was 393" [Checks API] No suitable checks publisher found. [JENKINS-32570-tag-not-pushed] $ /home/jagent/tools/apache-ant-1.10.8/bin/ant Buildfile: /home/jagent/mark-pc2.markwaite.net-agent/workspace/Bugs-Individual/Bugs-30-000-to-39-999/JENKINS-32570-tag-not-pushed/build.xml info: [echo] java is 1.8.0_262 [echo] Build number was 394 [exec] [detached HEAD 674af87e] Increment build number from ant script - was 394 [exec] 1 file changed, 2 insertions(+), 2 deletions(-) BUILD SUCCESSFUL Total time: 0 seconds The recommended git tool is: NONE using credential MarkEWaite-github-username-password > git tag -l JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 # timeout=10 > git tag -a -f -m This tag verifies JENKINS-32570 with 3, with SHA1 for for verification JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 # timeout=10 Pushing tag JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 to repo origin > git --version # timeout=10 > git --version # 'git version 2.17.1' using GIT_ASKPASS to set credentials MarkEWaite github username/password > git push https://github.com/MarkEWaite/JENKINS-26197.git JENKINS-32570-ran-3-for-8b63fd51a638e4529ce5e785d4534a60e2cf0b22 # timeout=10 Pushing HEAD to branch JENKINS-32570 at repo origin using GIT_ASKPASS to set credentials MarkEWaite github username/password > git push https://github.com/MarkEWaite/JENKINS-26197.git HEAD:JENKINS-32570 # timeout=10 [Checks API] No suitable checks publisher found. Finished: SUCCESS

            People

            • Assignee:
              rishabhbudhouliya Rishabh Budhouliya
              Reporter:
              markewaite Mark Waite
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: