[英]Execute shell script from Jenkins Pipeline
我正在尝试从我的 jenkins 管道执行 shell 脚本。 我在 shell 命令中提供了绝对和相对路径,但在构建管道时我仍然面临No such file or directory
错误。
这是一个简单的脚本,但还没有工作。
尝试1:
stage ( 'Executing shell script' ) {
steps {
sh '/home/patching/shell_script.sh'
}
}
尝试2:
stage ( 'Executing shell script' ) {
steps {
sh './shell_script.sh'
}
}
尝试3:
stage ( 'Executing shell script' ) {
steps {
dir ('/home/patching/shell_script.sh){
sh './shell_script.sh'
}
}
我真的不知道剧本到底出了什么问题。 有人可以帮助我吗?
我得到了为什么它无法找到我想要运行的文件的问题。 它在不同的奴隶上运行。
你能试试这个
pipeline {
agent any
stages {
stage('Hello World') {
steps {
script {
sh '''
/home/ubuntu/First.sh
'''
}
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.