I have a powershell script cloned into my workspace from a bitbucket repository. If I login to the Jenkins server cli I can run it by doing

cd /var/lib/jenkins/workspace/powershell

This runs fine as expected, but when I try to run it via Jenkins I get the error

/tmp/jenkins2117772455970634975.sh: line 3: ./psscript.ps1: Permission denied

My Jenkins user is

user.name   netuser

and when I do a whoami from both the pwsh cli console and on the linux cli I get the same thing

PS /var/lib/jenkins/workspace/powershell> whoami


[netuser@server1]$ whoami

Is there another setting I'm missing here?

  • 1
    Two quick questions? Is it every powershell script or just this one? If it's limited to this script can you share the contents of that script?
    – casey vega
    Jul 20 '18 at 18:51