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

Git plugin: add 'clean before checkout' option

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have cgit builds, 1 that uses the git submodule and 1 that uses a fast snapshot download of git to build cgit.

      Because the snapshot download is untarred into the same (submodule) directory, a checkout of a new fails.

      This seems to have changed somewhere right at or after the 1.500 release because before it worked fine.

      log:

      Started by an SCM change
      Building in workspace /var/lib/jenkins/workspace/cgit_upstream_get-git_master
      Checkout:cgit_upstream_get-git_master / /var/lib/jenkins/workspace/cgit_upstream_get-git_master - hudson.remoting.LocalChannel@77ed71cb
      Using strategy: Default
      Last Built Revision: Revision e1e0e038fd0fee3fe10524d7466deab03e78deb5 (origin/master)
      Fetching changes from 1 remote Git repository
      Pruning obsolete local branches
      Commencing build of Revision b60e6bff75719a5fb0df970bac3be6b2726cf73a (origin/master)
      Checking out Revision b60e6bff75719a5fb0df970bac3be6b2726cf73a (origin/master)
      Cleaning workspace
      FATAL: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
      hudson.plugins.git.GitException: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
      at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clean(JGitAPIImpl.java:310)
      at hudson.plugins.git.GitAPI.clean(GitAPI.java:248)
      at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1213)
      at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1196)
      at hudson.FilePath.act(FilePath.java:865)
      at hudson.FilePath.act(FilePath.java:838)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1196)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1364)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:670)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:575)
      at hudson.model.Run.execute(Run.java:1575)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:237)
      Caused by: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
      at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:361)
      at org.eclipse.jgit.api.ResetCommand.call(ResetCommand.java:204)
      at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clean(JGitAPIImpl.java:304)
      ... 14 more
      Caused by: org.eclipse.jgit.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
      at org.eclipse.jgit.dircache.DirCacheCheckout.cleanUpConflicts(DirCacheCheckout.java:873)
      at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:413)
      at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:391)
      at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:359)
      ... 16 more

        Attachments

          Activity

          Hide
          fhuberts Ferry Huberts added a comment -

          There also is something fishy going on with the clean.

          I've now worked around this specific problem by deleting the git directory after the build.
          But now the clean fails to remove the 'dist' directory is use in a
          make DESTDIR="$(pwd)/dist" install

          It shouldn't fail this.
          And actually if I start a build right after, it successfully removes the dist directory

          log 1:

          Started by user Ferry Huberts
          Building in workspace /var/lib/jenkins/workspace/cgit_upstream_get-git_master
          Checkout:cgit_upstream_get-git_master / /var/lib/jenkins/workspace/cgit_upstream_get-git_master - hudson.remoting.LocalChannel@77ed71cb
          Using strategy: Default
          Last Built Revision: Revision e1e0e038fd0fee3fe10524d7466deab03e78deb5 (origin/master)
          Fetching changes from 1 remote Git repository
          Pruning obsolete local branches
          Commencing build of Revision b60e6bff75719a5fb0df970bac3be6b2726cf73a (origin/master)
          Checking out Revision b60e6bff75719a5fb0df970bac3be6b2726cf73a (origin/master)
          Cleaning workspace
          FATAL: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
          hudson.plugins.git.GitException: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
          at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clean(JGitAPIImpl.java:310)
          at hudson.plugins.git.GitAPI.clean(GitAPI.java:248)
          at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1213)
          at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1196)
          at hudson.FilePath.act(FilePath.java:865)
          at hudson.FilePath.act(FilePath.java:838)
          at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1196)
          at hudson.model.AbstractProject.checkout(AbstractProject.java:1364)
          at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:670)
          at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:575)
          at hudson.model.Run.execute(Run.java:1575)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          at hudson.model.ResourceController.execute(ResourceController.java:88)
          at hudson.model.Executor.run(Executor.java:237)
          Caused by: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
          at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:361)
          at org.eclipse.jgit.api.ResetCommand.call(ResetCommand.java:204)
          at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clean(JGitAPIImpl.java:304)
          ... 14 more
          Caused by: org.eclipse.jgit.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend
          at org.eclipse.jgit.dircache.DirCacheCheckout.cleanUpConflicts(DirCacheCheckout.java:873)
          at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:413)
          at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:391)
          at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:359)
          ... 16 more

          log 2:
          normal successful build

          Show
          fhuberts Ferry Huberts added a comment - There also is something fishy going on with the clean. I've now worked around this specific problem by deleting the git directory after the build. But now the clean fails to remove the 'dist' directory is use in a make DESTDIR="$(pwd)/dist" install It shouldn't fail this. And actually if I start a build right after, it successfully removes the dist directory log 1: Started by user Ferry Huberts Building in workspace /var/lib/jenkins/workspace/cgit_upstream_get-git_master Checkout:cgit_upstream_get-git_master / /var/lib/jenkins/workspace/cgit_upstream_get-git_master - hudson.remoting.LocalChannel@77ed71cb Using strategy: Default Last Built Revision: Revision e1e0e038fd0fee3fe10524d7466deab03e78deb5 (origin/master) Fetching changes from 1 remote Git repository Pruning obsolete local branches Commencing build of Revision b60e6bff75719a5fb0df970bac3be6b2726cf73a (origin/master) Checking out Revision b60e6bff75719a5fb0df970bac3be6b2726cf73a (origin/master) Cleaning workspace FATAL: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend hudson.plugins.git.GitException: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clean(JGitAPIImpl.java:310) at hudson.plugins.git.GitAPI.clean(GitAPI.java:248) at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1213) at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1196) at hudson.FilePath.act(FilePath.java:865) at hudson.FilePath.act(FilePath.java:838) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1196) at hudson.model.AbstractProject.checkout(AbstractProject.java:1364) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:670) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:575) at hudson.model.Run.execute(Run.java:1575) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237) Caused by: org.eclipse.jgit.api.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:361) at org.eclipse.jgit.api.ResetCommand.call(ResetCommand.java:204) at org.jenkinsci.plugins.gitclient.JGitAPIImpl.clean(JGitAPIImpl.java:304) ... 14 more Caused by: org.eclipse.jgit.errors.CheckoutConflictException: Checkout conflict with file: Cannot delete file: git/.depend at org.eclipse.jgit.dircache.DirCacheCheckout.cleanUpConflicts(DirCacheCheckout.java:873) at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:413) at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:391) at org.eclipse.jgit.api.ResetCommand.checkoutIndex(ResetCommand.java:359) ... 16 more log 2: normal successful build
          Hide
          markewaite Mark Waite added a comment -

          Those stack traces indicate that the user was running JGit. JGit was only the default implementation for a relatively short time. Command line git is the current implementation, and I believe it allows this use case.

          Please check with the current git-client-plugin (1.6.2) and the current git-plugin (2.0.1).

          Show
          markewaite Mark Waite added a comment - Those stack traces indicate that the user was running JGit. JGit was only the default implementation for a relatively short time. Command line git is the current implementation, and I believe it allows this use case. Please check with the current git-client-plugin (1.6.2) and the current git-plugin (2.0.1).
          Hide
          richiechoo Richie Choo added a comment -

          How to make JenKins exec 'git clean -fd' instead of 'git clean -fdx'

          Show
          richiechoo Richie Choo added a comment - How to make JenKins exec 'git clean -fd' instead of 'git clean -fdx'
          Hide
          markewaite Mark Waite added a comment -

          Richie Choo it is much better to ask questions on the Jenkins user mailing list or on the Jenkins chat channels. Many more people read those questions and can respond to them. When you ask a question on a closed bug report, you're hoping that the very few people that monitor bug reports will answer your question.

          In this specific case, there is no way to make the Jenkins git plugin change the arguments it passes to git clean.

          If you use a Pipeline, you can run git clean with any arguments you choose.

          Show
          markewaite Mark Waite added a comment - Richie Choo it is much better to ask questions on the Jenkins user mailing list or on the Jenkins chat channels. Many more people read those questions and can respond to them. When you ask a question on a closed bug report, you're hoping that the very few people that monitor bug reports will answer your question. In this specific case, there is no way to make the Jenkins git plugin change the arguments it passes to git clean . If you use a Pipeline, you can run git clean with any arguments you choose.

            People

            Assignee:
            ndeloof Nicolas De Loof
            Reporter:
            fhuberts Ferry Huberts
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: