Execute a script from jenkins pipeline

爱⌒轻易说出口 提交于 2019-12-05 05:40:15

The issue is that the jenkins user (or whatever the user is that runs the Jenkins slave process) does not have write permission on /opt and the sh step wants to create the script-directory@tmp/durable-ae56483c sub-directory there.

Either remove the dir block and use the absolute path to the script:

sh '/opt/script-directory/run.sh'

or give write permission to jenkins user to folder /opt (not preferred for security reasons)

Krzysztof Krasoń

Looks like a bug in Jenkins, durable directories are meant to store recovery information e.g. before executing an external script using sh. For now all you can do is make sure that /opt/script-directory has +r +w and +x set for jenkins user.

Another workaround would be not to change the current directory, just execute sh with it:

sh '/opt/script-directory/run.sh'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!