[JIRA] (JENKINS-55585) Powershell plugin inside container hangs

4 views
Skip to first unread message

chiranth.bagivaluramaswamy@citrix.com (JIRA)

unread,
Jan 14, 2019, 3:48:02 PM1/14/19
to jenkinsc...@googlegroups.com
Chiranth Bagivalu Ramaswamy created an issue
 
Jenkins / Bug JENKINS-55585
Powershell plugin inside container hangs
Issue Type: Bug Bug
Assignee: Nicolas De Loof
Components: docker-plugin, powershell-plugin
Created: 2019-01-14 20:47
Environment: Jenkins ver. 2.138.3
Powershell Plugin : 1.3
Docker Pipeline: 1.17
Priority: Blocker Blocker
Reporter: Chiranth Bagivalu Ramaswamy

The powershell plugin when used within docker container enters a hang state. I would expect it to fail if powershell core is not installed, which works if the same thing is ran outside docker. The jenkins agent is a Ubuntu 16.04 machine.

I dont see any other process also running within the docker container in the hung state except cat

//

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
xxxx alpine:latest "cat" 5 minutes ago Up 5 minutes ecstatic_galileo
PS /home/administrator> docker top 2a2a21fe5dbc
WARNING: Error loading config file: /home/administrator/.docker/config.json: open /home/administrator/.docker/config.json: permission denied
UID PID PPID C STIME TTY TIME CMD
adminis+ 5372 5350 0 07:39 pts/0 00:00:00 cat

//Sample Jenkinsfile

timestamps {

//linux docker
node("LinuxDocker") {

//Works
docker.image("alpine:latest").inside

{ sh("echo command inside docker") }

// Hangs

docker.image("alpine:latest").inside

{ powershell(script:"echo command inside docker") }

}

}

Hung output
==================================================
[Pipeline]

{ [Pipeline] sh 20:39:30 + echo command inside docker 20:39:30 command inside docker [Pipeline] }

$ docker top <xxxxguid> -eo pid,comm
WARNING: Error loading config file: /home/administrator/.docker/config.json: open /home/administrator/.docker/config.json: permission denied
$ docker stop --time=1 <xxxxguid>
$ docker rm -f <xxxxguid>
[Pipeline] // withDockerContainer
[Pipeline] sh
20:39:32 + docker inspect -f . alpine:latest
20:39:32 WARNING: Error loading config file: /home/administrator/.docker/config.json: open /home/administrator/.docker/config.json: permission denied
20:39:32 .
[Pipeline] withDockerContainer
20:39:32 dockerLinux does not seem to be running inside a container
$ docker run -t -d -u 1000:1000 -w /home/agent/workspace/ation_test_dockertestexecute -v /home/agent/workspace/ation_test_dockertestexecute:/home/agent/workspace/ation_test_dockertestexecute:rw,z -v /home/agent/workspace/ation_test_dockertestexecute@tmp:/home/agent/workspace/ation_test_dockertestexecute@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** alpine:latest cat
[Pipeline] {
[Pipeline] powershell
$ docker top <hguid> -eo pid,comm

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

chiranth.bagivaluramaswamy@citrix.com (JIRA)

unread,
Jan 18, 2019, 9:38:02 AM1/18/19
to jenkinsc...@googlegroups.com
Chiranth Bagivalu Ramaswamy commented on Bug JENKINS-55585
 
Re: Powershell plugin inside container hangs

Update: I have also tested with a different image i.e docker.image("julkwiec/dotnet-mono-powershell-build:latest") and the issue is still the same.
Could anyone help look into the issue?

pjdarton@gmail.com (JIRA)

unread,
Feb 8, 2019, 7:12:02 AM2/8/19
to jenkinsc...@googlegroups.com
pjdarton commented on Bug JENKINS-55585

The fact that the sh step worked tells us that this isn't a problem with the docker-plugin; that's telling us that the docker-plugin successfully created a container, and a matching Jenkins node, and joined the two up so that Jenkins was able to run build steps on the container ... and that's the end of the docker-plugin's responsibilities.

My guess is that the powershell step doesn't play nicely with docker containers, and that's not really something that the docker-plugin can do anything about.

What I'd suggest you do is manually create a docker container based on your chosen image, manually create a Jenkins (JNLP) slave node with some label of your choosing, and then run the Jenkins slave.jar process under your control within the docker container, logging absolutely everything it does.

i.e. log all process-creation commands etc so you can see exactly what gets run by whom and when.

...and then try running the sh and powershell steps from Jenkins (targetting that node via its label) and see what happens.

mcminn.drew@gmail.com (JIRA)

unread,
Feb 19, 2019, 7:05:02 PM2/19/19
to jenkinsc...@googlegroups.com
Drew McMinn edited a comment on Bug JENKINS-55585
Having this exact same problem.

```
withDockerContainer(image: 'mcr.microsoft.com/powershell', toolName: 'docker', args: '--entrypoint=""') {
    powershell label: '', returnStdout: true, script: 'write-host "test"'
}
```

mcminn.drew@gmail.com (JIRA)

unread,
Feb 19, 2019, 7:05:02 PM2/19/19
to jenkinsc...@googlegroups.com
 
Re: Powershell plugin inside container hangs

Having this exact same problem.

mcminn.drew@gmail.com (JIRA)

unread,
Feb 19, 2019, 7:06:02 PM2/19/19
to jenkinsc...@googlegroups.com
Drew McMinn edited a comment on Bug JENKINS-55585
Having this exact same problem.

```  
{code:java}
withDockerContainer(image: 'mcr.microsoft.com/powershell', toolName: 'docker', args: '--entrypoint=""') {
{    
powershell label: '', returnStdout: true, script: 'write-host "test"'
}
``` {code}
 

 

nicolas.deloof@gmail.com (JIRA)

unread,
Apr 24, 2019, 10:30:33 AM4/24/19
to jenkinsc...@googlegroups.com
Nicolas De Loof assigned an issue to Unassigned
 
Change By: Nicolas De Loof
Assignee: Nicolas De Loof

ddigtiar@cloudbees.com (JIRA)

unread,
Sep 3, 2019, 12:22:02 AM9/3/19
to jenkinsc...@googlegroups.com
Denys Digtiar commented on Bug JENKINS-55585
 
Re: Powershell plugin inside container hangs

Changing the component to durable-task since that is what implements the powershell step, not the PowerShell plugin.

ddigtiar@cloudbees.com (JIRA)

unread,
Sep 3, 2019, 12:23:02 AM9/3/19
to jenkinsc...@googlegroups.com

ddigtiar@cloudbees.com (JIRA)

unread,
Sep 3, 2019, 12:23:03 AM9/3/19
to jenkinsc...@googlegroups.com
Denys Digtiar updated an issue
Change By: Denys Digtiar
Component/s: durable-task-plugin
Component/s: powershell-plugin
Reply all
Reply to author
Forward
0 new messages