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

Wipe out repository & force clone option is broken since GIT plugin version 2.0

      When using the "Wipe out repository & force clone" option after upgrade to GIT plugin version 2.0 jobs fail with the error "ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.".

      We are seeing this issue on multiple Jenkins installations in combination with the Gerrit Trigger plugin.

      Example job log:

      Triggered by Gerrit: https://.../12345
      Building remotely on .. in workspace /.../job_name
      Wiping out workspace first.
      Cloning the remote Git repository
      Cloning repository ssh://...:29418/...
      git --version
      git version 1.8.4
      ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
      Finished: FAILURE
      

          [JENKINS-20231] Wipe out repository & force clone option is broken since GIT plugin version 2.0

          Maybe you need https://github.com/jenkinsci/gerrit-trigger-plugin/commit/41c445e9c1801c3cf091cefe622f63dd47252b2e
          Can you try using a SNAPSHOT build for gerrit-trigger plugin ?

          Nicolas De Loof added a comment - Maybe you need https://github.com/jenkinsci/gerrit-trigger-plugin/commit/41c445e9c1801c3cf091cefe622f63dd47252b2e Can you try using a SNAPSHOT build for gerrit-trigger plugin ?

          Andréas Berg added a comment -

          No, that will not help. The Gerrit Trigger plugin works just fine and gives correct information.

          The workaround we use right now is to use Clean instead of Wipe in the GIT plugin but we have a few jobs were we really do want a wipe instead.

          Merge before build does not work with Clean when a single Jenkins job is listening to multiple Gerrit projects.

          Andréas Berg added a comment - No, that will not help. The Gerrit Trigger plugin works just fine and gives correct information. The workaround we use right now is to use Clean instead of Wipe in the GIT plugin but we have a few jobs were we really do want a wipe instead. Merge before build does not work with Clean when a single Jenkins job is listening to multiple Gerrit projects.

          I have no experience with Gerrit so can't help here.

          Nicolas De Loof added a comment - I have no experience with Gerrit so can't help here.

          Andréas Berg added a comment -

          The update to GIT plugin 2.0 broke the functionality. The Gerrit Trigger plugin remains untouched.

          Our workaround to use clean instead of wipe has since I wrote the initial issue also stopped working.

          Currently we can no longer use the GIT client plugin and have replaced it with a shell script build step that issues the proper Git commands.

          Since our build step works and uses the environment variables delivered by the Gerrit Trigger plugin, I remain confident that the Gerrit Trigger plugin works fine, and the GIT client plugin is broken as it no longer respects the variables as input.

          Andréas Berg added a comment - The update to GIT plugin 2.0 broke the functionality. The Gerrit Trigger plugin remains untouched. Our workaround to use clean instead of wipe has since I wrote the initial issue also stopped working. Currently we can no longer use the GIT client plugin and have replaced it with a shell script build step that issues the proper Git commands. Since our build step works and uses the environment variables delivered by the Gerrit Trigger plugin, I remain confident that the Gerrit Trigger plugin works fine, and the GIT client plugin is broken as it no longer respects the variables as input.

          Also experiencing the same issue when wiping or like this time - started using concurrent builds (with new workspaces).

          Started by build flow Project - Orchestrator#132
          Building in workspace D:\Jenkins\jobs\Project - Flow - Build and publish\workspace@3
          Cloning the remote Git repository
          Cloning repository ssh://...@...:29418/Project.git
          git --version
          git version 1.8.4.msysgit.0
          ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
          

          Since we are using a Flow build (plugin) we forward different Gerrit Trigger variables that is needed to checkout the correct code.

          Build parameters:

          GIT_COMMIT_PARAM: 5eec51b0eeaa79eb5d9d7f8067a96f049a941fef
          GIT_COMMIT_REFSPEC: refs/changes/66/66/2
          

          This is the same variables that Gerrit Trigger normally is configured with.

          Configuration - Source Code Management:

          Repo URL: ssh://...@...:29418/Project.git
          Credentials: Our credentials - SSH key based
          Name: <nothing>
          Refspec: $GIT_COMMIT_REFSPEC
          
          Branch Specifier: $GIT_COMMIT_PARAM
          
          Repository Browser: (Auto)
          
          No "Gerrit Trigger" as "Strategy" (normal setup when using the Gerrit Trigger)
          

          Hallvard Nygård added a comment - Also experiencing the same issue when wiping or like this time - started using concurrent builds (with new workspaces). Started by build flow Project - Orchestrator#132 Building in workspace D:\Jenkins\jobs\Project - Flow - Build and publish\workspace@3 Cloning the remote Git repository Cloning repository ssh: //...@...:29418/Project.git git --version git version 1.8.4.msysgit.0 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. Since we are using a Flow build (plugin) we forward different Gerrit Trigger variables that is needed to checkout the correct code. Build parameters: GIT_COMMIT_PARAM: 5eec51b0eeaa79eb5d9d7f8067a96f049a941fef GIT_COMMIT_REFSPEC: refs/changes/66/66/2 This is the same variables that Gerrit Trigger normally is configured with. Configuration - Source Code Management: Repo URL: ssh: //...@...:29418/Project.git Credentials: Our credentials - SSH key based Name: <nothing> Refspec: $GIT_COMMIT_REFSPEC Branch Specifier: $GIT_COMMIT_PARAM Repository Browser: (Auto) No "Gerrit Trigger" as "Strategy" (normal setup when using the Gerrit Trigger)

          jpschewe added a comment -

          Manually wiping out a workspace and trying to clone again is broken too. I'm using Jenkins 1.509.4 with git plugin 2.0 and I can't get the repository to clone because of this error:

          16:14:02 Started by user Jon Schewe
          16:14:02 Building in workspace /home/hudson/.hudson/jobs/fll-sw-feature-branches/workspace
          16:14:02 Pruning obsolete local branches
          16:14:02 FATAL: Command "git config --get remote.origin.url" returned status code 1:
          16:14:02 stdout:
          16:14:02 stderr:
          16:14:02 hudson.plugins.git.GitException: Command "git config --get remote.origin.url" returned status code 1:
          16:14:02 stdout:
          16:14:02 stderr:
          16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1099)
          16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1076)
          16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:917)
          16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:927)
          16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRemoteUrl(CliGitAPIImpl.java:656)
          16:14:02 at hudson.plugins.git.GitAPI.getRemoteUrl(GitAPI.java:61)
          16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.prune(CliGitAPIImpl.java:446)
          16:14:02 at hudson.plugins.git.extensions.impl.PruneStaleBranch.beforeCheckout(PruneStaleBranch.java:31)
          16:14:02 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:858)
          16:14:02 at hudson.model.AbstractProject.checkout(AbstractProject.java:1376)
          16:14:02 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:655)
          16:14:02 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
          16:14:02 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:560)
          16:14:02 at hudson.model.Run.execute(Run.java:1592)
          16:14:02 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          16:14:02 at hudson.model.ResourceController.execute(ResourceController.java:88)
          16:14:02 at hudson.model.Executor.run(Executor.java:237)

          jpschewe added a comment - Manually wiping out a workspace and trying to clone again is broken too. I'm using Jenkins 1.509.4 with git plugin 2.0 and I can't get the repository to clone because of this error: 16:14:02 Started by user Jon Schewe 16:14:02 Building in workspace /home/hudson/.hudson/jobs/fll-sw-feature-branches/workspace 16:14:02 Pruning obsolete local branches 16:14:02 FATAL: Command "git config --get remote.origin.url" returned status code 1: 16:14:02 stdout: 16:14:02 stderr: 16:14:02 hudson.plugins.git.GitException: Command "git config --get remote.origin.url" returned status code 1: 16:14:02 stdout: 16:14:02 stderr: 16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1099) 16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1076) 16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:917) 16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:927) 16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getRemoteUrl(CliGitAPIImpl.java:656) 16:14:02 at hudson.plugins.git.GitAPI.getRemoteUrl(GitAPI.java:61) 16:14:02 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.prune(CliGitAPIImpl.java:446) 16:14:02 at hudson.plugins.git.extensions.impl.PruneStaleBranch.beforeCheckout(PruneStaleBranch.java:31) 16:14:02 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:858) 16:14:02 at hudson.model.AbstractProject.checkout(AbstractProject.java:1376) 16:14:02 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:655) 16:14:02 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) 16:14:02 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:560) 16:14:02 at hudson.model.Run.execute(Run.java:1592) 16:14:02 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 16:14:02 at hudson.model.ResourceController.execute(ResourceController.java:88) 16:14:02 at hudson.model.Executor.run(Executor.java:237)

          jpschewe added a comment - - edited

          Any chance this can get fixed soon? This seems like a pretty basic problem.

          jpschewe added a comment - - edited Any chance this can get fixed soon? This seems like a pretty basic problem.

          Mark Waite added a comment -

          This problem is resolved for non-windows machines in git-client-plugin 1.6.2, available from the update center. I was able to create a job which uses JGit or command line git and wipes the workspace successfully.

          The command line git implementation also works to wipe the workspace on Windows.

          The JGit implementation does not wipe the workspace on Windows due to JENKINS-19994 .

          Mark Waite added a comment - This problem is resolved for non-windows machines in git-client-plugin 1.6.2, available from the update center. I was able to create a job which uses JGit or command line git and wipes the workspace successfully. The command line git implementation also works to wipe the workspace on Windows. The JGit implementation does not wipe the workspace on Windows due to JENKINS-19994 .

          Mark Waite added a comment -

          Fixed in git-client-plugin 1.6.2

          Mark Waite added a comment - Fixed in git-client-plugin 1.6.2

          I wiped the workspace and retriggered a build. Did not get the issue on the first attempt with plugin version 1.6.3.

          Hallvard Nygård added a comment - I wiped the workspace and retriggered a build. Did not get the issue on the first attempt with plugin version 1.6.3.

            ndeloof Nicolas De Loof
            epkabeg Andréas Berg
            Votes:
            10 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: