Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54322

Add ability SKIP stage in script pipeline

XMLWordPrintable

      I try to improve visualization for pipeline.

      I want skip stage and mark skip stage as skip.

      But using Skripted Pipeline i must approve signature.

       

      staticMethod org.jenkinsci.plugins.pipeline.modeldefinition.Utils markStageSkippedForConditional java.lang.String

       

      Using it: 

      import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
      map_dev = ["dev", "qa", "stage" ,"perf"]
      
      prodPromoter = null
      
      map_dev.each {
       stage("${it}") {
        try{
         prodPromoter = input(message: "Deploy ${it}")
        } catch(e){
         Utils.markStageSkippedForConditional("${it}")
        }
       }
      }
      

       

       I now that i can using Declarative Pipeline like this:

       

      when {
       expression {
         try {
          devPromoter = input(message: "Deploy")
         } catch(e) {
           return false
         }
        }
       }
       steps { }
      

       BUT, Could you please just add Utils.markStageSkippedForConditional to @whitelist ?

      Because Scripted pipleine more readable and flexible for me... 

       

      Thank you for advance!

            v2v Victor Martinez
            alexandr_semak Alexandr Semak
            Votes:
            7 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: