On 17 March 2018 at 21:15, Christian Gagneraud <chg...@gmail.com> wrote:
[...]
> It looks to me that the templated jenkins-slave container doesn't
> share /homme/jenkins with it's host, and so side containers
> (python:2.7 in my case) cannot inherit them.
>
> Does anyone know what sort of tweaking are required for such a setup?
> Do i need to customised the EC2 docker host? I'm running the default
> AWS AMI Linux.

I managed to troubleshoot a bit the problem, I don't have a proper
fix, but this should help understand what's going wrong:

I first noticed on the EC2 docker host that /home/jenkins and all
subdirs were owned by root.
So i decided to create a jenkins user/group with id 10000 in the EC2
docker host.
I then made sure that my chgans/jenkins-slave-ecs container run the
entry point as user jenkins.
I added the mount point
"/home/jenkins/workspace:/home/jenkins/workspace" in my ECS slave
template.

But his was not enough, /home/jenkins was owned by jenkins.jenkins
(created via adduser command), but the workspace sub-directory was
automatically created and owned by root.

So I manually created /home/jenkins/workspace and made sure it was
owned by jenkins.jenkins.

Now when i run a job, the templated jenkins slave can clone stuff in
it's workspace, with the right ownership with regards to the docker
host.
The declarative pipeline plugin then creates the sister containers
(python:2.7 in my case) from within the jenkins slave, using
'--volumes-from <jenkins-slave>' and '-u 10000:10000'.

Which lead me to the following questions:
- do I have to setup my own EC2 and make sure it has a jenkins user?
- Who is creating /home/jenkins/workspace as root, and why?
- Why do I have to share workspace, shouldn't /home/jenkins/agent be
all what is necessary?

Thanks,
Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CABxGUTiEuu%3DKgWNVu__pTfi%2BH0hcZBAz%3Dm2Bx2XEj1H%2Bc2kyEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to