Search code examples
jenkinsjenkins-pipeline

Adding multiple stages in a step in Jenkins Pipeline


I'm trying to get a pipeline that would have 2 steps running in parallel where the YAML looks like:

      steps:
        - step: Step1
          stages:
            - stage: Build
              steps:
                - *build_a
                - *build_b
                - *build_c
            - stage: Sniff
              steps:
                - *sniff
            - stage: Accept
              steps:
                - *regress
                - *test_suite_a
        - *slow_build_that_can_run_in_parallel_to_all_the_above

But Jenkins just passes with the above without running anything. So, I also tried putting everything above in a stage and the slow_build_* ran but Step1 failed to run since it tried to submit the whole step as a batch instead of breaking it into stages.

Is it possible in Jenkins to get multiple stages inside of a step? Or am I doing this wrong?


Solution

  • No you can't have stages in a step

    This is from the Pipeline syntax doc.

    • Stages: Only once, inside the pipeline block

    • Stage: Inside the stages section

    • Steps: Inside each stage block