• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Blocker Blocker
    • git-plugin

      Started getting all sorts of checkout errors after upgrading git plugins to the latest version.

       

      Multibranch job indexing started to throw errors for single Gogs repos (Github repos are indexed but fail when running jobs):

       

      Looking up details of XXXXXX...
      Organization URL: XXXXXX
      [Wed Feb 01 13:31:27 GMT 2023] Consulting GitHub Organization
      13:31:27 Connecting to https://api.github.com using Jenkins XXXXXX Looking up repositories of user XXXXXX
        Proposing analysis-model
      Examining Mulgish/analysis-model
      
        Checking branches...
      
        Getting remote branches...
      
          Checking branch master
      No local file defined. Skipping Source Code SCM probe, since Jenkinsfile will be provided by Remote Jenkins File Plugin
          Met criteria
      
        1 branches were processed (query completed)
      
        1 branches were processed
      
      Finished examining Mulgish/analysis-model
      
      Proposing MutinyFX
      Examining Mulgish/MutinyFX
      
        Checking branches...
      
        Getting remote branches...
      
          Checking branch main
      No local file defined. Skipping Source Code SCM probe, since Jenkinsfile will be provided by Remote Jenkins File Plugin
          Met criteria
      
        1 branches were processed (query completed)
      
        1 branches were processed
      
      Finished examining Mulgish/MutinyFX
      
      Proposing warnings-ng-plugin
      Examining Mulgish/warnings-ng-plugin
      
        Checking branches...
      
        Getting remote branches...
      
          Checking branch master
      No local file defined. Skipping Source Code SCM probe, since Jenkinsfile will be provided by Remote Jenkins File Plugin
          Met criteria
      
        1 branches were processed (query completed)
      
        1 branches were processed
      
      Finished examining Mulgish/warnings-ng-plugin
      
      13:31:30 3 repositories were processed
      [Wed Feb 01 13:31:30 GMT 2023] Consulting Single repository
       > git rev-parse --resolve-git-dir /var/jenkins_home/caches/git-e4021de26cf1cebe22fb56083e970129/.git # timeout=10
      Setting origin to https://gogs.internal/xxxxxx
        > git config remote.origin.url https://gogs.internal/xxxxxx 
      # timeout=10
      ERROR: Failed to create or update a subproject xxxxxx
      hudson.plugins.git.GitException: Command "git config remote.origin.url https://gogs.internal/xxxxxx" returned status code 128:
      stdout: 
      stderr: fatal: not in a git directory
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2734)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2660)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2656)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1981)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1993)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1601)
      	at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:161)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:381)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:350)
      	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:590)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:327)
      	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:261)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.recognizes(OrganizationFolder.java:1358)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1373)
      	at jenkins.scm.impl.SingleSCMNavigator.visitSources(SingleSCMNavigator.java:78)
      	at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:535)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:166)
      	at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:917)
      	at hudson.model.ResourceController.execute(ResourceController.java:101)
      	at hudson.model.Executor.run(Executor.java:442)
      [Wed Feb 01 13:31:30 GMT 2023] Consulting Single repository
       > git rev-parse --resolve-git-dir /var/jenkins_home/caches/git-992dbde355d1d72f7a50c0b5f51d0e23/.git # timeout=10
      Setting origin to https://gogs.internal/xxxxxx  > git config remote.origin.url https://gogs.internal/xxxxxx # timeout=10
      ERROR: Failed to create or update a subproject xxxxxx
      hudson.plugins.git.GitException: Command "git config remote.origin.url https://gogs.internal/xxxxxx" returned status code 128:
      stdout: 
      stderr: fatal: not in a git directory
      
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2734)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2660)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2656)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1981)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1993)
      	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1601)
      	at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:161)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:381)
      	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:350)
      	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:590)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:327)
      	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:261)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.recognizes(OrganizationFolder.java:1358)
      	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1373)
      	at jenkins.scm.impl.SingleSCMNavigator.visitSources(SingleSCMNavigator.java:78)
      	at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:535)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:166)
      	at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:917)
      	at hudson.model.ResourceController.execute(ResourceController.java:101)
      	at hudson.model.Executor.run(Executor.java:442) 

       

       

       

      Pipelines started failing with below errors:

       

      22:50:45  The recommended git tool is: NONE
      22:50:45  using credential jenkins_svc_vcs
      22:50:45   > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/CI_foobar_main@script/a06cb9a0b5c86ab8e2e832b21c314405ffcb0a9520a6c56990348fa4eb7a901f/.git # timeout=10
      22:50:45  Fetching changes from the remote Git repository
      22:50:45   > git config remote.origin.url https://gogs.internal/xxxx # timeout=10
      22:50:45  ERROR: Error fetching remote repo 'origin'
      22:50:45  hudson.plugins.git.GitException: Failed to fetch from https://gogs.internal/xxxx 22:50:45      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1003)
      22:50:45      at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1245)
      22:50:45      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1309)
      22:50:45      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
      22:50:45      at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:159)
      22:50:45      at org.jenkinsci.plugins.workflow.multibranch.extended.scm.ExtendedSCMBinder.create(ExtendedSCMBinder.java:120)
      22:50:45      at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:312)
      22:50:45      at hudson.model.ResourceController.execute(ResourceController.java:101)
      22:50:45      at hudson.model.Executor.run(Executor.java:442)
      22:50:45  Caused by: hudson.plugins.git.GitException: Command "git config remote.origin.url https://gogs.internal/xxxx" returned status code 128:
      22:50:45  stdout: 
      22:50:45  stderr: fatal: not in a git directory
      22:50:45  
      22:50:45      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2734)
      22:50:45      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2660)
      22:50:45      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2656)
      22:50:45      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1981)
      22:50:45      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1993)
      22:50:45      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.setRemoteUrl(CliGitAPIImpl.java:1601)
      22:50:45      at hudson.plugins.git.GitAPI.setRemoteUrl(GitAPI.java:161)
      22:50:45      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:991)
      22:50:45      ... 8 more
      22:50:45  ERROR: Error fetching remote repo 'origin'
      22:50:45  ERROR: Maximum checkout retry attempts reached, aborting 

       

       

        1. jobs-freestyle-config.xml
          1 kB
        2. plugins.txt
          0.8 kB
        3. run-jenkins.sh
          1 kB

          [JENKINS-70540] Not in a git directory errors

          Mark Waite added a comment -

          Sorry to see that you're encountering errors. Unfortunately, you've not provided enough information to duplicate the error. You seem to mention two different failure modes, but provide no instructions to duplicate either of the failure modes.

          Please provide step by step instructions that will allow others to duplicate the error. See "How to report an issue" for the type of information that is needed. As an example, directory listings of the plugins directory are not helpful. Plugin names with version number are less helpful than plugin IDs with version number.

          Mark Waite added a comment - Sorry to see that you're encountering errors. Unfortunately, you've not provided enough information to duplicate the error. You seem to mention two different failure modes, but provide no instructions to duplicate either of the failure modes. Please provide step by step instructions that will allow others to duplicate the error. See "How to report an issue" for the type of information that is needed. As an example, directory listings of the plugins directory are not helpful. Plugin names with version number are less helpful than plugin IDs with version number.

          Mattias added a comment -

          Duplicate of JENKINS-70534 ? Same error but that ticket has more content

          Mattias added a comment - Duplicate of JENKINS-70534 ? Same error but that ticket has more content

          Juri Duval added a comment -

          mattiassluis Yes, it is a duplicate.

          Juri Duval added a comment - mattiassluis Yes, it is a duplicate.

          Mark Waite added a comment -

          mulgish you've confirmed that this problem is due to incorrect ownership of a file or directory in one of the directories that is being used?

          That surprises me, since the error message that is being reported does not match with a problem due to incorrect ownership. When command line git detects an incorrect ownership issue, it usually warns about the incorrect ownership with a very specific message.

          I thought your case might be somehow related to nesting git repositories inside one another in a Jenkins workspace. However, your description does not provide enough detail to give any indication if that is happening.

          If this is a a duplicate of JENKINS-70534, please close this one. Thanks!

          Mark Waite added a comment - mulgish you've confirmed that this problem is due to incorrect ownership of a file or directory in one of the directories that is being used? That surprises me, since the error message that is being reported does not match with a problem due to incorrect ownership. When command line git detects an incorrect ownership issue, it usually warns about the incorrect ownership with a very specific message. I thought your case might be somehow related to nesting git repositories inside one another in a Jenkins workspace. However, your description does not provide enough detail to give any indication if that is happening. If this is a a duplicate of JENKINS-70534 , please close this one. Thanks!

          Juri Duval added a comment - - edited

          markewaite I will provide detailed steps to reproduce later today.

          I have JENKINS_HOME on an NFS share and I can manually checkout into it using git cli from a jenkins container. The UID (100x) of the JENKINS_HOME directory is different to jenkins user UID (1000) but it still has group rwx permissions.

           

          Note that  JENKINS-70534 mentions ownership issue, as well as the issue I am seeing around setting repository remotes. I am only getting remote issues.

          Juri Duval added a comment - - edited markewaite I will provide detailed steps to reproduce later today. I have JENKINS_HOME on an NFS share and I can manually checkout into it using git cli from a jenkins container. The UID (100x) of the JENKINS_HOME directory is different to jenkins user UID (1000) but it still has group rwx permissions.   Note that   JENKINS-70534 mentions ownership issue, as well as the issue I am seeing around setting repository remotes. I am only getting remote issues.

          Juri Duval added a comment -

          Unfortunately I have no spare time to investigate the issue and write detailed steps to reproduce as of now.

          Will try to do it later this week.

          Juri Duval added a comment - Unfortunately I have no spare time to investigate the issue and write detailed steps to reproduce as of now. Will try to do it later this week.

          Pablo added a comment -

          Definitely something broke, I got exactly the same error. I also agree it is not a duplicate of  JENKINS-70534

          Got it by upgrading to these plugins:
          git-client:4.1.0
          git-server:99.va_0826a_b_cdfa_d
          git:5.0.0

          Pablo added a comment - Definitely something broke, I got exactly the same error. I also agree it is not a duplicate of   JENKINS-70534 Got it by upgrading to these plugins: git - client : 4 . 1 . 0 git - server : 99 . va _ 0826 a _ b _ cdfa _ d git : 5 . 0 . 0

          Pablo added a comment -

          Dumping info:

          Looks like it breaks here:

          node('terraform') {
              String branch = env.BRANCH_NAME
              git poll: true, changelog: true, branch: "$branch", credentialsId: '[REDACTED]', url: '[REDACTED]'    try {        stage('Checkout branch') {
                      checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: "*/$branch"]], doGenerateSubmoduleConfigurations: false, extensions: [],
                                                                    submoduleCfg: [], userRemoteConfigs: [[credentialsId: '[REDACTED]', url: 'git@bitbucket' +
                              '[REDACTED]']]]
                  } 

          Jenkins container used:

          jenkins/jenkins:2.375.2-lts-jdk11 

          Plugins installed:

          job-dsl:1.81
          ace-editor:1.1
          amazon-ecs:1.41
          apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
          authentication-tokens:1.4
          aws-credentials:191.vcb_f183ce58b_9
          aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c
          bouncycastle-api:2.26
          branch-api:2.1051.v9985666b_f6cc
          build-timeout:1.19.1
          bootstrap5-api:5.2.1-3
          cloudbees-folder:6.758.vfd75d09eea_a_1
          command-launcher:1.6
          commons-text-api:1.10.0-27.vb_fa_3896786a_7
          commons-lang3-api:3.12.0-36.vd97de6465d5b_
          configuration-as-code:1569.vb_72405b_80249
          credentials-binding:523.vd859a_4b_122e6
          credentials:1214.v1de940103927
          display-url-api:2.3.6
          docker-commons:1.19
          docker-workflow:1.23
          durable-task:504.vb10d1ae5ba2f
          font-awesome-api:6.2.0-3
          git-client:4.1.0
          git-server:99.va_0826a_b_cdfa_d
          git:5.0.0
          github-api:1.133
          github:1.29.5
          handlebars:3.0.8
          jacoco:3.3.2
          jackson2-api:2.14.2-319.v37853346a_229
          jdk-tool:1.4
          jsch:0.1.55.2
          junit:1166.va_436e268e972
          jquery-detached:1.2.1
          lockable-resources:2.12
          mailer:438.v02c7f0a_12fa_4
          matrix-auth:3.1.5
          matrix-project:785.v06b_7f47b_c631
          mercurial:1260.vdfb_723cdcc81
          mina-sshd-api-core:2.9.2-50.va_0e1f42659a_a
          momentjs:1.1.1
          nodejs:1.5.1
          oic-auth:2.5
          pipeline-build-step:2.18
          pipeline-github-lib:1.0
          pipeline-graph-analysis:1.11
          pipeline-groovy-lib:629.vb_5627b_ee2104
          pipeline-input-step:456.vd8a_957db_5b_e9
          pipeline-milestone-step:1.3.2
          pipeline-model-api:2.2118.v31fd5b_9944b_5
          pipeline-model-declarative-agent:1.1.1
          pipeline-model-definition:2.2118.v31fd5b_9944b_5
          pipeline-model-extensions:2.2118.v31fd5b_9944b_5
          pipeline-rest-api:2.27
          pipeline-stage-step:296.v5f6908f017a_5
          pipeline-stage-tags-metadata:2.2118.v31fd5b_9944b_5
          pipeline-stage-view:2.27
          plain-credentials:1.8
          resource-disposer:0.16
          scm-api:631.v9143df5b_e4a_a
          script-security:1229.v4880b_b_e905a_6
          snakeyaml-api:1.30.2-76.vc104f7ce9870
          slack:616.v03b_1e98d13dd
          ssh-credentials:305.v8f4381501156
          structs:324.va_f5d6774f3a_d
          timestamper:1.11.3
          token-macro:321.vd7cc1f2a_52c8
          trilead-api:2.84.v72119de229b_7
          variant:59.vf075fe829ccb
          workflow-aggregator:2.6
          workflow-api:1200.v8005c684b_a_c6
          workflow-basic-steps:969.vc4ec3e4854b_f
          workflow-cps:3536.vb_8a_6628079d5
          workflow-cps-global-lib:2.21
          workflow-durable-task-step:1164.v2334ddcf48d0
          workflow-job:1268.v6eb_e2ee1a_85a
          workflow-multibranch:716.vc692a_e52371b_
          workflow-scm-step:400.v6b_89a_1317c9a_
          workflow-step-api:639.v6eca_cd8c04a_a_
          workflow-support:839.v35e2736cfd5c
          ws-cleanup:0.38
          

           

           

           

           

           

           

           

           

          Pablo added a comment - Dumping info: Looks like it breaks here: node( 'terraform' ) {     String branch = env.BRANCH_NAME     git poll: true , changelog: true , branch: "$branch" , credentialsId: '[REDACTED]' , url: '[REDACTED]'     try {        stage( 'Checkout branch' ) {             checkout changelog: false , poll: false , scm: [$class: 'GitSCM' , branches: [[name: "*/$branch" ]], doGenerateSubmoduleConfigurations: false , extensions: [],                                                           submoduleCfg: [], userRemoteConfigs: [[credentialsId: '[REDACTED]' , url: 'git@bitbucket' +                     '[REDACTED]' ]]]         } Jenkins container used: jenkins/jenkins:2.375.2-lts-jdk11 Plugins installed: job-dsl:1.81 ace-editor:1.1 amazon-ecs:1.41 apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61 authentication-tokens:1.4 aws-credentials:191.vcb_f183ce58b_9 aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c bouncycastle-api:2.26 branch-api:2.1051.v9985666b_f6cc build-timeout:1.19.1 bootstrap5-api:5.2.1-3 cloudbees-folder:6.758.vfd75d09eea_a_1 command-launcher:1.6 commons-text-api:1.10.0-27.vb_fa_3896786a_7 commons-lang3-api:3.12.0-36.vd97de6465d5b_ configuration-as-code:1569.vb_72405b_80249 credentials-binding:523.vd859a_4b_122e6 credentials:1214.v1de940103927 display-url-api:2.3.6 docker-commons:1.19 docker-workflow:1.23 durable-task:504.vb10d1ae5ba2f font-awesome-api:6.2.0-3 git-client:4.1.0 git-server:99.va_0826a_b_cdfa_d git:5.0.0 github-api:1.133 github:1.29.5 handlebars:3.0.8 jacoco:3.3.2 jackson2-api:2.14.2-319.v37853346a_229 jdk-tool:1.4 jsch:0.1.55.2 junit:1166.va_436e268e972 jquery-detached:1.2.1 lockable-resources:2.12 mailer:438.v02c7f0a_12fa_4 matrix-auth:3.1.5 matrix-project:785.v06b_7f47b_c631 mercurial:1260.vdfb_723cdcc81 mina-sshd-api-core:2.9.2-50.va_0e1f42659a_a momentjs:1.1.1 nodejs:1.5.1 oic-auth:2.5 pipeline-build-step:2.18 pipeline-github-lib:1.0 pipeline-graph-analysis:1.11 pipeline-groovy-lib:629.vb_5627b_ee2104 pipeline-input-step:456.vd8a_957db_5b_e9 pipeline-milestone-step:1.3.2 pipeline-model-api:2.2118.v31fd5b_9944b_5 pipeline-model-declarative-agent:1.1.1 pipeline-model-definition:2.2118.v31fd5b_9944b_5 pipeline-model-extensions:2.2118.v31fd5b_9944b_5 pipeline- rest -api:2.27 pipeline-stage-step:296.v5f6908f017a_5 pipeline-stage-tags-metadata:2.2118.v31fd5b_9944b_5 pipeline-stage-view:2.27 plain-credentials:1.8 resource-disposer:0.16 scm-api:631.v9143df5b_e4a_a script-security:1229.v4880b_b_e905a_6 snakeyaml-api:1.30.2-76.vc104f7ce9870 slack:616.v03b_1e98d13dd ssh-credentials:305.v8f4381501156 structs:324.va_f5d6774f3a_d timestamper:1.11.3 token-macro:321.vd7cc1f2a_52c8 trilead-api:2.84.v72119de229b_7 variant:59.vf075fe829ccb workflow-aggregator:2.6 workflow-api:1200.v8005c684b_a_c6 workflow-basic-steps:969.vc4ec3e4854b_f workflow-cps:3536.vb_8a_6628079d5 workflow-cps-global-lib:2.21 workflow-durable-task-step:1164.v2334ddcf48d0 workflow-job:1268.v6eb_e2ee1a_85a workflow-multibranch:716.vc692a_e52371b_ workflow-scm-step:400.v6b_89a_1317c9a_ workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:839.v35e2736cfd5c ws-cleanup:0.38                

          Brian Mills added a comment -

          I'm facing the same issue. The same error occurring after upgrading Jenkins and plugins.
          We use the docker container `jenkins/jenkins:lts` as our base on ECS. 
          I have been trying to downgrade plugins with no success. I've got a bit stuck in dependency of the plugins so it appears not an option really. 
          I'm happy to provide more information, or do some debugging, if someone can point me in the right direction. 
          I've actually never had to debug Jenkins, its always been a fairly solid platform. 
          openpablo have you managed to fix it?

          Brian Mills added a comment - I'm facing the same issue. The same error occurring after upgrading Jenkins and plugins. We use the docker container `jenkins/jenkins:lts` as our base on ECS.  I have been trying to downgrade plugins with no success. I've got a bit stuck in dependency of the plugins so it appears not an option really.  I'm happy to provide more information, or do some debugging, if someone can point me in the right direction.  I've actually never had to debug Jenkins, its always been a fairly solid platform.  openpablo have you managed to fix it?

          Mark Waite added a comment - - edited

          I don't understand what openpablo means with the sample:

          node('terraform') {
              String branch = env.BRANCH_NAME
              git poll: true, changelog: true, branch: "$branch", credentialsId: '[REDACTED]', url: '[REDACTED]'    try {        stage('Checkout branch') {
                      checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: "*/$branch"]], doGenerateSubmoduleConfigurations: false, extensions: [],
                                                                    submoduleCfg: [], userRemoteConfigs: [[credentialsId: '[REDACTED]', url: 'git@bitbucket' +
                              '[REDACTED]']]]
                  } 
          

          If that is Pipeline code, then it is quite a surprise, since it is using the git step to fetch and checkout a remote repository (URL redacted), then it is using a stage nested a try to perform a checkout step without changing the directory. If the second step is using a different repository, then I don't know what the git plugin will do, since that is either adding an entirely different remote repository into the same working directory or performing a redundant fetch and checkout if they are the same repository.

          brianmills Git plugin 5.0 requires git client plugin 4.0 or newer. If you want to downgrade one you must downgrade both. The JGit upgrade from JGit 5.13 to JGit 6.4 and the Java switch from Java 8 to Java 11 in git client plugin 4.0 combined with the Pipeline syntax improvements and transition from Java 8 to Java 11 in git plugin 5.0.0 were too great for me to be willing to test and attempt to support a mix of plugin releases.

          Mark Waite added a comment - - edited I don't understand what openpablo means with the sample: node('terraform') { String branch = env.BRANCH_NAME git poll: true, changelog: true, branch: "$branch", credentialsId: '[REDACTED]', url: '[REDACTED]' try { stage('Checkout branch') { checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: "*/$branch"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '[REDACTED]', url: 'git@bitbucket' + '[REDACTED]']]] } If that is Pipeline code, then it is quite a surprise, since it is using the git step to fetch and checkout a remote repository (URL redacted), then it is using a stage nested a try to perform a checkout step without changing the directory. If the second step is using a different repository, then I don't know what the git plugin will do, since that is either adding an entirely different remote repository into the same working directory or performing a redundant fetch and checkout if they are the same repository. brianmills Git plugin 5.0 requires git client plugin 4.0 or newer. If you want to downgrade one you must downgrade both. The JGit upgrade from JGit 5.13 to JGit 6.4 and the Java switch from Java 8 to Java 11 in git client plugin 4.0 combined with the Pipeline syntax improvements and transition from Java 8 to Java 11 in git plugin 5.0.0 were too great for me to be willing to test and attempt to support a mix of plugin releases.

          Mark Waite added a comment - - edited

          I've failed to duplicate the problem based on the partial sample from openpablo. See my Jenkinsfile for reference.

          Mark Waite added a comment - - edited I've failed to duplicate the problem based on the partial sample from openpablo . See my Jenkinsfile for reference.

          Pablo added a comment - - edited

          Apologies, it seems like Git isn't the issue. I rollbacked my Jenkins host a couple of times and upgraded the plugins seperately.

          It seems like upgrading these two are the culprit:

          -apache-httpcomponents-client-4-api:4.5.13-1.0
          +apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61

          -jackson2-api:2.14.1-313.v504cdd45c18b
          +jackson2-api:2.14.2-319.v37853346a_229

          Also note:

          The git error appears before the terraform node gets even started.  I copy pasted my Jenkinsfile snippet again, including all lines from the start.

          The code in my Jenkinsfile before node('terraform') don't seem to do anything Git related, as it is just some stuff to set parameters.

          I suspect something is breaking before the Jenkinsfile can even execute properly.

          import org.jenkinsci.plugins.pipeline.modeldefinition.Utilsproperties([parameters([
                  booleanParam(name: 'DEPLOY_ACC', description: 'Deploy ACC?', defaultValue: true),
          ]),
                      disableConcurrentBuilds(), buildDiscarder(logRotator(numToKeepStr: '15'))
          ])node('terraform') {
              String branch = env.BRANCH_NAME
              git poll: true, changelog: true, branch: "$branch", credentialsId: '[REDACTED]', url: '[REDACTED]'    try {        stage('Checkout branch') {
                      checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: "*/$branch"]], doGenerateSubmoduleConfigurations: false, extensions: [],
                                                                    submoduleCfg: [], userRemoteConfigs: [[credentialsId: '[REDACTED]', url: 'git@bitbucket' +
                              '[REDACTED]']]]
                  } 

          I apologise for any wasted time by accusing the Git plugin. I upgraded it together with the apache and jackson plugins, which made me think it was the culprit.

          Pablo added a comment - - edited Apologies, it seems like Git isn't the issue. I rollbacked my Jenkins host a couple of times and upgraded the plugins seperately. It seems like upgrading these two are the culprit: -apache-httpcomponents-client-4-api:4.5.13-1.0 + apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61 -jackson2-api:2.14.1-313.v504cdd45c18b + jackson2-api:2.14.2-319.v37853346a_229 Also note: The git error appears before the terraform node gets even started.  I copy pasted my Jenkinsfile snippet again, including all lines from the start. The code in my Jenkinsfile before node('terraform') don't seem to do anything Git related, as it is just some stuff to set parameters. I suspect something is breaking before the Jenkinsfile can even execute properly. import org.jenkinsci.plugins.pipeline.modeldefinition.Utilsproperties([parameters([         booleanParam(name: 'DEPLOY_ACC' , description: 'Deploy ACC?' , defaultValue: true ), ]),             disableConcurrentBuilds(), buildDiscarder(logRotator(numToKeepStr: '15' )) ])node( 'terraform' ) {     String branch = env.BRANCH_NAME     git poll: true , changelog: true , branch: "$branch" , credentialsId: '[REDACTED]' , url: '[REDACTED]'     try {        stage( 'Checkout branch' ) {             checkout changelog: false , poll: false , scm: [$class: 'GitSCM' , branches: [[name: "*/$branch" ]], doGenerateSubmoduleConfigurations: false , extensions: [],                                                           submoduleCfg: [], userRemoteConfigs: [[credentialsId: '[REDACTED]' , url: 'git@bitbucket' +                     '[REDACTED]' ]]]         }  I apologise for any wasted time by accusing the Git plugin. I upgraded it together with the apache and jackson plugins, which made me think it was the culprit.

          Pablo added a comment -

          markewaite Yes ! I had exactly that problem too !  I tried to rebuild my container using a list of plugins, which I know for a fact worked before because it's my last working version of Jenkins, but then I get dependency issues. How is that possible if it worked before?

          I get these errors:

          Multiple plugin prerequisites not met:
          Plugin aws-credentials:191.vcb_f183ce58b_9 (via aws-java-sdk-ec2:1.12.397-362.v050e9394cf8e->aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61, but there is an older version defined on the top level - apache-httpcomponents-client-4-api:4.5.13-1.0,
          Plugin aws-credentials:191.vcb_f183ce58b_9 (via aws-java-sdk-ec2:1.12.397-362.v050e9394cf8e->aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on jackson2-api:2.14.2-319.v37853346a_229, but there is an older version defined on the top level - jackson2-api:2.14.1-313.v504cdd45c18b,
          Plugin aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c (via aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61, but there is an older version defined on the top level - apache-httpcomponents-client-4-api:4.5.13-1.0,
          Plugin aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c (via aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on jackson2-api:2.14.2-319.v37853346a_229, but there is an older version defined on the top level - jackson2-api:2.14.1-313.v504cdd45c18b
          

          The last working image of my Jenkins was succesfuly built with the older version of apache-httpcomponents-client-4-api and jackson2-api. WTF

           

          Here's my dockerfile

           
          FROM jenkins/jenkins:2.375.2-lts-jdk11
          ENV CASC_JENKINS_CONFIG /usr/share/jenkins/ref/jenkins.yaml
          COPY files/jenkins.yaml /usr/share/jenkins/ref/jenkins.yaml
          RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state
          COPY files/InitialConfig.groovy /usr/share/jenkins/ref/init.groovy.d/InitialConfig.groovy
          COPY files/plugins.txt /usr/share/jenkins/ref/plugins.txt
          RUN jenkins-plugin-cli -f /usr/share/jenkins/ref/plugins.txt
          Here's my list of plugins of my last working version
          ace-editor:1.1
          job-dsl:1.81
          amazon-ecs:1.41
          apache-httpcomponents-client-4-api:4.5.13-1.0
          authentication-tokens:1.4
          aws-credentials:191.vcb_f183ce58b_9
          aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c
          bouncycastle-api:2.26
          branch-api:2.1051.v9985666b_f6cc
          build-timeout:1.19.1
          bootstrap5-api:5.2.1-3
          cloudbees-folder:6.758.vfd75d09eea_a_1
          command-launcher:1.6
          commons-text-api:1.10.0-27.vb_fa_3896786a_7
          commons-lang3-api:3.12.0-36.vd97de6465d5b_
          configuration-as-code:1511.vb_f985b_894e40
          credentials-binding:523.vd859a_4b_122e6
          credentials:1143.vb_e8b_b_ceee347
          display-url-api:2.3.6
          docker-commons:1.19
          docker-workflow:1.23
          durable-task:1.39
          font-awesome-api:6.2.0-3
          git-client:3.11.0
          git-server:1.10
          git:4.11.3
          github-api:1.133
          github:1.29.5
          handlebars:3.0.8
          jacoco:3.3.2
          jackson2-api:2.14.1-313.v504cdd45c18b
          jdk-tool:1.4
          jquery-detached:1.2.1
          jsch:0.1.55.2
          junit:1166.va_436e268e972
          lockable-resources:2.12
          mailer:414.vcc4c33714601
          matrix-auth:3.1.5
          matrix-project:772.v494f19991984
          mercurial:1260.vdfb_723cdcc81
          mina-sshd-api-core:2.9.2-50.va_0e1f42659a_a
          momentjs:1.1.1
          nodejs:1.5.1
          oic-auth:1.8
          pipeline-build-step:2.18
          pipeline-github-lib:1.0
          pipeline-graph-analysis:1.11
          pipeline-groovy-lib:629.vb_5627b_ee2104
          pipeline-input-step:456.vd8a_957db_5b_e9
          pipeline-milestone-step:1.3.2
          pipeline-model-api:1.9.3
          pipeline-model-declarative-agent:1.1.1
          pipeline-model-definition:1.9.3
          pipeline-model-extensions:1.9.3
          pipeline-rest-api:2.27
          pipeline-stage-step:296.v5f6908f017a_5
          pipeline-stage-tags-metadata:1.9.3
          pipeline-stage-view:2.27
          plain-credentials:1.8
          resource-disposer:0.16
          scm-api:621.vda_a_b_055e58f7
          script-security:1228.vd93135a_2fb_25
          snakeyaml-api:1.30.2-76.vc104f7ce9870
          slack:616.v03b_1e98d13dd
          ssh-credentials:291.v8211e4f8efb_c
          ssh:2.6.1
          structs:324.va_f5d6774f3a_d
          timestamper:1.11.3
          token-macro:293.v283932a_0a_b_49
          trilead-api:2.72.v2a_3236754f73
          variant:59.vf075fe829ccb
          workflow-aggregator:2.6
          workflow-api:1200.v8005c684b_a_c6
          workflow-basic-steps:2.24
          workflow-cps-global-lib:2.21
          workflow-cps:3536.vb_8a_6628079d5
          workflow-durable-task-step:2.40
          workflow-job:1145.v7f2433caa07f
          workflow-multibranch:716.vc692a_e52371b_
          workflow-scm-step:400.v6b_89a_1317c9a_
          workflow-step-api:639.v6eca_cd8c04a_a_
          workflow-support:839.v35e2736cfd5c
          ws-cleanup:0.38
           

           

          Here's my groovy file

           

           
          import jenkins.model.*
          import jenkins.install.InstallState
          Jenkins.instance.setNumExecutors(0)

          Jenkins.instance.setInstallState(InstallState.INITIAL_SETUP_COMPLETED)

          // setting the Jenkins URL
          url = System.env.JENKINS_URL
          urlConfig = JenkinsLocationConfiguration.get()
          urlConfig.setUrl(url)
          urlConfig.save()
           

           

           

          Pablo added a comment - markewaite Yes ! I had exactly that problem too !  I tried to rebuild my container using a list of plugins, which I know for a fact worked before because it's my last working version of Jenkins, but then I get dependency issues. How is that possible if it worked before? I get these errors: Multiple plugin prerequisites not met: Plugin aws-credentials:191.vcb_f183ce58b_9 (via aws-java-sdk-ec2:1.12.397-362.v050e9394cf8e->aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61, but there is an older version defined on the top level - apache-httpcomponents-client-4-api:4.5.13-1.0, Plugin aws-credentials:191.vcb_f183ce58b_9 (via aws-java-sdk-ec2:1.12.397-362.v050e9394cf8e->aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on jackson2-api:2.14.2-319.v37853346a_229, but there is an older version defined on the top level - jackson2-api:2.14.1-313.v504cdd45c18b, Plugin aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c (via aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61, but there is an older version defined on the top level - apache-httpcomponents-client-4-api:4.5.13-1.0, Plugin aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c (via aws-java-sdk-minimal:1.12.397-362.v050e9394cf8e) depends on jackson2-api:2.14.2-319.v37853346a_229, but there is an older version defined on the top level - jackson2-api:2.14.1-313.v504cdd45c18b The last working image of my Jenkins was succesfuly built with the older version of apache-httpcomponents-client-4-api and jackson2-api. WTF   Here's my dockerfile   FROM jenkins/jenkins : 2.375.2-lts-jdk11 ENV CASC_JENKINS_CONFIG /usr/share/jenkins/ref/jenkins.yaml COPY files/jenkins.yaml /usr/share/jenkins/ref/jenkins.yaml RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state COPY files/InitialConfig.groovy /usr/share/jenkins/ref/init.groovy.d/InitialConfig.groovy COPY files/plugins.txt /usr/share/jenkins/ref/plugins.txt RUN jenkins-plugin-cli -f /usr/share/jenkins/ref/plugins.txt Here's my list of plugins of my last working version ace - editor : 1 . 1 job - dsl : 1 . 81 amazon - ecs : 1 . 41 apache - httpcomponents - client - 4 - api : 4 . 5 . 13 - 1 . 0 authentication - tokens : 1 . 4 aws - credentials : 191 . vcb _ f 183 ce 58 b _ 9 aws - java - sdk : 1 . 12 . 246 - 349 . v 96 b _ b _ f 7 eb _ a _ c 3 c bouncycastle - api : 2 . 26 branch - api : 2 . 1051 . v 9985666 b _ f 6 cc build - timeout : 1 . 19 . 1 bootstrap 5 - api : 5 . 2 . 1 - 3 cloudbees - folder : 6 . 758 . vfd 75 d 09 eea _ a _ 1 command - launcher : 1 . 6 commons - text - api : 1 . 10 . 0 - 27 . vb _ fa _ 3896786 a _ 7 commons - lang 3 - api : 3 . 12 . 0 - 36 . vd 97 de 6465 d 5 b _ configuration - as - code : 1511 . vb _ f 985 b _ 894 e 40 credentials - binding : 523 . vd 859 a _ 4 b _ 122 e 6 credentials : 1143 . vb _ e 8 b _ b _ ceee 347 display - url - api : 2 . 3 . 6 docker - commons : 1 . 19 docker - workflow : 1 . 23 durable - task : 1 . 39 font - awesome - api : 6 . 2 . 0 - 3 git - client : 3 . 11 . 0 git - server : 1 . 10 git : 4 . 11 . 3 github - api : 1 . 133 github : 1 . 29 . 5 handlebars : 3 . 0 . 8 jacoco : 3 . 3 . 2 jackson 2 - api : 2 . 14 . 1 - 313 . v 504 cdd 45 c 18 b jdk - tool : 1 . 4 jquery - detached : 1 . 2 . 1 jsch : 0 . 1 . 55 . 2 junit : 1166 . va _ 436 e 268 e 972 lockable - resources : 2 . 12 mailer : 414 . vcc 4 c 33714601 matrix - auth : 3 . 1 . 5 matrix - project : 772 . v 494 f 19991984 mercurial : 1260 . vdfb _ 723 cdcc 81 mina - sshd - api - core : 2 . 9 . 2 - 50 . va _ 0 e 1 f 42659 a _ a momentjs : 1 . 1 . 1 nodejs : 1 . 5 . 1 oic - auth : 1 . 8 pipeline - build - step : 2 . 18 pipeline - github - lib : 1 . 0 pipeline - graph - analysis : 1 . 11 pipeline - groovy - lib : 629 . vb _ 5627 b _ ee 2104 pipeline - input - step : 456 . vd 8 a _ 957 db _ 5 b _ e 9 pipeline - milestone - step : 1 . 3 . 2 pipeline - model - api : 1 . 9 . 3 pipeline - model - declarative - agent : 1 . 1 . 1 pipeline - model - definition : 1 . 9 . 3 pipeline - model - extensions : 1 . 9 . 3 pipeline - rest - api : 2 . 27 pipeline - stage - step : 296 . v 5 f 6908 f 017 a _ 5 pipeline - stage - tags - metadata : 1 . 9 . 3 pipeline - stage - view : 2 . 27 plain - credentials : 1 . 8 resource - disposer : 0 . 16 scm - api : 621 . vda _ a _ b _ 055 e 58 f 7 script - security : 1228 . vd 93135 a _ 2 fb _ 25 snakeyaml - api : 1 . 30 . 2 - 76 . vc 104 f 7 ce 9870 slack : 616 . v 03 b _ 1 e 98 d 13 dd ssh - credentials : 291 . v 8211 e 4 f 8 efb _ c ssh : 2 . 6 . 1 structs : 324 . va _ f 5 d 6774 f 3 a _ d timestamper : 1 . 11 . 3 token - macro : 293 . v 283932 a _ 0 a _ b _ 49 trilead - api : 2 . 72 . v 2 a _ 3236754 f 73 variant : 59 . vf 075 fe 829 ccb workflow - aggregator : 2 . 6 workflow - api : 1200 . v 8005 c 684 b _ a _ c 6 workflow - basic - steps : 2 . 24 workflow - cps - global - lib : 2 . 21 workflow - cps : 3536 . vb _ 8 a _ 6628079 d 5 workflow - durable - task - step : 2 . 40 workflow - job : 1145 . v 7 f 2433 caa 07 f workflow - multibranch : 716 . vc 692 a _ e 52371 b _ workflow - scm - step : 400 . v 6 b _ 89 a _ 1317 c 9 a _ workflow - step - api : 639 . v 6 eca _ cd 8 c 04 a _ a _ workflow - support : 839 . v 35 e 2736 cfd 5 c ws - cleanup : 0 . 38     Here's my groovy file     import jenkins.model.* import jenkins.install.InstallState Jenkins .instance.setNumExecutors( 0 ) Jenkins .instance.setInstallState( InstallState .INITIAL_SETUP_COMPLETED) // setting the Jenkins URL url = System .env.JENKINS_URL urlConfig = JenkinsLocationConfiguration .get() urlConfig.setUrl(url) urlConfig.save()      

          Mark Waite added a comment -

          openpablo see the description of that behavior in JENKINS-70579

          Mark Waite added a comment - openpablo see the description of that behavior in JENKINS-70579

          Mark Waite added a comment -

          mulgish I've not yet seen a description that details how to duplicate the problem. Will you be able to provide more details?

          Mark Waite added a comment - mulgish I've not yet seen a description that details how to duplicate the problem. Will you be able to provide more details?

          Pablo added a comment - - edited

          Updating these plugins:

          -apache-httpcomponents-client-4-api:4.5.13-1.0
          +apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61

          -jackson2-api:2.14.1-313.v504cdd45c18b
          +jackson2-api:2.14.2-319.v37853346a_229

          With jenkins version: jenkins/jenkins:2.375.2-lts-jdk11

          Jenkinsfile content doesn't matter, fails before anything can execute.

           

          Pablo added a comment - - edited Updating these plugins: -apache-httpcomponents-client-4-api:4.5.13-1.0 + apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61 -jackson2-api:2.14.1-313.v504cdd45c18b + jackson2-api:2.14.2-319.v37853346a_229 With jenkins version: jenkins/jenkins : 2.375.2-lts-jdk11 Jenkinsfile content doesn't matter, fails before anything can execute.  

          Mark Waite added a comment -

          openpablo I use those same plugin versions in my installation without any issue. I suspect there is something else happening in your job definition that causes the behavior on your system and not on mine. Is your Jenkinsfile performing multiple calls to checkout scm or to git?

          Mark Waite added a comment - openpablo I use those same plugin versions in my installation without any issue. I suspect there is something else happening in your job definition that causes the behavior on your system and not on mine. Is your Jenkinsfile performing multiple calls to checkout scm or to git ?

          Juri Duval added a comment - - edited

          markewaite I am struggling to reproduce this issue with fresh installation.

          It seems like the issue occurs when upgrading from older version of jenkins and plugins. 

          It takes a lot of time to manually install old versions of the plugins, so I did not spend time trying that (can probably install old plugins in custom dockerfile).

           

           

          On a positive note, I managed to solve the issue by rebuilding Jenkins Dockerfile to have uid/guid matching to that of my NFS share.

          Confusing 'not a git directory' simply disappeared.

           

          Please find steps I tried to reproduce the issue (without an nfs share but should be similar behaviour):

          1. Create jenkins home dir via 
            mkdir jenkins_home
            
          1. Update directory uid and permissions (Jenkins expects 1000 but has rw access via "other" permissions)
            chown 1010:1010 jenkins_home
            sudo chmod uga+rwx jenkins_home
          2. Create jenkins.yaml compose file with below contents
            version: "3.9"
            services:
              controller:
                image: jenkins/jenkins:latest
                environment:
                  TZ: 'Europe/London'
                  JAVA_OPTS: '-Xms4g -Xmx4g -XX:+AlwaysPreTouch'
                ports:
                  - "8080:8080"
                networks:
                  - "jenkins-net"
                volumes:
                  - type: bind
                    source: ./jenkins_home
                    target: /var/jenkins_home
                deploy:
                  mode: replicated
                  replicas: 1
                  resources:
                    limits:
                      cpus: '3.000'
                      memory: 8G
                    reservations:
                      cpus: '0.500'
                      memory: 4G
            networks:
              jenkins-net: 
          3. Spin up jenkins via Docker or Podman compose  
            podman-compose --file=jenkins.yaml -p jenkins up
            docker-compose --file=jenkins.yaml -p jenkins up 
          4. Access jenkins via http://localhost:8080 and go through default installation process (with recommended plugins)
          5. Create a multibranch pipeline and point it to https://github.com/jenkinsci/git-plugin
          6. Observe no "not a git directory" errors. Strangely git also does not care that uid and gid are mismatching.
            Started by user admin
            [Tue Feb 21 00:53:19 GMT 2023] Starting branch indexing...
             > git --version # timeout=10
             > git --version # 'git version 2.30.2'
             > git ls-remote --symref -- https://github.com/jenkinsci/git-plugin # timeout=10
             > git rev-parse --resolve-git-dir /var/jenkins_home/caches/git-5f7e7d9a6699d86ffef71261765a10ab/.git # timeout=10
            Setting origin to https://github.com/jenkinsci/git-plugin
             > git config remote.origin.url https://github.com/jenkinsci/git-plugin # timeout=10
            Fetching & pruning origin...
            Listing remote references...
             > git config --get remote.origin.url # timeout=10
             > git --version # timeout=10
             > git --version # 'git version 2.30.2'
             > git ls-remote -h -- https://github.com/jenkinsci/git-plugin # timeout=10
            Fetching upstream changes from origin
             > git config --get remote.origin.url # timeout=10
             > git fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
            Checking branches...
              Checking branch 2.6.x
                  ‘Jenkinsfile’ not found
                Does not meet criteria
              Checking branch v3.10.0.x 

            Not sure if it is worth getting to the root cause of those errors given that the issue can be solved by matching uid/gid (it is best practice anyways).

           

          Juri Duval added a comment - - edited markewaite I am struggling to reproduce this issue with fresh installation. It seems like the issue occurs when upgrading from older version of jenkins and plugins.  It takes a lot of time to manually install old versions of the plugins, so I did not spend time trying that (can probably install old plugins in custom dockerfile).     On a positive note, I managed to solve the issue by rebuilding Jenkins Dockerfile to have uid/guid matching to that of my NFS share. Confusing 'not a git directory' simply disappeared.   Please find steps I tried to reproduce the issue (without an nfs share but should be similar behaviour): Create jenkins home dir via  mkdir jenkins_home Update directory uid and permissions (Jenkins expects 1000 but has rw access via "other" permissions) chown 1010:1010 jenkins_home sudo chmod uga+rwx jenkins_home Create jenkins.yaml compose file with below contents version: "3.9" services:   controller:     image: jenkins/jenkins:latest     environment:       TZ: 'Europe/London'       JAVA_OPTS: '-Xms4g -Xmx4g -XX:+AlwaysPreTouch'     ports:       - "8080:8080"     networks:       - "jenkins-net"     volumes:       - type: bind         source: ./jenkins_home         target: / var /jenkins_home     deploy:       mode: replicated       replicas: 1       resources:         limits:           cpus: '3.000'           memory: 8G         reservations:           cpus: '0.500'           memory: 4G networks:   jenkins-net: Spin up jenkins via Docker or Podman compose   podman-compose --file=jenkins.yaml -p jenkins up docker-compose --file=jenkins.yaml -p jenkins up Access jenkins via http://localhost:8080 and go through default installation process (with recommended plugins) Create a multibranch pipeline and point it to https://github.com/jenkinsci/git-plugin Observe no "not a git directory" errors. Strangely git also does not care that uid and gid are mismatching. Started by user admin [Tue Feb 21 00:53:19 GMT 2023] Starting branch indexing... > git --version # timeout=10 > git --version # 'git version 2.30.2' > git ls-remote --symref -- https: //github.com/jenkinsci/git-plugin # timeout=10 > git rev-parse --resolve-git-dir / var /jenkins_home/caches/git-5f7e7d9a6699d86ffef71261765a10ab/.git # timeout=10 Setting origin to https: //github.com/jenkinsci/git-plugin > git config remote.origin.url https: //github.com/jenkinsci/git-plugin # timeout=10 Fetching & pruning origin... Listing remote references... > git config --get remote.origin.url # timeout=10 > git --version # timeout=10 > git --version # 'git version 2.30.2' > git ls-remote -h -- https: //github.com/jenkinsci/git-plugin # timeout=10 Fetching upstream changes from origin > git config --get remote.origin.url # timeout=10 > git fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10 Checking branches... Checking branch 2.6.x ‘Jenkinsfile’ not found Does not meet criteria Checking branch v3.10.0.x Not sure if it is worth getting to the root cause of those errors given that the issue can be solved by matching uid/gid (it is best practice anyways).  

          Mark Waite added a comment -

          Based on your comments about ownership of the directory, I can duplicate the same conditions with current plugins. I believe the key step is that the directory with incorrect ownership needs to already exist and contain a git repository.

          • Place the plugins.txt and run-jenkins.sh files in an empty directory
          • Create the jobs/freestyle directory and copy jobs-freestyle-config.xml as jobs/freestyle/config.xml
          • Perform an sudo command so that sudo will cache the authentication
          • Run the run-jenkins.sh script (it contains an sudo command to change ownership of a cloned repository
          • Provide the generated password, create a user, and answer the installation wizard by installing no plugins (already installed)
          • Run the job name freestyle and watch it fail with not in a git directory

          Based on that, I'm closing this issue as not a defect. Command line git has decided that it is dangerous to perform git operations in a directory owned by a different user. I may consider a way to better detect it and better alert the administrator that there is a problem, but ultimately it is a mistake to perform git operations in a directory owned by a different user without intentionally configuring the safe.directory to allow it.

          Mark Waite added a comment - Based on your comments about ownership of the directory, I can duplicate the same conditions with current plugins. I believe the key step is that the directory with incorrect ownership needs to already exist and contain a git repository. Place the plugins.txt and run-jenkins.sh files in an empty directory Create the jobs/freestyle directory and copy jobs-freestyle-config.xml as jobs/freestyle/config.xml Perform an sudo command so that sudo will cache the authentication Run the run-jenkins.sh script (it contains an sudo command to change ownership of a cloned repository Provide the generated password, create a user, and answer the installation wizard by installing no plugins (already installed) Run the job name freestyle and watch it fail with not in a git directory Based on that, I'm closing this issue as not a defect. Command line git has decided that it is dangerous to perform git operations in a directory owned by a different user. I may consider a way to better detect it and better alert the administrator that there is a problem, but ultimately it is a mistake to perform git operations in a directory owned by a different user without intentionally configuring the safe.directory to allow it.

            Unassigned Unassigned
            mulgish Juri Duval
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: