I have a Jenkins pipeline in which I build in one stage and test in another. I'd like them to be different machines since they have different capabilities. I have something like the following so far:
pipeline {
agent none
stages {
stage('Build') {
agent { node { label 'builder' } }
steps {
sh 'build-the-app'
stash(name: 'app', includes: 'outputs')
}
}
stage('Test’) {
agent { node { label 'tester' } }
steps {
unstash 'app'
sh 'test-the-app'
}
}
}
}
The problem I have is that since it runs on two different nodes, by default it checks out the repository on both nodes. I'd like for it to not do that because it's not needed. So I added the following option:
options { skipDefaultCheckout() }
But now no repositories are checked out, causing the build to not work. How do I, after specifying skipDefaultCheckout
, manually tell the pipeline to checkout the repository in stages which I specify?