TL;DR: see screenshot and below to skip setup context.
For context: jenkins setup repo and source build/image repo
I’m using compose to setup a Jenkins controller image/container, then telling Jenkins to run the automated builds inside of a separate “agent” container (on the same machine) using jenkins/jnlp-agent-docker from docker hub in my configuration file. The software builds are triggered from GitHub PRs in repos that define their own Dockerfile image as well as Jenkinsfile build instructions.
So there are essentially three containers: 1. Jenkins Controller (master) 2. Jenkins JNLP/docker build agent (slave) 3. Software build environment (from separate repo).
When the build runs, I get the following output in the Jenkins console: Started by user jenkinsRunning as jenkinsConnecting to https://api.github.co - Pastebin.com
Some things of note are
Running as user "jenkins"
-
Obtained Jenkinsfile from 05add618c7d5fd714b17e9db2635c5e9648c178f
(separate source repo commit) -
Running on jnlp-agent-0000ri6et8ubm on docker in /home/jenkins/workspace/gsg-org_greatfet_docker_test
(build agent container) -
docker build -t f6cbe69441576453067a77f6fbc60290c6331396 -f Dockerfile .
(source repo image) Successfully tagged f6cbe69441576453067a77f6fbc60290c6331396:latest
Which brings us to the problem section: jnlp-agent-0000ri6et8ubm on docker seems to be running inside container 5e7d119c2f9de6afed20e0b2960dd9e2cadbed0ba7018fc248a5f4a07268fbfb but /home/jenkins/workspace/gsg-org_greatfet_docker_test could not be found among [/home/jenkins/.jenkins, /home/jenkins/agent, /var/jenkins_home]
...
+ docker inspect -f . f6cbe69441576453067a77f6fbc60290c6331396
.
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] withDockerContainer
jnlp-agent-0000ri6et8ubm on docker seems to be running inside container 5e7d119c2f9de6afed20e0b2960dd9e2cadbed0ba7018fc248a5f4a07268fbfb
but /home/jenkins/workspace/gsg-org_greatfet_docker_test could not be found among [/home/jenkins/.jenkins, /home/jenkins/agent, /var/jenkins_home]
but /home/jenkins/workspace/gsg-org_greatfet_docker_test@tmp could not be found among [/home/jenkins/.jenkins, /home/jenkins/agent, /var/jenkins_home]
$ docker run -t -d -u 1000:1000 --group-add=46 --privileged -v /dev/bus/usb:/dev/bus/usb -w /home/jenkins/workspace/gsg-org_greatfet_docker_test -v /home/jenkins/workspace/gsg-org_greatfet_docker_test:/home/jenkins/workspace/gsg-org_greatfet_docker_test:rw,z -v /home/jenkins/workspace/gsg-org_greatfet_docker_test@tmp:/home/jenkins/workspace/gsg-org_greatfet_docker_test@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 ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** f6cbe69441576453067a77f6fbc60290c6331396 cat
$ docker top d995efe7ee5170228fcb91dd4bf117bbfe7c07758a44b0bd9718e325cf3384d4 -eo pid,comm
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build (Host))
[Pipeline] sh
process apparently never started in /home/jenkins/workspace/gsg-org_greatfet_docker_test@tmp/durable-2b0143ec
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
...
I wasn’t sure which container Jenkins was trying to find the /home/jenkins/workspace/gsg-org_greatfet_docker_test
path inside of so I did some digging with docker exec
*note: the image hashes are from a different run in this screenshot, but you can see the three separate containers in docker ps
Here you can see me first going into the agent container and finding the source code under /home/jenkins/workspace/gsg-org_greatfet_docker_test
, which is different than the /home/jenkins/agent
path Jenkins is looking for in the above output but /home/jenkins/workspace/gsg-org_greatfet_docker_test could not be found among [/home/jenkins/.jenkins, /home/jenkins/agent, /var/jenkins_home]
then secondly going into the container defined in the separate repo and seeing that the /home/jenkins/workspace/gsg-org_greatfet_docker_test
folder is empty, but finding the source code instead copied into /
, neither of which are the path Jenkins is looking for above either.
Is this a workspace or WORKDIR
thing? Or maybe an entrypoint thing? I’m new to Docker and am not sure how to resolve this path issue with Jenkins with a complex setup involving three separate running containers.