When I run the following as the jenkins user on the command line
$ groups
I get this:
jenkins@zg-jenkins-berkshelf:~$ groups jenkins docker
When I create a simple job that runs the same "groups" command as a shell script step, I get this:
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/Angemo_Test/workspace
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@github.com:zehnergroup/rdi-angemo.git # timeout=10
Fetching upstream changes from git@github.com:zehnergroup/rdi-angemo.git
> git --version # timeout=10
using GIT_SSH to set credentials ZG Jenkins Bot
> git fetch --tags --progress git@github.com:zehnergroup/rdi-angemo.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse origin/master^{commit} # timeout=10
Checking out Revision 4df9e9c94199d24b60185e770bf3936e710cc6c0 (origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 4df9e9c94199d24b60185e770bf3936e710cc6c0
> git rev-list 4df9e9c94199d24b60185e770bf3936e710cc6c0 # timeout=10
[workspace] $ /bin/sh -xe /tmp/hudson245901703018479391.sh
+ groups
jenkins
Finished: SUCCESS
Jenkins "in-job" does not have the same groups as the jenkins user on command line.
When did you add Jenkins to that group? Did you restart Jenkins (or possibly the machine) since? What happens when you run groups jenkins (assuming the user is called jenkins)?