我正在尝试从Jenkins非声明性管道执行shell脚本。
node {
stage('scm checkout'){
git credentialsId: 'a23769c2-2cd0-4980-971d-5408bf50649d', url: 'https://github.com/rahul1436/pi.git'
}
stage ('build docker image'){
sh label: '', script: 'sudo docker build -t rahul .'
}
stage ('push images to ecr'){
sh 'pushecrimage.sh'
}
cleanWs()
}
/var/lib/jenkins/workspace/pi@tmp/durable-f8baf544/script.sh:1:/var/lib/jenkins/workspace/pi@tmp/durable-f8baf544/script.sh: pushecrimage.sh:未找到 23:00:52.589504persistent_task_monitor.go:63:退出状态127
是我得到的o / p。
如果我将脚本更改为以下格式
stage ('push images to ecr'){
sh label: '', script: 'pushecrimage.sh'
}
脚本正在执行。我很想知道为什么它失败了?是因为语法还是我缺少什么?
答案 0 :(得分:0)
将sh 'pushecrimage.sh'
更改为sh './pushecrimage.sh'
。