Jenkins Pipeline job can't find script due to @tmp path being created

后端 未结 6 1077
小蘑菇
小蘑菇 2021-02-07 07:19

I am writing a pipeline job that will call another script to execute. The Jenkinsfile and script exist in the same directory and yet the job fails to find the script to run.

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-07 08:03

    I was facing a similar issue where though the shell script is present on path /var/lib/jenkins/workspace/New_commit_test/Fibonacci.sh, Jenkins build was getting failed with error message : "/tmp/jenkins6688065235543884785.sh: 3: /tmp/jenkins6688065235543884785.sh: /var/lib/jenkins/workspace/New_commit_test/Fibonacci.sh: not found"

    so i changed my earlier command from : ${WORKSPACE}/Fibonacci.sh > New_commit_test.txt

    to : (since i was using bash script here ) bash ${WORKSPACE}/Fibonacci.sh > New_commit_test.txt

    which sorted issue here for me

提交回复
热议问题