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

pipeline job: non-lightweight git checkout of Jenkinsfile fails if node parameter is provided

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • Jenkins 2.222.4

      Plugins:
      git: 4.3.0
      git-client: 3.3.0
      git-parameter: 0.9.12
      nodelabelparameter: 1.7.2

      Java:
      JAVA_HOME: /usr/local/openjdk-8
      JAVA_VERSION: 8u242

       
      A pipeline job (scripted syntax), which is not a multibranch job, is configured to fetch its Jenkinsfile from gitlab (not gitlab.com, but a company owned gitlab instance).
      The checkout is not lightweight, i.e. the tick "Lightweight checkout" in the job configuration is not set.
      There is one job parameter of type node configured.
      When starting the job the git checkout of the Jenkinsfile fails with (anonymized)

      Started by user XXXStarted by user XXXChecking out git https://xxx.com/xxx.git into /var/jenkins_workspace/xxx@script to read Jenkinsfileusing credential XXX > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url https://xxx.com/xxx.git # timeout=10Fetching upstream changes from https://xxx.com/xxx.git > git --version # timeout=10using GIT_ASKPASS to set credentials Username and password of technical user XXX for GitLab > git fetch --tags --progress -- https://xxx.com/xxx.git +refs/heads/*:refs/remotes/origin/* # timeout=10ERROR: Error fetching remote repo 'origin'hudson.plugins.git.GitException: Failed to fetch from https://xxx.com/xxx.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:915) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1141) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1177) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125) at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:155) at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:69) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:428)Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress -- https://xxx.com/xxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:stdout: stderr: /var/jenkins_workspace/xxx@script@tmp/jenkins-gitclient-pass2261319497657330644.sh: 3: /var/jenkins_workspace/xxx@script@tmp/jenkins-gitclient-pass2261319497657330644.sh: cat: not founderror: unable to read askpass response from '/var/jenkins_workspace/xxx@script@tmp/jenkins-gitclient-pass2261319497657330644.sh'fatal: could not read Username for 'https://xxx.com': terminal prompts disabled
       at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2436) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2050) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:572) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:913) ... 8 moreERROR: Error fetching remote repo 'origin'ERROR: Maximum checkout retry attempts reached, abortingFinished: FAILURE
      

      The Jenkinsfile did not start at all since Jenkins failed to check it out.

      The issue does not occur if

      • the node selected by the node parameter is master (if master has been made available as "Possible node"),
      • or "Lightweight Checkout" has been selected,
      • or the job doesn't have a node parameter configured.

      The Jenkinsfile may or may not refer to the node parameter. Even if the node parameter isn't mentioned anywhere in the Jenkinsfile the issue occurs.

      Questions placed at Google Groups
      https://groups.google.com/g/jenkinsci-users/c/KxnXDySSif8
      and stackoverflow
      https://stackoverflow.com/questions/66457176/jenkins-pipeline-non-lightweight-git-checkout-of-jenkinsfile-fails-if-node-para
      But didn't get an answer.

            markewaite Mark Waite
            martinschmude Martin Schmude
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: