Help to setting up sysbox in a Jenkins CI/CD pipeline to spin up jenkins agents that would spinup child containers #648
Replies: 3 comments 4 replies
-
Hi @jadesoturi, thanks for giving Sysbox a shot. I think I understand your scenario (thanks for the detailed explanation) and Sysbox should be able to help. Have you seen these blogs yet? If not, please take a look:
|
Beta Was this translation helpful? Give feedback.
-
Hello, I know this question is from a past time and is outdated, but since I'm having quite the same project, here I am. I don't have an answer to your exact question but another question in return. I know this may not be what you wanted and i apologies in advance for that. Why did you choose YADP and not docker-plugin ? With sysbox on a bare-metal Docker host I can achieve what you want with docker-plugin. |
Beta Was this translation helpful? Give feedback.
-
Hi guys. Sorry for not answering, should def. enable notifications on Github 🙈 . We had to prioritise a little differently and pivot away form this, so I haven't worked on this for a while. @pguinet YADP was a historical choice done long before I was here. Due to a bunch of custom Jenkins scripts in the pipeline here, we decided not to mess with what works(even if it was somewhat wobbly at times). @ctalledo To answer your questions: No. The docker run command is handled by the YADP, at least from what I remember right now. It's been a while. As for the image: we are already hosting internally a modified image based on the jenkins-inbound-agent:
And the finished build is being stored in our local harbor and pulled in by the YADP plugin. But IIRC, we tried setting an entrypoint through the Dockerfile, but it got overruled by the YADP. I will have to check up on this though and get back to you. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
Today we are running Jenkins master on bare-metal, together with YADP(YetAnotherDockerPlugin) to spin up jenkins docker agents on-demand using the JNLP protocol. This works, but we either have to run things as root or map the hosts docker.sock to the containers, add jenkins user to the docker group or see things fail. What we want is to use sysbox runtime on the host that the agent containers are created on, so that the agent container can then create the needed containers to do the build/tests as child containers that are isolated from the host, but that run as root inside so build tools like npm, maven and the like work without any issues(it is a pain at the moment, with half the builds failing unless we pass -u root as docker arguments for container creation. This would not be an issue if we knew that container is running inside a sysbox, and not directly on the host).
Sofar, I've taken the jenkins/inbound-agent image and added docker to it and set sysbox as the default runtime on the host. When doing a docker exec -it on the jenkins agent container, there is no /var/run/docker.sock there as far as I am able to see, and the build/test containers are still started on the host directly, but using sysbox as runtime(since its default).
I attempted to add systemd to start the dockerd service(using ubuntu-focal-systemd and ubuntu-focal-systemd-dockerd Dockerfiles as example), but got the error that the system was not started with systemd as PID1(even though we specify the systemd entrypoint as per examples in your Dockerfiles). After a little bit of reading it seems I need to run the container as --priviledged, but that kinda defeats the pupose of sysbox, no? Or am i totaly confused here and have something mixed up? And if so, how do I make it work with the jenkins/inbound-agent image to get the desired result(docker in docker with sysbox on host, dockerd in outer container and inner container running with root inside)? We do not want to migrate out Jenkins controler into docker and run the full pipeline in sysbox/docker. Only certain builds that would be provisioned to the agent based on labels.
Thank you in advance, if there is need for any clarification, I can post logs/configs etc :)
//jadesoturi
Beta Was this translation helpful? Give feedback.
All reactions