Reputation: 371
I am setting up a simple jenkins pipeline with a dockerfile agent, Jenkinsfile as follows:
pipeline {
agent {
dockerfile {
dir 'docker'
args '-v yarn_cache:usr/local/share/.cache/yarn'
}
}
environment {
CI = 'true'
}
stages {
stage('Build') {
steps {
sh 'yarn install'
sh 'yarn run build'
}
}
stage('Test') {
steps {
sh 'yarn run test'
}
}
}
}
I would like the yarn cache persist in a volume so I want the image to be started with '-v yarn_cache:usr/local/share/.cache/yarn'.
With the given Jenkinsfile, jenkins stalls after creating the image.
The args parameter is not actually documentented for the dockerfile agent but for the docker agent.
Do I really have to use a predefined (and uploaded) image just to be able to use parameters ?
Cheers Thomas
Upvotes: 1
Views: 2498
Reputation: 371
OK, figured it out: It actually works just like I configured it only I have forgotten the leading / in the volume path. So with
args `'-v yarn_cache:/usr/local/share/.cache/yarn'`
it works just fine..
Upvotes: 2