将 post 构建 shell 脚本添加到 Groovy 作业执行器
Add post build shell script to Groovy job executioner
我有一个如下所示的脚本:
cronjobs.groovy :
job('MYJOB') {
triggers {
cron('H * ** *')
}
steps {
shell('some shell script')
shell('some othre shell')
}
}
我想在此处添加另一个 shell 到 运行,以解决 MYJOB 执行失败的问题。可能吗?
还是我必须实施管道?我可以用这种方式实现吗?我需要任何插件吗?
job('MYJOB') {
triggers {
cron('H * ** *')
}
steps {
shell('some shell script')
shell('some other shell script')
}
post {
failure {
shell('some shell script')
shell('some more shell script')
}
}
嗯,根据工作 dsl docs, job have post-build action using publishers directive, but you can't specify failure condition and also you can't execute shell commands directly though you can invoke a groovy script。
所以最好改用管道
我有一个如下所示的脚本:
cronjobs.groovy :
job('MYJOB') {
triggers {
cron('H * ** *')
}
steps {
shell('some shell script')
shell('some othre shell')
}
}
我想在此处添加另一个 shell 到 运行,以解决 MYJOB 执行失败的问题。可能吗? 还是我必须实施管道?我可以用这种方式实现吗?我需要任何插件吗?
job('MYJOB') {
triggers {
cron('H * ** *')
}
steps {
shell('some shell script')
shell('some other shell script')
}
post {
failure {
shell('some shell script')
shell('some more shell script')
}
}
嗯,根据工作 dsl docs, job have post-build action using publishers directive, but you can't specify failure condition and also you can't execute shell commands directly though you can invoke a groovy script。
所以最好改用管道