Hi all,
I'm testing out a pipeline build in Jenkins using the AWS EC2 plugin. Via the plugin, a build will spin up an EC2 instance and run my init script, which you will find detailed in the Gist below:
The init script adds the `ubuntu` user to the docker group, however, at the very end of the slave spool-up, you'll notice that it only lists the 'current groups' as root.
Once the Jenkins slave-agent is installed and the Jenkinsfile of the repo being run (as part of the pipeline job), in this context I've added several sets of debugging info, which I'll summarise below, yet detailed in full in the Gist linked above:
- Within the context of the build steps a la the Jenkinsfile, the current user is `ubuntu` with a UID of 1000
- the `docker` group has a GID of 999 and `ubuntu` user has been added.
- However, running `groups` shows that the current user's groups have not been assigned.
At the moment, I can only get the docker run to work from within the slave agent (whilst parsing the Jenkinsfile
that is) if I disconnect and re-connect to the slave EC2 agent, simply because Jenkins does this as a new SSH connection, and logs into a new session.
Appreciate any advice on how to get around this - thanks!