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

Exclude skipped stages from estimated duration calculation

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • Jenkins ver. 2.52
      Plugins :
      - Pipeline 2.5
      - Pipeline: Basic Steps 2.4
      - Pipeline: Build Step 2.5
      - Pipeline: Stage Step 2.2
      - Pipeline: Input Step 2.5
      - Pipeline: Groovy 2.29

      Hello,

      I'm currently working on a Pipeline script that will execute multipe Stages depending on a parameter set in the Pipeline job (JenkinsFile attached). 

      Here is a sample of the JenkinsFile :

       

      pipeline {
      agent any
      
      stages {
           stage('Full Stop') {
                steps {
                      script { 
                            if (params.FULL_STOP == 'YES') {
                                  echo 'The application will now be stopped'
                            } else {
                                  echo 'Skipped'
                            }	
                      }
                }
           }
           stage('MQ') {
                steps {
                      script { 
                            if (params.MQ == 'YES') {
                                  echo 'Deployment of MQ'
                            } else {
                                  echo 'Skipped'
                            }	
                      }
                }
           }
           stage('Full Start') {
                steps {
                      script { 
                            if (params.FULL_START== 'YES') {
                                  echo 'The application will now be started'
                            } else {
                                  echo 'Skipped'
                            }	
                      }
                }
           }
      }
      }
      

      This code works fine but the issue here is that i can't really skip a Stage (i use currently the echo but this no doing the job).

      What i mean is that in the Stage View, there is a "Average stage times" that permit to have an average duration for a Stage, but when we skip a stage this duration isn't null but of 30 to 50ms (Screenshots attached).

      So the "Average stage times" isn't reliable because it does an average on all Build even if the Stage is skipped. Doing an average with a Stage during 3min with another one during 34ms falsified the "Average stage times".

      Is there is a way to really bypass/skip a stage depending on a parameter set in the job ?

      This will permit us to use the Stage View correctly.

      Thanks in advance for your help.

      Guillaume.

       

        1. JenkinsFile-Issue.txt
          1.0 kB
          Guillaume Da Nobrega
        2. Screenshot-Jenkins-SkippedStage.jpg
          112 kB
          Guillaume Da Nobrega

            svanoort Sam Van Oort
            guillaumedanobrega Guillaume Da Nobrega
            Votes:
            15 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: