-
Bug
-
Resolution: Fixed
-
Major
-
kubernetes 1.28.6 (Jenkins Plugin)
Jenkins 2.275
windows
-
-
1.28.7
A recent change to the kubernetes plugin released as v1.28.6: https://github.com/jenkinsci/kubernetes-plugin/pull/924 to escape double quotes causes `bat` commands to 'hang' in windows based agents.
Steps to reproduce
Update kubernetes-plugin to v1.28.6. Or checkout v1.28.5 (working) and merge: 3463a4ace479a4dc5badd0b642d6d9982c7b4822 , build & install on a Jenkins. Run a simple pipeline:
podTemplate(cloud: "kubeprod", nodeSelector: "beta.kubernetes.io/os=windows", containers: [ containerTemplate(name: "jnlp", image:"myrepo.company/jenkins-jnlp-slave:windows", alwaysPullImage:false, ttyEnabled:false, resourceRequestCpu:'1', resourceLimitCpu:'2', resourceRequestMemory:'1Gi', resourceLimitMemory:'2Gi'), containerTemplate(name: "wind", image: 'myrepo.company/dotnet-framework/4.8-sdk-windowsservercore-ltsc2019', alwaysPullImage: false, ttyEnabled:true, resourceRequestCpu:'1', resourceLimitCpu:'2', resourceRequestMemory:'1Gi', resourceLimitMemory:'2Gi', command:'cmd') ]) { node(POD_LABEL) { stage("Test") { container("wind") { bat(returnStdout:true, script: 'echo "Build is starting"'); } } } }
In the build log, hangs at the bat stage infinitely:
[Pipeline] { [Pipeline] stage [Pipeline] { (Test) [Pipeline] container [Pipeline] { [Pipeline] bat
This only happens when switching to another container(...)
On v1.28.5 (working) the value of fixedCommand (657) src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/ContainerExecDecorator.java is:
cmd /c ""/home/jenkins/agent/workspace/windows-test@tmp/durable-5f508532/jenkins-wrap.bat""
On v1.28.6 (or v1.28.5 with 3463a4 merged) not working the value of fixedCommand (657) src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/ContainerExecDecorator.java is:
cmd /c \"\"/home/jenkins/agent/workspace/windows-test@tmp/durable-c7f52994/jenkins-wrap.bat\"\"
From the difference of the two, we can see from the quotes are double escaped and this causes any 'bat' command to hang.
Workarounds
Downgrade to kubernetes plugin to v1.28.5
- is caused by
-
JENKINS-62502 Executing command not escape double quote
- Fixed but Unreleased