Answers: <p>The issue was with the wrong UID and GID of the user. after I've changed it from jenkins to 1000 1000 recursively, issue solved.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-09-30T13:35:52.563Z
Answers: Can you elaborate? I experience the same issue. UID GID of user where? in the filesystem? can you explain?
Answers: Moshe
Answers: CC BY-SA 4.0
Answers: 2020-03-09T18:28:54.377Z
Answers: 2020-03-09T18:28:54.377Z
Answers: arielma
Body: <p>I have a pipeline which fails on script approval:</p>
  
  <pre><code>Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment. Administrators can decide whether to approve or reject this signature.
  [Pipeline] End of Pipeline
  [BFA] Scanning build for known causes...
  [BFA] No failure causes found
  [BFA] Done. 0s
  [JobCompletedListener] Build result is: FAILURE
  org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment
  </code></pre>
  
  <p>I went to in scriptApproval screen, approved the below:</p>
  
  <pre><code>signature: method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild     
  signature: method java.net.URL getProtocol
  signature: method java.lang.Throwable printStackTrace
  signature: method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment
  </code></pre>
  
  <p>but on the next run I'm getting the exact same error, and approval request in scriptApproval screen, comes up again. any idea what is the root cause of this behavior? is there a workaround for it?</p>
  
  <p>Jenkins is running as a container, and the Security plugin version is 1.60. BTW, the same job works perfect on other Jenkins which is VM</p>
  
Comments: CC BY-SA 4.0
Comments: 2020-03-03T15:09:49.780Z
Comments: Did you try to restart Jenkins ?
Comments: Hedi Nasr
Comments: CC BY-SA 4.0
Comments: 2020-03-03T15:16:30.150Z
Comments: does it still fail if you run outside of the sandbox?
Comments: Alex
Comments: CC BY-SA 4.0
Comments: 2020-03-03T15:40:37.807Z
Comments: @Alex it runs groovy file from bitbucket. I don't have the option of disabling the sandbox
Comments: arielma
Comments: CC BY-SA 4.0
Comments: 2020-03-03T17:22:46.127Z
Comments: Can you test it directly in jenkins once to see if you’re having the same issue?
Comments: Alex
Comments: CC BY-SA 4.0
Comments: 2020-03-03T22:17:00.843Z
Comments: I don't think this is the issue, as it works as well on other Jenkins. the only difference is that the other one is VM, while this is a container.
Comments: arielma
Tags: <jenkins-pipeline>
Title: Jenkins pipeline fails on script approval, although it was approved
UserDisplayName: arielma
ThreadText: # Jenkins pipeline fails on script approval, although it was approved
  
  (Asked by: username_0 on 2020-03-03)
  
  I have a pipeline which fails on script approval:
  
  ```
  Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment. Administrators can decide whether to approve or reject this signature.
  [Pipeline] End of Pipeline
  [BFA] Scanning build for known causes...
  [BFA] No failure causes found
  [BFA] Done. 0s
  [JobCompletedListener] Build result is: FAILURE
  org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment
  
  ```
  
  I went to in scriptApproval screen, approved the below:
  
  ```
  signature: method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild     
  signature: method java.net.URL getProtocol
  signature: method java.lang.Throwable printStackTrace
  signature: method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment
  
  ```
  
  but on the next run I'm getting the exact same error, and approval request in scriptApproval screen, comes up again. any idea what is the root cause of this behavior? is there a workaround for it?
  
  Jenkins is running as a container, and the Security plugin version is 1.60. BTW, the same job works perfect on other Jenkins which is VM
  
  **Tags:** jenkins-pipeline
  
  > **Comments:**
  > **username_1**: Did you try to restart Jenkins ?  
  > **username_2**: does it still fail if you run outside of the sandbox?  
  > **username_0**: @username_2 it runs groovy file from bitbucket. I don't have the option of disabling the sandbox  
  > **username_2**: Can you test it directly in jenkins once to see if you’re having the same issue?  
  > **username_0**: I don't think this is the issue, as it works as well on other Jenkins. the only difference is that the other one is VM, while this is a container.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-03-09. Score: 1 | Accepted answer
  
  The issue was with the wrong UID and GID of the user. after I've changed it from jenkins to 1000 1000 recursively, issue solved.
  
  > **Comments:**
  > **username_3**: Can you elaborate? I experience the same issue. UID GID of user where? in the filesystem? can you explain?  
  
  ---
  
  