Permission denied while doing jenkins sh pipeline step

I have some problems with this situation: every time I create a new job to the pipeline (called "pipeline"), the step sh

won't work even with a simple command like ls

or pwd

, and it returns this log:

sh: 1: /var/jenkins_home/workspace/pipeline@tmp/durable-34c21b81/script.sh: Permission denied

      

Any suggestions?

+5


source to share


1 answer


I assume you are using

stage(name){
   sh ./runSomething
}

      



Jenkins always uses the jenkins user to run scripts. There are several possibilities:

  1. Jenkins is running with a different user, maybe you run it with a different user.
  2. Something worked when installing jenkins, check you have jenkins user
+1


source







All Articles