Code Monkey home page Code Monkey logo

Comments (9)

jglick avatar jglick commented on September 13, 2024 1

review a pull request

#1049. Would ideally be tested by a real user affected by the NPE. The inbound connector is not the default, is trickier to set up, and seems to have less test coverage.

from docker-plugin.

akomakom avatar akomakom commented on September 13, 2024

I've now reproduced the issue with a clean Jenkins setup in docker ( jenkins/jenkins:latest which is 208bdf1be3b9 and Jenkins 2.444)

  • docker run --name jenkins-server -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins
  • Go through setup wizard and Install default plugins.
  • Install docker plugin (v1.5 currently).
  • Add a cloud and one template (see xml included earlier).
  • Run a job using labels defined for the template.

Jenkins log contains:

Feb 06, 2024 3:52:08 PM INFO com.nirima.jenkins.plugins.docker.DockerTemplate doProvisionNode

Trying to run container for image "some-host:5000/jenkins-centos-9-java"

Feb 06, 2024 3:52:08 PM SEVERE com.nirima.jenkins.plugins.docker.DockerCloud$1 run

Error in provisioning; template='DockerTemplate{configVersion=2, labelString='centos centos9 dockerswarm', connector=DockerComputerJNLPConnector{}, remoteFs='/data/jenkins-slave', instanceCap=15, mode=EXCLUSIVE, retentionStrategy=com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy@29, dockerTemplateBase=DockerTemplateBase{image='some-host:5000/jenkins-centos-9-java', mounts=[type=bind,source=/nfs00,destination=/nfs00, type=bind,source=/nfs00,destination=/nfs00-ro,readonly], bindAllPorts=false, memoryLimit=32000, memorySwap=-1, cpuPeriod=0, cpuQuota=0, privileged=false, tty=false}, removeVolumes=false, stopTimeout=0, pullStrategy=PULL_ALWAYS, pullTimeout=300, disabled=BySystem,0 ms,4 min 59 sec,Template provisioning failed., name='jenkins-centos9'}' for cloud='tc-docker-swarm'
java.lang.NullPointerException: Cannot read field "tunnel" because "this.jnlpLauncher" is null
	at io.jenkins.docker.connector.DockerComputerJNLPConnector.beforeContainerCreated(DockerComputerJNLPConnector.java:201)
	at com.nirima.jenkins.plugins.docker.DockerTemplate.doProvisionNode(DockerTemplate.java:729)
	at com.nirima.jenkins.plugins.docker.DockerTemplate.provisionNode(DockerTemplate.java:682)
	at com.nirima.jenkins.plugins.docker.DockerCloud$1.run(DockerCloud.java:414)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
	at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

The wording of the NPE is slightly different, perhaps changed in 2.443->2.444

from docker-plugin.

akomakom avatar akomakom commented on September 13, 2024

I've also confirmed that using a clean in-docker installation of Jenkins 2.376 with the latest docker plugin (1.4 for that version) works fine.

Summary of my tests so far:

Jenkins Plugin Result Notes
2.376 1.4 Works
2.436 1.5 Works
2.437 1.5 NPE Suspecting jenkinsci/jenkins#8762 as the cause
2.443 1.4 NPE
2.444 1.5 NPE

from docker-plugin.

jglick avatar jglick commented on September 13, 2024

The wording of the NPE is slightly different, perhaps changed in 2.443->2.444

No, because Java 17 improves NPEs generally.

final EnvVars knownVariables =
calculateVariablesForVariableSubstitution(nodeName, secret, jnlpLauncher.tunnel, effectiveJenkinsUrl);
suggests that
@DataBoundConstructor
public DockerComputerJNLPConnector(JNLPLauncher jnlpLauncher) {
this.jnlpLauncher = jnlpLauncher;
}
is being passed null, perhaps because Jenkins form binding does not even bother passing an object with no arguments. (If true, existing installations or those using JCasC would be unaffected.) Try e.g.

this.jnlpLauncher = jnlpLauncher != null ? jnlpLauncher : new JNLPLauncher(false);

Better yet, bump the minimum Jenkins version to one including jenkinsci/remoting#677 and stop using a JNLPLauncher field at all; rewrite to just take a text field for list of agent.jar options. AFAICT it is being used only for the -tunnel option.

case TunnelArgument:
argValue = StringUtils.isNotBlank(jnlpTunnel) ? "-tunnel" : "";
break;
case TunnelValue:
argValue = jnlpTunnel;
break;
TunnelArgument(
"TUNNEL_ARG",
"If a JNLP tunnel has been specified then this evaluates to '-tunnel', otherwise it evaluates to the empty string"), //
TunnelValue("TUNNEL", "The JNLP tunnel value");
could be made just a generic thing a user could customize.

from docker-plugin.

akomakom avatar akomakom commented on September 13, 2024

Thanks @jglick .
I am a little out of my depth, so I'm hoping that you are either addressing docker plugin maintainers or are willing to hold my hand as I try to make a PR to fix this.

from docker-plugin.

jglick avatar jglick commented on September 13, 2024

CC @MarkEWaite since you appear to be active here; could draft a PR if you like.

Looks like there is already

<f:entry title="${%EntryPoint Arguments}" field="entryPointArgumentsString">
<f:expandableTextbox />
</f:entry>
which ought to suffice for -tunnel as well as any of the other supported options, so it would suffice to just delete and deprecate the associated field (leave for settings compatibility) and switch to a @DataBoundSetter.

from docker-plugin.

MarkEWaite avatar MarkEWaite commented on September 13, 2024

could draft a PR if you like

I'm happy to review a pull request if you're willing to submit it

from docker-plugin.

larsskj avatar larsskj commented on September 13, 2024

We're hit severely by this as well.

from docker-plugin.

akomakom avatar akomakom commented on September 13, 2024

review a pull request

#1049. Would ideally be tested by a real user affected by the NPE. The inbound connector is not the default, is trickier to set up, and seems to have less test coverage.

Works for me (see conversation in #1049)

from docker-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.