How can I execute Shell script in Jenkinsfile?

后端 未结 4 716
别那么骄傲
别那么骄傲 2020-12-14 15:35

I am keeping a shell script file named urltest.sh in /var/lib/jenkins and executing the file from jenkins build.

When I execu

4条回答
  •  借酒劲吻你
    2020-12-14 16:29

    If you see your error message it says

    Building in workspace /var/lib/jenkins/workspace/AutoScript

    and as per your comments you have put urltest.sh in

    /var/lib/jenkins

    Hence Jenkins is not able to find the file. In your build step do this thing, it will work

    cd             # which will point to /var/lib/jenkins
    ./urltest.sh   # it will run your script
    

    If it still fails try to chown the file as jenkin user may not have file permission, but I think if you do above step you will be able to run.

提交回复
热议问题