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

'bat' step fails if configured agent overrides system path

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Windows build agent using DCOM method, Java 1.7/1.8, Jenkins 2.32.3

      I started to convert a Freestyle job to a declarative Pipeline job today, and found that most of the time it was failing with the following error: 'cmd' is not recognized as an internal or external command, operable program or batch file.

      After some investigation I realized that several of my build agents have the PATH variable overridden in the node configuration, i.e.

      PATH=${PATH};c:\some\additional\path
      

      With a Freestyle job,

      ${PATH}
      

      is expanded correctly, but with the Pipeline job it appears not to be; adding an echo env.PATH prior to my bat step echoes an unexpanded path. It doesn't look like there's another way to get at the run environment like w/ a freestyle job, so I am not sure how else to check for sure that this is what is happening, but it seems likely.

      I see the same behavior if I try PATH=%PATH%;.., which doesn't work on Freestyle jobs either, so I know that's not the problem..

      If we clear the PATH override in the build agent node properties, it works fine. We're looking at whether we really need to do this override on all our build agents, but this should work just like it does with a freestyle job.

        1. nodeproperties.PNG
          nodeproperties.PNG
          14 kB
        2. result.PNG
          result.PNG
          12 kB
        3. snippet.PNG
          snippet.PNG
          15 kB

          [JENKINS-41998] 'bat' step fails if configured agent overrides system path

          Jesse Glick added a comment -

          Versions of durable-task and workflow-durable-task-step not specified here so who knows.

          Jesse Glick added a comment - Versions of durable-task and workflow-durable-task-step not specified here so who knows.

          Will Saxon added a comment -

          It was whatever was current in February when I filed this. I don't know what versions these were at this point. It also wasn't obvious that these were related and required versions, sorry.

          Will Saxon added a comment - It was whatever was current in February when I filed this. I don't know what versions these were at this point. It also wasn't obvious that these were related and required versions, sorry.

            Unassigned Unassigned
            wsaxon Will Saxon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: