Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-26184

jenkins user in jobs not inheriting linux groups

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • core
    • Jenkins Version 1.594, OS: Ubuntu 14.04, Installation Type: WAR, Java: java-6-openjdk-amd64

      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.

          [JENKINS-26184] jenkins user in jobs not inheriting linux groups

          Daniel Beck added a comment -

          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)?

          Daniel Beck added a comment - 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 )?

          Adam Duro added a comment - - edited

          I just tried restarting Jenkins and rebooting the server. Still no luck. I also tried downgrading to 1.585, but that also has still had no effect.

          Here is the output of the latest job. I added a "whoami" and a "groups jenkins".

          @danielbeck, it seems the "groups jenkins" returns the correct groups. How can I get the job itself to have those groups?

          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/hudson3420456835255545641.sh
          + whoami
          jenkins
          + groups
          jenkins
          + groups jenkins
          jenkins : jenkins docker
          Finished: SUCCESS
          

          Adam Duro added a comment - - edited I just tried restarting Jenkins and rebooting the server. Still no luck. I also tried downgrading to 1.585, but that also has still had no effect. Here is the output of the latest job. I added a "whoami" and a "groups jenkins". @danielbeck, it seems the "groups jenkins" returns the correct groups. How can I get the job itself to have those groups? 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/hudson3420456835255545641.sh + whoami jenkins + groups jenkins + groups jenkins jenkins : jenkins docker Finished: SUCCESS

          Adam Duro added a comment -

          Seems I'm not the only other person who has ran into this problem recently:

          http://superuser.com/questions/847553/jenkins-group-while-in-job-is-not-the-same-as-in-terminal

          Adam Duro added a comment - Seems I'm not the only other person who has ran into this problem recently: http://superuser.com/questions/847553/jenkins-group-while-in-job-is-not-the-same-as-in-terminal

          Daniel Beck added a comment -

          There may be something wrong with the way Jenkins gets started as jenkins.

          Did you install the dpkg?

          Daniel Beck added a comment - There may be something wrong with the way Jenkins gets started as jenkins . Did you install the dpkg?

          Daniel Beck added a comment -

          FWIW try running groups after groups jenkins, the latter should cause the groups to get loaded properly according to the info.

          Daniel Beck added a comment - FWIW try running groups after groups jenkins , the latter should cause the groups to get loaded properly according to the info .

          Adam Duro added a comment - - edited

          I was installing Jenkins via the jenkins.war download. Right now I am trying a re-install using the Ubuntu 14.04 package. I will report back to see if it results in anything different. Then I will try again after with the .war and seeing if groups jenkins before groups has any impact.

          Adam Duro added a comment - - edited I was installing Jenkins via the jenkins.war download. Right now I am trying a re-install using the Ubuntu 14.04 package. I will report back to see if it results in anything different. Then I will try again after with the .war and seeing if groups jenkins before groups has any impact.

          Adam Duro added a comment -

          OK, after re-installing using the Jenkins official repo (instead of the .war download) and a reboot, groups are now showing correctly. So the original problem probably lied with the runit start script. That said, using repo is easier. Issue resolved.

          Adam Duro added a comment - OK, after re-installing using the Jenkins official repo (instead of the .war download) and a reboot, groups are now showing correctly. So the original problem probably lied with the runit start script. That said, using repo is easier. Issue resolved.

          Daniel Beck added a comment -

          Did you write "runit" yourself or is it from somewhere associated with the Jenkins project?

          Daniel Beck added a comment - Did you write "runit" yourself or is it from somewhere associated with the Jenkins project?

          Adam Duro added a comment -

          It was written as part of the jenkins Chef cookbook.

          https://github.com/opscode-cookbooks/jenkins

          I will submit an issue to them so that they can correct it for others. This is the template they are using:

          https://github.com/opscode-cookbooks/jenkins/blob/master/templates/default/sv-jenkins-run.erb

          Adam Duro added a comment - It was written as part of the jenkins Chef cookbook. https://github.com/opscode-cookbooks/jenkins I will submit an issue to them so that they can correct it for others. This is the template they are using: https://github.com/opscode-cookbooks/jenkins/blob/master/templates/default/sv-jenkins-run.erb

          Daniel Beck added a comment -

          Issue seems to originate from outside the Jenkins Project, and use of the provided packages/installers resolves/works around the issue, so resolving as Not A Defect.

          Daniel Beck added a comment - Issue seems to originate from outside the Jenkins Project, and use of the provided packages/installers resolves/works around the issue, so resolving as Not A Defect.

            Unassigned Unassigned
            adamduro Adam Duro
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: