Hi,
Our team is using Jenkins declarative pipeline with docker agent as a CI
job.
The behavior appears to be that the docker agent setup is always attempts
to pull the latest image from the docker registry.
Is it possible to disable this check and always use the cached image from
the local docker image repo?
I checked the source code and it appears that the logic is always to pull
the image from the docker registry.
Can someone with more insight and experience with the declarative pipeline
confirm? Also if we want to add the feature to disable this check based on
jenkins configuration property, can someone provide guidance on what needs
to be done?
Thanx in advance.
public class DockerPipelineScript extends
AbstractDockerPipelineScript<DockerPipeline> {
public DockerPipelineScript(CpsScript s, DockerPipeline a) {
super(s, a)
}
@Override
public Closure runImage(Closure body) {
return {
if (!Utils.withinAStage()) {
script.stage(SyntheticStageNames.agentSetup()) {
try {
script.getProperty("docker").image(describable.image).pull()
} catch (Exception e) {
script.getProperty("currentBuild").result =
Utils.getResultFromException(e)
Utils.markStageFailedAndContinued(SyntheticStageNames.agentSetup())
throw e
}
}
}
try {
if (Utils.withinAStage()) {
script.getProperty("docker").image(describable.image).pull()
}
script.getProperty("docker").image(describable.image).inside(describable.args, {
body.call()
})
} catch (Exception e) {
script.getProperty("currentBuild").result =
Utils.getResultFromException(e)
throw e
}
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/57d2aad9-212a-4bbc-b2d2-659e5ebd6c4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.