jenkins - 即使另一个管道在詹金斯中失败,我如何才能执行一个管道
问题描述
我有以下(部分)管道
stages {
stage('bootstrap') {
parallel {
stage("Linux") {
agent { label 'linux' }
steps {
sh 'bootstrap.sh'
}
}
stage("Windows") {
agent { label 'Windows' }
steps {
bat 'bootstrap.bat'
}
}
}
}
stage('devenv') {
parallel {
stage('Linux') {
agent { label 'linux' }
steps {
sh 'devenv.sh'
}
}
stage('Windows') {
agent { label 'Windows' }
steps {
bat 'devenv.bat'
}
}
}
}
}
post {
always {
echo "Done"
}
}
问题是当 bootstrap.bat 在 windows 上失败时,devenv 步骤现在被认为是失败的,linux devenv 将不会继续。即使 Windows 早期失败,我也希望获得 linux 管道的结果。
一种选择是将阶段分开,以便 linux 完整管道位于并行执行的一个分支上,而 windows 位于另一个分支上,但也许有一个我不知道的技巧,因为我试过了,但似乎没有是可接受的语法。
编辑
建议的修复不起作用。这是管道
pipeline {
agent none
parallel {
stage('Linux') {
agent { label 'linux' }
stages {
stage('bootstrap') {
sh "ls"
}
stage('devenv') {
sh "ls"
}
}
}
stage('windows') {
agent { label 'Windows' }
stages {
stage('bootstrap') {
bat 'dir'
}
stage('devenv') {
bat 'dir'
}
}
}
}
}
这是错误信息
WorkflowScript: 8: Undefined section "parallel" @ line 8, column 5.
parallel {
^
WorkflowScript: 1: Missing required section "stages" @ line 1, column 1.
pipeline {
^
解决方案
推荐阅读
- android - 如何添加图像,string.xml 之间的链接
- javascript - ng-init 中的特殊字符:错误:$parse:Lexer 错误:意外的下一个字符,AngularJS
- javascript - Select2 无法选择选项
- haskell - 定义类型同义词 (GHC) 的类型同义词时出现奇怪错误
- javascript - `redux-loop` 和 `connected-react-router` 兼容吗?
- android - lapism SearchView:如何处理点击后按?
- javascript - 尽管有 http-alive,但有多个 tcp 连接
- c# - 发布后 selenium chromedriver 浏览器无法打开
- vue.js - 简单的 Vue.js 计算属性说明
- asp.net - 如何从控制器返回 403 页面