-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
None
I've added kubernetes cloud in system config and created git project with following Jenkinsfile and trying to run the job and hitting with following permission issues.
podTemplate(label: 'mypod', containers: [ containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine', ttyEnabled: true, command: 'cat'), containerTemplate(name: 'golang', image: 'golang:1.6.3-alpine', ttyEnabled: true, command: 'cat') ], volumes: [hostPathVolume(mountPath: "/var/run/docker.sock", hostPath: "/var/run/docker.sock")]) { node ('mypod') { stage 'Get a Maven project' sh """ cat /etc/resolv.conf route ip addr show """ git 'https://github.com/jenkinsci/kubernetes-plugin.git' container('maven') { stage 'Build a Maven project' sh 'mvn clean install' } stage 'Get a Golang project' git url: 'https://github.com/hashicorp/terraform.git' container('golang') { stage 'Build a Go project' sh """ mkdir -p /go/src/github.com/hashicorp ln -s `pwd` /go/src/github.com/hashicorp/terraform cd /go/src/github.com/hashicorp/terraform && make core-dev """ } } }
Error:
Started by user admin
> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to git@github.ibm.com:mkumatag/test-kube-pipeline.git
> git config remote.origin.url git@github.ibm.com:mkumatag/test-kube-pipeline.git # timeout=10
Fetching origin...
Fetching upstream changes from origin
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/master
Seen 1 remote branch
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@github.ibm.com:mkumatag/test-kube-pipeline.git # timeout=10
Fetching upstream changes from git@github.ibm.com:mkumatag/test-kube-pipeline.git
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --tags --progress git@github.ibm.com:mkumatag/test-kube-pipeline.git +refs/heads/*:refs/remotes/origin/*
Checking out Revision 45e459e4645b1dfb2e27bde2b36503fb1d2926d6 (master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 45e459e4645b1dfb2e27bde2b36503fb1d2926d6
> git rev-list 45e459e4645b1dfb2e27bde2b36503fb1d2926d6 # timeout=10
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Still waiting to schedule task
kubernetes-634383bd02e4408a9ad879376fa358c7-4e36e7bfa07c9 is offline
Running on kubernetes-634383bd02e4408a9ad879376fa358c7-4e37578f5757a in /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA
[Pipeline] {
[Pipeline] stage (Get a Maven project)
Using the 'stage' step without a block argument is deprecated
Entering stage Get a Maven project
Proceeding
[Pipeline] sh
[test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA] Running shell script
+ cat /etc/resolv.conf
+ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 172.17.0.1 0.0.0.0 UG 0 0 0 eth0
172.17.0.0 * 255.255.0.0 U 0 0 0 eth0
+ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
14: eth0@if15: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
link/ether 02:42:ac:11:00:05 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.5/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe11:5/64 scope link
valid_lft forever preferred_lft forever
+ sleep 30
[Pipeline] git
Cloning the remote Git repository
Cloning repository https://github.com/jenkinsci/kubernetes-plugin.git
> git init /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA # timeout=10
Fetching upstream changes from https://github.com/jenkinsci/kubernetes-plugin.git
> git --version # timeout=10
> git fetch --tags --progress https://github.com/jenkinsci/kubernetes-plugin.git +refs/heads/*:refs/remotes/origin/*
> git config remote.origin.url https://github.com/jenkinsci/kubernetes-plugin.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://github.com/jenkinsci/kubernetes-plugin.git # timeout=10
Fetching upstream changes from https://github.com/jenkinsci/kubernetes-plugin.git
> git fetch --tags --progress https://github.com/jenkinsci/kubernetes-plugin.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision a9bb356e021a89fd174472217aa112ea37c0b308 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f a9bb356e021a89fd174472217aa112ea37c0b308
> git branch -a -v --no-abbrev # timeout=10
> git checkout -b master a9bb356e021a89fd174472217aa112ea37c0b308
> git rev-list a9bb356e021a89fd174472217aa112ea37c0b308 # timeout=10
[Pipeline] container
[Pipeline] {
[Pipeline] stage (Build a Maven project)
Using the 'stage' step without a block argument is deprecated
Entering stage Build a Maven project
Proceeding
[Pipeline] sh
[test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA] Running shell script
Executing shell script inside container [maven] of pod [kubernetes-634383bd02e4408a9ad879376fa358c7-4e37578f5757a]
Executing command: sh -c echo $$ > '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/pid'; jsc=durable-d2db8e2edcfe3ddf1127c78a3c7156e6; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/script.sh' > '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/jenkins-result.txt'
cd /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA
sh -c echo $$ > '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/pid'; jsc=durable-d2db8e2edcfe3ddf1127c78a3c7156e6; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/script.sh' > '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/jenkins-result.txt'
exit
/home/jenkins # cd /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQ
LCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA
/bin/sh: cd: can't cd to /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA
/home/jenkins # sh -c echo $$ > '/home/jenkins/workspace/test-kube-pipeline_mast
er-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/pid
'; jsc=durable-d2db8e2edcfe3ddf1127c78a3c7156e6; JENKINS_SERVER_COOKIE=$jsc '/ho
me/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2
C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/script.sh' > '/home/jenkins/workspace/t
est-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tm
p/durable-ee7e41ae/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/tes
t-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/
durable-ee7e41ae/jenkins-result.txt'
/bin/sh: can't create /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/pid: Permission denied
/bin/sh: can't create /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/jenkins-log.txt: Permission denied
/bin/sh: can't create /home/jenkins/workspace/test-kube-pipeline_master-IUIW3TJVYLQLCZOGWHIM6BOJZ3VXUBKJ2C2L4YNTBE4GL52NRMEA@tmp/durable-ee7e41ae/jenkins-result.txt: Permission denied
/home/jenkins # exit
command terminated with non-zero exit code: Error executing in Docker Container: 1[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE
- is related to
-
JENKINS-47827 Support passing a user/uid into containerTemplate
-
- Resolved
-