Currently I have a pipeline working something like this:
pipeline {
agent {
docker {
label 'linux'
image 'java:8'
args '-v /home/tester/.gradle:/.gradle'
}
}
environment {
HOME = '/'
GRADLE_USER_HOME = '/.gradle'
GRADLE_PROPERTIES = credentials('gradle.properties')
}
stages {
stage('Build') {
steps {
sh 'cp ${GRADLE_PROPERTIES} ${GRADLE_USER_HOME}/'
sh './gradlew clean check'
}
}
}
}
Problem is, gradle.properties ends up being put in a more known location on the host system for the duration of the build.
I know that Docker lets me 'mount' files from the host. So I'd like to do this instead:
agent {
docker {
label 'linux'
image 'java:8'
args '-v /home/tester/.gradle:/.gradle ' +
'-v ' + credentials('gradle.properties') +
':/.gradle/gradle.properties'
}
}
Unfortunately, this ends up running this:
$ docker run -t -d -u 1001:1001 -v /home/tester/.gradle:/.gradle -v @credentials(<anonymous>=gradle.properties):/.gradle/gradle.properties -w
Is there a way to have it expand it?