Tuesday, November 19, 2019

how to skip stage in jenkins pipeline


Skipped Stages in Jenkins Scripted Pipeline



To show all stages at every build even if not executed is a

good practice and brings transparency into pipelines

with conditional steps or stages. Add the when condition

to a stage of your pipeline:





pipeline {
    agent any
  stages {
    stage ('1 choice') {
      when {
                expression { choice == '1'}
            }
            steps {
                echo "Hello, Choice 1!"
            }
    }
    stage ('2 choice') {
      when {
                expression { choice == '2'}
            }
            steps {
                echo "Hello, Choice 2!"
            }
    }
  stage ('3 choice') {
      when {
                expression { choice == '3'}
            }
            steps {
                echo "Hello, Choice 3!"
            }
        }
  }
}







5 comments:

  1. Hi please advise Same concept we can implement in jenkins file using git?

    ReplyDelete
  2. I'm constantly searching on the internet for posts that will help me. Thank you for creating out such an informative and knowledgeable blog.
    visit site

    ReplyDelete
  3. Nice Article! I am so happy after reading your blog. It’s a very useful blog for us. Thanks for sharing your valuable information. thanks for sharing.
    visit site

    ReplyDelete
  4. Nice Article! I am so happy after reading your blog. It’s a very useful blog for us. Thanks for sharing your valuable information. thanks for sharing.
    outlook bellen

    ReplyDelete
  5. Chennai's No.1 software training institute, Infycle Technologies, provides the best Big Data Hadoop Training in Chennai for students, freshers, and tech professionals along with other corporate courses such as Data Science, Cloud computing, DevOps, Digital Marketing, Python, Big Data, Selenium, Java, Hadoop, iOS, and Android development with 100% hands-on training. After the completion of training, the students will be sent for placement interviews in the core MNC's. Call 7502633633 to get more info and a free demo.Big Data Hadoop Training in Chennai | Infycle Technologies

    ReplyDelete

Wireless Security Configuration: Protect Your Network Now!

Introduction: In today’s connected world, wireless networks are as common as smartphones, and they’re often the gateway to our personal, pr...