0

I'm new to Jenkins pipeline, I want to know whether I can skip same steps in different jobs where one of it has finished. For example, I have tow jobs:jobA and jobB

#jobA
node("A") {
    stage("1") {
        echo "stage 1"
    }
    stage("2") {
        echo "stage 2"
    }
    stage("3") {
        echo "stage 3"
    }
}

#jobB
node("B") {
    stage("1") {
        echo "stage 1"
    }
    stage("2") {
        echo "stage 2"
    }
    stage("4") {
        echo "stage 4"
    }
}

jobA and jobB both have stage "1" and "2", and they are totally the same.If jobA has finished running, and then jobB begins, can jobB get the result of stage1 and stage2 from jobA and then skip them and directly going to stage "4"?

TsanChao
  • 23
  • 3
  • Not possible unless the results are stored in a shared location. Possible duplicate of https://stackoverflow.com/questions/21520475/same-workspace-for-multiple-jobs – Ram Jul 16 '19 at 11:28
  • Sounds like these should be one job with possible parallel stages instead of parallel jobs. – Matthew Schuchard Jul 16 '19 at 12:42

1 Answers1

0

You could try copying the results from stages 1 & 2 using the Copy Artifact Plugin. You would have to archive them in JobA and then you could have a simple check in JobB to see if the files are there or if stages 1&2 still have to be executed.