jenkins declarative pipeline using docker agent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

jenkins declarative pipeline using docker agent

Young Lee
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: jenkins declarative pipeline using docker agent

Jesse Glick-4
Just specify a tag and no network operation should be required once it is cached.

This is a users’ list question I think.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr246Hk9fdVsRGqcjTYT22fiv3eTTxNCN4_nrxVeGSbYEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.