| FilePath.installIfNecessaryFrom, used from ZipExtractionInstaller, is designed to check if target already exists before downloading from remote URL. But I observe that every time I run the build job, the tool is downloaded from remote URL even if the files exists in local $JENKINS_HOME/tools directory. No exception raised while processing. Simple test pipeline to reproduce issue:
pipeline {
agent any
tools {
maven "M3"
jdk "JDK8_161"
}
stages {
stage('Test') {
steps {
echo 'Testing..'
}
}
}
}
*Job output logs for this example *:
[Pipeline] node Running on Jenkins in /var/jenkins_home/workspace/test [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Tool Install) [Pipeline] tool [Pipeline] envVarsForTool [Pipeline] tool Unpacking https://<repo>.box.com/shared/static/rczslq4dc79l3ylhuoxhlje4kiu2iu7o.gz to /var/jenkins_home/tools/hudson.model.JDK/JDK8_161 on Jenkins [Pipeline] envVarsForTool Unpacking https://<repo>.box.com/shared/static/rczslq4dc79l3ylhuoxhlje4kiu2iu7o.gz to /var/jenkins_home/tools/hudson.model.JDK/JDK8_161 on Jenkins [Pipeline] } [Pipeline] // stage [Pipeline] withEnv [Pipeline] { [Pipeline] stage [Pipeline] { (Test) [Pipeline] tool [Pipeline] envVarsForTool [Pipeline] tool Unpacking https://<repo>.box.com/shared/static/rczslq4dc79l3ylhuoxhlje4kiu2iu7o.gz to /var/jenkins_home/tools/hudson.model.JDK/JDK8_161 on Jenkins [Pipeline] envVarsForTool Unpacking https://<repo>.box.com/shared/static/rczslq4dc79l3ylhuoxhlje4kiu2iu7o.gz to /var/jenkins_home/tools/hudson.model.JDK/JDK8_161 on Jenkins [Pipeline] withEnv [Pipeline] { [Pipeline] echo Testing.. [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
Tools auto-installer configuration :
We can see that M3 is not downloaded because it's already existing in $JENKINS_HOME/tools. But JDK8_161 is downloaded every time I run the job. |