Gist for https://youtu.be/u-1lyoas3ys
- catchError build step
pipeline {
agent any
stages {
stage('Hello') {
steps {
sh 'exit 0'
}
}
stage('stage2') {
steps {
sh "echo stage2"
}
}
}
}
pipeline {
agent any
stages {
stage('Hello') {
steps {
sh 'exit 1'
}
}
stage('stage2') {
steps {
sh "echo stage2"
}
}
}
}
pipeline {
agent any
stages {
stage('Hello') {
steps {
catchError {
sh 'exit 1'
}
}
}
stage('stage2') {
steps {
sh "echo stage2"
}
}
}
}
pipeline {
agent any
stages {
stage('Hello') {
steps {
catchError(message:'news') {
sh 'exit 1'
}
}
}
stage('stage2') {
steps {
sh "echo stage2"
}
}
}
}
pipeline {
agent any
stages {
stage('Hello') {
steps {
catchError(message:'news',buildResult:'UNSTABLE',stageResult:'UNSTABLE') {
sh 'exit 1'
}
}
}
stage('stage2') {
steps {
sh "echo stage2"
}
}
}
}