jenkins 流水线执行远程脚本返回127 错误
jenkisn [Pipeline] sshPublisher 链接远程服务器执行sh命令报错 Status [127]
[Pipeline] sshPublisher
SSH: Connecting from host [bc4322610b02]
SSH: Connecting with configuration [dev] …
SSH: EXEC: completed after 200 ms
SSH: Disconnecting configuration [dev] …
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [127]]
127 报错是找不到可执行的文件。
特意比对了下脚本:此处值写了 sshPublisher相关脚本
sshPublisher(publishers: [sshPublisherDesc(configName: 'dev',
transfers: [sshTransfer(cleanRemote: false, excludes: '',
execCommand: 'sh deploy.sh',
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '**/jenkins',
remoteDirectorySDF: false, removePrefix: '', sourceFiles: '**/**')], usePromotionTimestamp: false,
useWorkspaceInPromotion: false, verbose: false)])
修改 execCommand 命令的地址,设置为全局路径 就 ok了
修改后脚本:
sshPublisher(publishers: [sshPublisherDesc(configName: 'dev',
transfers: [sshTransfer(cleanRemote: false, excludes: '',
execCommand: 'sh /root/project/zeus/deploy.sh',
execTimeout: 120000,
flatten: false,
makeEmptyDirs: false,
noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: '**/jenkins',
remoteDirectorySDF: false, removePrefix: '', sourceFiles: '**/**')], usePromotionTimestamp: false,
useWorkspaceInPromotion: false, verbose: false)])