运行Linux shell程序的Jenkins不会重新编写命令

时间:2016-08-26 17:44:49

标签: linux perl shell curl jenkins

我在jenkins构建步骤中运行了以下代码:"执行shell"

#!/bin/sh
workspaceDirectory=WORKSPACE
appName=ClaimCenter

perl WORKSPACE/directory/scripts/FileLoaderDoItTwiceFinal.pl  $workspaceDirectory $appName
curl --ntlm --user myUserName:myPassword --upload-file WORKSPACE/directory/test/ClaimCenterUnmatchedProperties.csv     https://sharpoint/share/sharesight/TrainingManuals/RTC/PropertyFileAnalyzer/filename.csv`

appName=ContactManager

perl WORKSPACE/dircectory/scripts/FileLoaderDoItTwiceFinal.pl $workspaceDirectory $appName
curl --ntlm --user myUserName:MyPassWord --upload-file WORKSPACE/CliamCenterBatch/test/ContactManagerUnmatchedProperties.csv
https://sharpoint/share/sharesight/TrainingManuals/RTC/PropertyFileAnalyzer/filename.csv`

Jenkins构建了很长时间,因此很难重复测试,但在构建操作发生后,以下内容输出到jenkins控制台:

 [TEST-SAMPLE-BUILD-CLAIMS_Dev_Tools_blucas-DEF] $ /bin/sh/tmp/hudson4025671051509183982.sh
/tmp/hudson4025671051509183982.sh: line 5: perl: command not found
/tmp/hudson4025671051509183982.sh: line 6: curl: command not found
/tmp/hudson4025671051509183982.sh: line 10: perl: command not found
/tmp/hudson4025671051509183982.sh: line 11: curl: command not found
/tmp/hudson4025671051509183982.sh: line 12: https://sharpoint/share/sharesight/TrainingManuals/RTC/PropertyFileAnalyzer/filename.csv` : No such file or directory

请帮助我理解为什么这个版本不理解这些命令

1 个答案:

答案 0 :(得分:1)

错误消息告诉您无法找到perlcurl二进制文件,这意味着您的脚本环境没有设置PATH环境变量。

要解决此问题,请使用二进制文件的完整路径,而不仅仅是名称。例如:

/usr/bin/perl WORKSPACE/directory/scripts/FileLoaderDoItTwiceFinal.pl $workspaceDirectory $appName

/usr/bin/curl --ntlm --user myUserName:myPassword --upload-file WORKSPACE/directory/test/ClaimCenterUnmatchedProperties.csv     https://sharpoint/share/sharesight/TrainingManuals/RTC/PropertyFileAnalyzer/filename.csv`