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

Slashes in branch names cause 'bat' workflow task to hang

    Details

    • Similar Issues:

      Description

      As first reported in JENKINS-30744 windows 'bat' workflow task hangs on the encoding of git branch names when these branches contain special characters (tested with gitflow naming convention that has '/' in the branch name).

      The encoded path seems to create problems on windows when using 'bat'.
      Any branch that has a slash in it for example ('feature/myfeature') will get an encoded path on windows like <workspace_path>/feature%2Fmyfeature@script and <workspace_path>/feature%2Fmyfeature.
      When I apply the following workflow in a multibranch job in a root file 'Jenkinsfile', Jenkins hangs forever on the bat command

      node {
          stage 'Checkout'
          checkout scm
          stage 'Build'
          bat "echo 'test'"
      }
      

      When I add this same script on the 'master' branch everything is fine.

        Attachments

          Issue Links

            Activity

            Hide
            andne Andy Neebel added a comment -

            Here's a thought I have - why not undo the encoding when creating the workspace path and let have a few more levels of directories? Would that have a negative effect on anything?

            Also, this appears to duplicate JENKINS-30744

            Show
            andne Andy Neebel added a comment - Here's a thought I have - why not undo the encoding when creating the workspace path and let have a few more levels of directories? Would that have a negative effect on anything? Also, this appears to duplicate JENKINS-30744
            Hide
            jglick Jesse Glick added a comment -

            Would that have a negative effect on anything?

            Yes, at least potentially.

            Show
            jglick Jesse Glick added a comment - Would that have a negative effect on anything? Yes, at least potentially.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/test/java/org/jenkinsci/plugins/durabletask/WindowsBatchScriptTest.java
            http://jenkins-ci.org/commit/durable-task-plugin/a0b69f10f2a1cd0f9295556967042ddd6a1ac927
            Log:
            JENKINS-32701 Minor touch-ups to test.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/test/java/org/jenkinsci/plugins/durabletask/WindowsBatchScriptTest.java http://jenkins-ci.org/commit/durable-task-plugin/a0b69f10f2a1cd0f9295556967042ddd6a1ac927 Log: JENKINS-32701 Minor touch-ups to test.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/durabletask/WindowsBatchScript.java
            src/test/java/org/jenkinsci/plugins/durabletask/WindowsBatchScriptTest.java
            http://jenkins-ci.org/commit/durable-task-plugin/b5e480d43d0bcf3d3020823051bcf06473551e9c
            Log:
            [FIXED JENKINS-32701] Escape % in paths passed to bat.

            Compare: https://github.com/jenkinsci/durable-task-plugin/compare/66d80d2b9761...b5e480d43d0b

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/durabletask/WindowsBatchScript.java src/test/java/org/jenkinsci/plugins/durabletask/WindowsBatchScriptTest.java http://jenkins-ci.org/commit/durable-task-plugin/b5e480d43d0bcf3d3020823051bcf06473551e9c Log: [FIXED JENKINS-32701] Escape % in paths passed to bat. Compare: https://github.com/jenkinsci/durable-task-plugin/compare/66d80d2b9761...b5e480d43d0b
            Hide
            andne Andy Neebel added a comment -

            I'm still having issues with this even with the newest durable task plugin (1.9). Short batch command seem to work fine, but commands that take longer to execute (my build command takes a few minutes sometimes) start but never see to be recognized that they are finished. This does seem to be partially related to how long the command takes to execute. Judging from the console output, the command that I started has finished running, however the result file doesn't exist, so apparently the second line of the generated batch file is not being executed.

            If I add logging for the DurableTaskStep I can see the log messages that my durable task is still running (even though I already aborted the build). Going into the filesystem and lauching the jenkins-wrap.bat file generates the jenkins-results.txt file, so then the task terminates and quits reporting that it's still running. It also causes the workspace@tmp/jenkins-* directory to be deleted.

            Show
            andne Andy Neebel added a comment - I'm still having issues with this even with the newest durable task plugin (1.9). Short batch command seem to work fine, but commands that take longer to execute (my build command takes a few minutes sometimes) start but never see to be recognized that they are finished. This does seem to be partially related to how long the command takes to execute. Judging from the console output, the command that I started has finished running, however the result file doesn't exist, so apparently the second line of the generated batch file is not being executed. If I add logging for the DurableTaskStep I can see the log messages that my durable task is still running (even though I already aborted the build). Going into the filesystem and lauching the jenkins-wrap.bat file generates the jenkins-results.txt file, so then the task terminates and quits reporting that it's still running. It also causes the workspace@tmp/jenkins-* directory to be deleted.
            Hide
            saucistophe Christophe Carpentier added a comment -
            Show
            saucistophe Christophe Carpentier added a comment - Andy Neebel see JENKINS-33456 .
            Hide
            jglick Jesse Glick added a comment -

            Not clear why this was reopened. Newly mentioned problem seems unrelated.

            Show
            jglick Jesse Glick added a comment - Not clear why this was reopened. Newly mentioned problem seems unrelated.
            Hide
            nitram Martin Karing added a comment -

            The bug that is causing the batch execution to hang is described in JENKINS-34150. How ever this is unrelated to the escaping issue that was the cause of this bug.

            Show
            nitram Martin Karing added a comment - The bug that is causing the batch execution to hang is described in JENKINS-34150 . How ever this is unrelated to the escaping issue that was the cause of this bug.
            Hide
            bokc bokc added a comment -

            I have the same problem :

            • Jenkins 2.68
            • Durable task Plugin : 1.14
            Show
            bokc bokc added a comment - I have the same problem : Jenkins 2.68 Durable task Plugin : 1.14
            Hide
            jglick Jesse Glick added a comment -

            bokc there is a tested fix for at least some such scenario. If you continue to have problems, please file a separate issue linked to this one with complete steps to reproduce from scratch, as there may be some specialized scenario not covered by the original fix.

            Show
            jglick Jesse Glick added a comment - bokc there is a tested fix for at least some such scenario. If you continue to have problems, please file a separate issue linked to this one with complete steps to reproduce from scratch, as there may be some specialized scenario not covered by the original fix.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jajansen Jan Arend Jansen
              • Votes:
                5 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: