[JIRA] (JENKINS-60016) docker.stop() pipeline step no longer works for windows

8 views
Skip to first unread message

dylan.yatigammana@hitachivantara.com (JIRA)

unread,
Nov 1, 2019, 6:55:02 AM11/1/19
to jenkinsc...@googlegroups.com
Dylan Yatigammana created an issue
 
Jenkins / Bug JENKINS-60016
docker.stop() pipeline step no longer works for windows
Issue Type: Bug Bug
Assignee: Unassigned
Components: docker-workflow-plugin
Created: 2019-11-01 10:54
Environment: Jenkins 2.176.3
org.jenkins-ci.plugins:docker-workflow:1.21
org.jenkins-ci.plugins:docker-commons:1.15
Priority: Minor Minor
Reporter: Dylan Yatigammana

We believe the latest update to the docker-workflow-plugin may have broken the windows execution of the docker.stop() command within the pipeline (as it stopped working around that time)

the pipeline is defined with the following steps:

def compileContainer = docker.image("${env.COMPILE_IMAGE_TAG}").run("--name ${compileContainerName} -v ${escapedWorkspace}:C:/work", "ping -t localhost")

...

compileContainer.stop()

previously the job executed the above as follows:

[2019-10-28T15:25:36.053Z] + docker run -d --name zen-32525-implement-ci_compiler_1572276306909 -v C:/Jenkins/workspace/_branches_ZEN-32525-Implement-CI:C:/work -v C:/ProgramData/buildportal/ssl:C:/ProgramData/buildportal/ssl zen-32525-implement-ci_compiler ping -t localhost

...

[2019-10-28T15:41:01.985Z] + docker stop 675ac7e49c7528e046b9726cba057bb927abc7cafe658802f91a375972695230
[2019-10-28T15:41:03.376Z] 675ac7e49c7528e046b9726cba057bb927abc7cafe658802f91a375972695230
[2019-10-28T15:41:03.376Z] + docker rm -f 675ac7e49c7528e046b9726cba057bb927abc7cafe658802f91a375972695230
[2019-10-28T15:41:03.637Z] 675ac7e49c7528e046b9726cba057bb927abc7cafe658802f91a375972695230

however now the job fails at the stop step (and while the docker run does execute, it does not appear in the logs anymore)

//blueocean shows - accompanied by no log output (but a container does appear on the host)
Checks if running on a Unix-like node <1s
Windows Batch Script 3s

...

[2019-11-01T09:45:13.674Z] 

[2019-11-01T09:45:13.674Z] administrator@WIN-1966SFQ4FES C:\Jenkins\workspace\_branches_ZEN-32525-Implement-CI>docker stop administrator@WIN-1966SFQ4FES C:\Jenkins\workspace\_branches_ZEN-32525-Implement-CI run -d --name zen-32525-implement-ci_compiler_1572600576646 -v C:/Jenkins/workspace/_branches_ZEN-32525-Implement-CI:C:/work -v C:/ProgramData/buildportal/ssl:C:/ProgramData/buildportal/ssl zen-32525-implement-ci_compiler ping -t localhost  1>docker 

[2019-11-01T09:45:13.942Z] unknown shorthand flag: 'd' in -d

[2019-11-01T09:45:13.942Z] See 'docker stop --help'.

[2019-11-01T09:45:13.942Z] 

[2019-11-01T09:45:13.942Z] administrator@WIN-1966SFQ4FES C:\Jenkins\workspace\_branches_ZEN-32525-Implement-CI>46e5dae3b97f6e443203a7e3a9c176257362c1a32b9e1ed23a11846ff878a7e0   && docker rm -f administrator@WIN-1966SFQ4FES C:\Jenkins\workspace\_branches_ZEN-32525-Implement-CI run -d --name zen-32525-implement-ci_compiler_1572600576646 -v C:/Jenkins/workspace/_branches_ZEN-32525-Implement-CI:C:/work -v C:/ProgramData/buildportal/ssl:C:/ProgramData/buildportal/ssl zen-32525-implement-ci_compiler ping -t localhost  1>docker 

[2019-11-01T09:45:13.942Z] '46e5dae3b97f6e443203a7e3a9c176257362c1a32b9e1ed23a11846ff878a7e0' is not recognized as an internal or external command,

[2019-11-01T09:45:13.943Z] operable program or batch file.

[2019-11-01T09:45:13.943Z] 

[2019-11-01T09:45:13.943Z] administrator@WIN-1966SFQ4FES C:\Jenkins\workspace\_branches_ZEN-32525-Implement-CI>46e5dae3b97f6e443203a7e3a9c176257362c1a32b9e1ed23a11846ff878a7e0

[2019-11-01T09:45:13.943Z] '46e5dae3b97f6e443203a7e3a9c176257362c1a32b9e1ed23a11846ff878a7e0' is not recognized as an internal or external command,

[2019-11-01T09:45:13.943Z] operable program or batch file.

script returned exit code 1

so it has now completely messed up the stop step - appearing to use the entire run command as the container id?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

dylan.yatigammana@hitachivantara.com (JIRA)

unread,
Nov 8, 2019, 7:35:04 AM11/8/19
to jenkinsc...@googlegroups.com
Dylan Yatigammana commented on Bug JENKINS-60016
 
Re: docker.stop() pipeline step no longer works for windows

I have confirmed that the container id has become the entire run command, by manually executing the bat command

docker stop ${container.id}

dylan.yatigammana@hitachivantara.com (JIRA)

unread,
Nov 8, 2019, 8:05:03 AM11/8/19
to jenkinsc...@googlegroups.com

for anyone else with this issue, my workaround is to make sure I give the container a name, then manually run bat script to stop the container by name.

e.g (something along these lines)

String containerName = "containerName"

//start container with containerName
def compileContainer = docker.image("dockerImageName").run("--name ${containerName}", "ping -t localhost")

//stop & rm container with containerName
bat(script: "docker stop ${containerName}")
bat(script: "docker rm -f ${containerName}")
Reply all
Reply to author
Forward
0 new messages