Jenkins Build Pipeline - Restart At Stage

后端 未结 7 1774
忘了有多久
忘了有多久 2020-12-02 14:55

I have the following build pipeline set up as a job:

Stage 1 - verify all dependencies exist
Stage 2 - build the new jar
Stage 3 - Run integration tests
Stag         


        
7条回答
  •  时光说笑
    2020-12-02 15:00

    A better solution is a solution similar to what I suggested in this question:

    Write a pipelining script that has has "if"-guards around the single stages, like this:

    stage "s1"
    if (theStage in ["s1"]) {
        sleep 2
    }
    
    stage "s2"
    if (theStage in ["s1", "s2"]) {
        sleep 2
    }
    
    stage "s3"
    if (theStage in ["s1", "s2", "s3"]) {
        sleep 2
    }
    

    Then you can make a "main" job that uses this script and runs all stages at once by setting the parameter "theStage" to "s1". This job will collect the statistics when all stages are run at once and give you useful estimation times.

    Furthermore, you can make a "partial run" job that uses this script and that is parametrized with the stage that you want to start with. The estimation will not be very useful, though.

提交回复
热议问题