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

Pipeline: Job v2.11 breaks build with bat() command

      Hi there!

      We just upgraded our Pipeline:Job plugin from 2.10 to version 2.11. We're using the following pipeline script:

      node {
      
      stage('Prepare/Checkout') {
          dir('repo-master') {
              git credentialsId: 'secret_access', poll: false , url: 'ssh://git@company.url.com:7999/xxx/repo.git'
          }
          bat('del -f d:\\xxx\\yy.zip >nul 2>&1')
      }
      }
      

      Unfortunately since 2.11, we receive the following issue during build at the bat() call:

      ...
       > git.exe checkout -b master 3579a579a89ccee5892fbb94951f868020a9d4f7
       > git.exe rev-list 3579a579a89ccee5892fbb94951f868020a9d4f7 # timeout=10
      [Pipeline] }
      [Pipeline] // dir
      [Pipeline] bat
      [workspace] Running batch script
      'cmd' is not recognized as an internal or external command,
      operable program or batch file.
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: script returned exit code 9009
      Finished: FAILURE
      

      It looks like the cmd.exe is not found any more in the PATH. It is strange as the cmd is not moved anywhere, and also downgrading to version 2.10 "resolves" the problem. We did not yet try 2.12, as we still use Jenkins 2.46.2

      We did not test any other "external" tool but it seems git is found in the first step.

      Plugin list is attached.

      Thanks in advance!

          [JENKINS-44334] Pipeline: Job v2.11 breaks build with bat() command

          István Bede created issue -
          István Bede made changes -
          Description Original: Hi there!

          We just upgraded our Pipeline:Job plugin from 2.10 to version 2.11. We're using the following pipeline script:
          {code:java}
          node {

          stage('Prepare/Checkout') {
              dir('repo-master') {
                  git credentialsId: 'secret_access', poll: false , url: 'ssh://git@company.url.com:7999/xxx/repo.git'
              }
              bat('del -f d:\\xxx\\yy.zip >nul 2>&1')
          }
          }
          {code}
          Unfortunately since 2..11, we receive the following issue during build at the bat() call:
          {code:java}
          ...
           > git.exe checkout -b master 3579a579a89ccee5892fbb94951f868020a9d4f7
           > git.exe rev-list 3579a579a89ccee5892fbb94951f868020a9d4f7 # timeout=10
          [Pipeline] }
          [Pipeline] // dir
          [Pipeline] bat
          [workspace] Running batch script
          'cmd' is not recognized as an internal or external command,
          operable program or batch file.
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 9009
          Finished: FAILURE
          {code}
          It looks like the cmd.exe is not found any more in the PATH. It is strange as the cmd is not moved anywhere, and also downgrading to version 2.10 "resolves" the problem. We did not yet try 2.12, as we still use Jenkins 2.46.2

          We did not test any other "external" tool but it seems git is found in the first step.

          Plugin list is attached.

          Thanks in advance!
          New: Hi there!

          We just upgraded our Pipeline:Job plugin from 2.10 to version 2.11. We're using the following pipeline script:
          {code:java}
          node {

          stage('Prepare/Checkout') {
              dir('repo-master') {
                  git credentialsId: 'secret_access', poll: false , url: 'ssh://git@company.url.com:7999/xxx/repo.git'
              }
              bat('del -f d:\\xxx\\yy.zip >nul 2>&1')
          }
          }
          {code}
          Unfortunately since 2.11, we receive the following issue during build at the bat() call:
          {code:java}
          ...
           > git.exe checkout -b master 3579a579a89ccee5892fbb94951f868020a9d4f7
           > git.exe rev-list 3579a579a89ccee5892fbb94951f868020a9d4f7 # timeout=10
          [Pipeline] }
          [Pipeline] // dir
          [Pipeline] bat
          [workspace] Running batch script
          'cmd' is not recognized as an internal or external command,
          operable program or batch file.
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 9009
          Finished: FAILURE
          {code}
          It looks like the cmd.exe is not found any more in the PATH. It is strange as the cmd is not moved anywhere, and also downgrading to version 2.10 "resolves" the problem. We did not yet try 2.12, as we still use Jenkins 2.46.2

          We did not test any other "external" tool but it seems git is found in the first step.

          Plugin list is attached.

          Thanks in advance!

          István Bede added a comment -

          I think the issue is somehow related to JENKINS-41339 and JENKINS-40734.

          István Bede added a comment - I think the issue is somehow related to JENKINS-41339 and JENKINS-40734 .

          István Bede added a comment -

          Setting the PATH manually in the first pipeline stage helped:

          env.PATH = env.PATH + ";c:\\Windows
          System32"

          István Bede added a comment - Setting the PATH manually in the first pipeline stage helped: env.PATH = env.PATH + ";c:\\Windows System32"

          Andrew Bayer added a comment -

          Is this still happening?

          Andrew Bayer added a comment - Is this still happening?

          Jesse Glick added a comment -

          Given that this appears specifically after a workflow-job update, I doubt it is related directly to JENKINS-41339. More likely it is a regression from JENKINS-43396. Both involve global node properties, though; check whether you have some of these defined.

          Jesse Glick added a comment - Given that this appears specifically after a workflow-job update, I doubt it is related directly to  JENKINS-41339 . More likely it is a regression from  JENKINS-43396 . Both involve global node properties, though; check whether you have some of these defined.
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-43396 [ JENKINS-43396 ]
          Jesse Glick made changes -
          Labels New: regression windows

          I confirm jglick, abayer that you can easily reproduce the issue by defining a global environment variable PATH at the master level and then launch a pipeline on a windows agent. Same thing with a linux agent if you define a windows PATH at the master level 

          Arnaud Héritier added a comment - I confirm jglick , abayer that you can easily reproduce the issue by defining a global environment variable PATH at the master level and then launch a pipeline on a windows agent. Same thing with a linux agent if you define a windows PATH at the master level 

          Andrew Bayer added a comment -

          Global env vars and node vars are such a pain with Pipeline. Grr.

          Andrew Bayer added a comment - Global env vars and node vars are such a pain with Pipeline. Grr.

            Unassigned Unassigned
            bpedro István Bede
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: