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

Add option for sequential execution of matrix in pipeline

        [JENKINS-62085] Add option for sequential execution of matrix in pipeline

        Hagen Rahn added a comment -

        Hi I recently stumbled upon the issue to run a sequence of build steps of an declaratove pipeline on multiple environments. I know that I could achiev this using a scripted piepline but quite easy, but as I recognized the matrix functionality I appreciated the elegance of solving my issue. 

        As described in the above mentioned issue I became curious about the strange - meaning counterintuitive - execution order of steps in a matrix pipeline.

        I really expected the stages to run in sequence for first one configuration, then the next and so on.

        The current default behaviour (which seems to match the matrix plugin) resulted in reconfiguring the job without matrix functionality and duplicating stages for each config, as there seems to be no way to get stages run in sequence for each configuration . Meaning

        matrix {
          axes {
            axis {
              name: "currentHostName"
              values: 'X','Y,'Z'
            }
          }
          stages {
            stage ('A') {} 
            stage ('B') {} 
            stage ('C') {}
          }
        } 

        Shall be run in the following order:

        1. Host X Stage A
        2. Host X Stage B
        3. Host X Stage C
        4. Host Y Stage A
        5. Host Y Stage B
        6. Host Y Stage C
        7. Host Z Stage A
        8. Host Z Stage B
        9. Host Z Stage C

        Please correct me if I'm wrong.

         

        Additionally could you improve the matrix extension in a way to enable usage of axis names in stages? -> Feel free to extract another ticket for this.

         

        Hagen Rahn added a comment - Hi I recently stumbled upon the issue to run a sequence of build steps of an declaratove pipeline on multiple environments. I know that I could achiev this using a scripted piepline but quite easy, but as I recognized the matrix functionality I appreciated the elegance of solving my issue.  As described in the above mentioned issue I became curious about the strange - meaning counterintuitive - execution order of steps in a matrix pipeline. I really expected the stages to run in sequence for first one configuration, then the next and so on. The current default behaviour (which seems to match the matrix plugin) resulted in reconfiguring the job without matrix functionality and duplicating stages for each config, as there seems to be no way to get stages run in sequence for each configuration . Meaning matrix { axes { axis { name: "currentHostName" values: 'X' , 'Y,' Z' } } stages { stage ( 'A' ) {} stage ( 'B' ) {} stage ( 'C' ) {} } } Shall be run in the following order: Host X Stage A Host X Stage B Host X Stage C Host Y Stage A Host Y Stage B Host Y Stage C Host Z Stage A Host Z Stage B Host Z Stage C Please correct me if I'm wrong.   Additionally could you improve the matrix extension in a way to enable usage of axis names in stages? -> Feel free to extract another ticket for this.  

          bitwiseman Liam Newman
          bitwiseman Liam Newman
          Votes:
          5 Vote for this issue
          Watchers:
          7 Start watching this issue

            Created:
            Updated: