Shu*_*ubh 3 jenkins jenkins-pipeline
我需要跳过某些包含“HotFix”一词的分支。Jenkins 文件中是否可以有类似下面的内容?
post {
success {
withCredentials(some_details) {
script {
try {
if (!env.BRANCH_NAME.contains('HotFix')) {
}
else {
}
}
catch (err) {
echo err
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
Jenkins 声明式管道支持可以根据预定义条件跳过某些阶段的when
指令。考虑以下示例:
pipeline {
agent any
stages {
stage("A") {
steps {
// ....
}
}
stage("B") {
when {
expression {
!env.BRANCH_NAME.contains("HotFix")
}
}
steps {
// ....
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我们只想B
在当前分支名称不包含HotFix
.
归档时间: |
|
查看次数: |
5734 次 |
最近记录: |