[JENKINS-75102] Fix Windows Docker running Windows container with spaces in workspace path #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed docker windows not working when a running windows containers when the workspace path has both a space and a '@'.
The consecutive double quote escape strategy used by the durable-task-plugin does not work in all cases when passed in to docker exec. Launching the command in the container with call like done here does. Unfortunately changing the durable-task-plugin to use call broke other non-docker use cases and I couldn't find a strategy that handled every case. Additionally, changing the jenkins-wrapper.bat launch command is riskier. I thus opted to handle this case in the logic around decorating the launcher command in the docker-workflow-plugin.
See JENKINS-75102 for more details.
Testing done
A unit test has been created that covers this case. It uses Assume to only run if on Windows, docker is installed, and docker is setup to run Windows containers. The current build process may not be able to run it at this time but it does work locally.
I also tested on a live instance Windows agent running docker using a multibranch pipeline job with branches "main" and "feature/foobar" the later of which tests the '%' character.
Submitter checklist