Speeding up SCM-Pipelines

Thanks for your replies, but none of them were the solution to my issue. However, the website linked by @sodul put me on the right path.

Here is what I did:

  1. Add some code to pipeline 1 so that it clones the remote repo once into a local folder in the workspace folder. I am using declarative pipelines, so here is the code for that:

     def repoDir = "${env.WORKSPACE}/../repository"
    
     stage("Clone Repo To Local Machine"){
         //clone the remote once, so that following jobs don't have to
         dir(repoDir){
             git branch: "master",
             credentialsId: "git_pat",
             url: <remote-url>
         }
    
  2. Set up Pipeline 2 and 3 so that they get access to the local repo freshly cloned by Pipeline 1:

  3. prevent pipelines 2 and 3 from doing the default checkout done at the start of a scm-pipeline by inserting the following line of code into the pipeline code:

    skipDefaultCheckout()

And that’s it! Now pipelines 2 and 3 use the locally stored clone of the remote that has been freshly updated by pipeline 1 beforehand, instead of re-cloning every time they run.