jenkinsci / docker-plugin

Jenkins cloud plugin that uses Docker
https://plugins.jenkins.io/docker-plugin/
MIT License
490 stars 318 forks source link

NPE in DockerComputerJNLPConnector.beforeContainerCreated starting with Jenkins 2.437 #1047

Closed akomakom closed 7 months ago

akomakom commented 8 months ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.443 OS: Linux - 4.18.0-408.el8.x86_64 Java: 11.0.20.1 - Azul Systems, Inc. (OpenJDK 64-Bit Server VM) --- Matrix-sorter-plugin:1.3 PrioritySorter:5.1.0 ace-editor:1.1 analysis-model-api:11.15.0 ansicolor:1.0.4 ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 apache-httpcomponents-client-5-api:5.3.1-1.0 aqua-security-scanner:3.2.5 async-http-client:1.9.40.0 audit-trail:361.v82cde86c784e authentication-tokens:1.53.v1c90fd9191a_b_ aws-credentials:218.v1b_e9466ec5da_ aws-java-sdk:1.12.633-430.vf9a_e567a_244f aws-java-sdk-cloudformation:1.12.633-430.vf9a_e567a_244f aws-java-sdk-codebuild:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ec2:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ecr:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ecs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-efs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-elasticbeanstalk:1.12.633-430.vf9a_e567a_244f aws-java-sdk-iam:1.12.633-430.vf9a_e567a_244f aws-java-sdk-kinesis:1.12.633-430.vf9a_e567a_244f aws-java-sdk-logs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-minimal:1.12.633-430.vf9a_e567a_244f aws-java-sdk-secretsmanager:1.12.633-430.vf9a_e567a_244f aws-java-sdk-sns:1.12.633-430.vf9a_e567a_244f aws-java-sdk-sqs:1.12.633-430.vf9a_e567a_244f aws-java-sdk-ssm:1.12.633-430.vf9a_e567a_244f azure-commons:1.1.3 azure-credentials:312.v0f3973cd1e59 azure-sdk:157.v855da_0b_eb_dc2 azure-vm-agents:901.ved986df424b_3 backup-interrupt-plugin:17.va_b_50ca_9df8d0 badge:1.9.1 basic-branch-build-strategies:81.v05e333931c7d blueocean:1.27.10 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.10 blueocean-commons:1.27.10 blueocean-config:1.27.10 blueocean-core-js:1.27.10 blueocean-dashboard:1.27.10 blueocean-display-url:2.4.2 blueocean-events:1.27.10 blueocean-git-pipeline:1.27.10 blueocean-github-pipeline:1.27.10 blueocean-i18n:1.27.10 blueocean-jira:1.27.10 blueocean-jwt:1.27.10 blueocean-personalization:1.27.10 blueocean-pipeline-api-impl:1.27.10 blueocean-pipeline-editor:1.27.10 blueocean-pipeline-scm-api:1.27.10 blueocean-rest:1.27.10 blueocean-rest-impl:1.27.10 blueocean-web:1.27.10 bootstrap4-api:4.6.0-6 bootstrap5-api:5.3.2-3 bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 branch-api:2.1144.v1425d1c3d5a_7 build-monitor-plugin:1.14-826.vb_a_c11536174d build-pipeline-plugin:2.0.1 build-timeout:1.32 build-with-parameters:76.v9382db_f78962 buildgraph-view:1.8 bulk-builder:1.5 caffeine-api:3.1.8-133.v17b_1ff2e0599 checkmarx:2023.4.3 checks-api:2.0.2 chucknorris:159.vdfe649cb_9c37 claim:516.v36293563731d cloud-stats:336.v788e4055508b_ cloudbees-bitbucket-branch-source:866.vdea_7dcd3008e cloudbees-folder:6.901.vb_4c7a_da_75da_3 command-launcher:107.v773860566e2e commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-95.v22a_d30ee5d36 conditional-buildstep:1.4.3 config-autorefresh-plugin:1.0 config-file-provider:968.ve1ca_eb_913f8c configurationslicing:548.ve92d48e66b_f8 copyartifact:722.v0662a_9b_e22a_c credentials:1319.v7eb_51b_3a_c97b_ credentials-binding:657.v2b_19db_7d6e6d cvs:2.19.1 dashboard-view:2.495.v07e81500c3f2 data-tables-api:1.13.8-2 database:230.v701f20b_8b_f95 database-h2:1.4.97.v8b_21e67e883a_ database-mysql:63.va_0596d2b_1438 database-postgresql:100.v2418e0a_c6909 delivery-pipeline-plugin:1.4.2 dependency-check-jenkins-plugin:5.4.4 dependency-track:4.3.1 dependencyanalyzer:0.7 depgraph-view:1.0.5 description-setter:239.vd0a_6b_785f92d disable-github-multibranch-status:1.2 discard-old-build:1.07 disk-usage:1.2 display-url-api:2.200.vb_9327d658781 docker-build-publish:1.4.0 docker-commons:439.va_3cb_0a_6a_fb_29 docker-java-api:3.3.4-86.v39b_a_5ede342c docker-plugin:1.5 docker-workflow:572.v950f58993843 durable-task:547.vd1ea_007d100c dynamic-axis:1.0.3 ec2:1648.vf3d852e00486 echarts-api:5.4.3-2 elastic-axis:464.va_7ed499b_9d75 email-ext:2.104 envinject:2.908.v66a_774b_31d93 envinject-api:1.199.v3ce31253ed13 extended-read-permission:53.v6499940139e5 external-monitor-job:215.v2e88e894db_f8 extra-columns:1.26 fail-the-build-plugin:5.v153b_2c826ef0 favicon:1.0-SNAPSHOT (private-10/07/2015 15:51-akom) favorite:2.208.v91d65b_7792a_c font-awesome-api:6.5.1-2 forensics-api:2.3.0 git:5.2.1 git-client:4.6.0 git-server:114.v068a_c7cc2574 github:1.38.0 github-api:1.318-461.v7a_c09c9fa_d63 github-branch-source:1772.va_69eda_d018d4 github-scm-trait-notification-context:40.vfa_7f31a_b_d7f8 global-post-script:1.1.4 google-oauth-plugin:1.330.vf5e86021cb_ec gradle:2.9 groovy:457.v99900cb_85593 groovy-postbuild:228.vcdb_cf7265066 gson-api:2.10.1-15.v0d99f670e0a_7 h2-api:11.1.4.199-12.v9f4244395f7a_ handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 heavy-job:1.1 htmlpublisher:1.32 hudson-pview-plugin:1.8 ignore-committer-strategy:1.0.4 implied-labels:295.v770c54615e6a_ instance-identity:185.v303dc7c645f9 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.16.1-373.ve709c6871598 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.9-1 jdk-tool:73.vddf737284550 jenkins-design-language:1.27.10 jersey2-api:2.41-133.va_03323b_a_1396 jira:3.12 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.18-1 job-dsl:1.87 job-import-plugin:3.6 job-restrictions:0.8 jobConfigHistory:1229.v3039470161a_d joda-time-api:2.12.6-21.vca_fd74418fb_7 join:1.21 jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.7.1-1 jsch:0.2.16-86.v42e010d9484b_ json-path-api:2.9.0-33.v2527142f2e1d junit:1259.v65ffcef24a_88 junit-attachments:205.vc0677977deb_0 kubernetes:4186.v1d804571d5d4 kubernetes-cli:1.12.1 kubernetes-client-api:6.10.0-240.v57880ce8b_0b_2 kubernetes-credentials:0.11 kubernetes-credentials-provider:1.258.v95949f923a_a_e label-linked-jobs:6.0.1 ldap:711.vb_d1a_491714dc lockable-resources:1232.v512d6c434eb_d m2release:0.16.4 mailer:463.vedf8358e006b_ mapdb-api:1.0.9-28.vf251ce40855d mask-passwords:173.v6a_077a_291eb_5 matrix-auth:3.2.1 matrix-groovy-execution-strategy:1.0.8 matrix-project:822.824.v14451b_c0fd42 mattermost:3.1.3 maven-plugin:3.23 mercurial:1260.vdfb_723cdcc81 metrics:4.2.21-449.v6960d7c54c69 mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_ mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_ momentjs:1.1.1 monitoring:1.95.0 multi-slave-config-plugin:1.2.0 mysql-api:8.3.0-21.v2837a_a_360d57 naginator:1.436.vb_e769dcb_cdf6 next-build-number:1.8 node-iterator-api:55.v3b_77d4032326 nodejs:1.6.1 nunit:485.ve8a_85357320d oauth-credentials:0.646.v02b_66dc03d2e okhttp-api:4.11.0-172.vda_da_1feeb_c6e pam-auth:1.10 parameterized-trigger:787.v665fcf2a_830b_ periodic-reincarnation:1.13 permissive-script-security:0.7 pipeline-aggregator-view:1.15 pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:704.vc58b_8890a_384 pipeline-input-step:489.v4b_70b_ff92d67 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2175.v76a_fff0a_2618 pipeline-model-definition:2.2175.v76a_fff0a_2618 pipeline-model-extensions:2.2175.v76a_fff0a_2618 pipeline-rest-api:2.34 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2175.v76a_fff0a_2618 pipeline-stage-view:2.34 pipeline-utility-steps:2.16.1 plain-credentials:143.v1b_df8b_d3b_e48 plugin-usage-plugin:4.2 plugin-util-api:3.8.0 popper-api:1.16.1-3 popper2-api:2.11.6-4 postbuild-task:1.9 postgresql-api:42.6.0-31.vb_7e76dc13969 prism-api:1.29.0-10 promoted-builds:945.v597f5c6a_d3fd publish-over:0.22 publish-over-ftp:1.17 pubsub-light:1.18 rebuild:330.v645b_7df10e2a_ release:2.19 resource-disposer:0.23 run-condition:1.7 scm-api:683.vb_16722fb_b_80b_ script-security:1321.va_73c0795b_923 scriptler:348.v5d461e205da_a_ sectioned-view:1.26 seed:2.1.4 sidebar-link:2.4.1 simple-theme-plugin:176.v39740c03a_a_f5 slave-setup:1.16 snakeyaml-api:2.2-111.vc6598e30cc65 sonar:2.17.1 sse-gateway:1.26 ssh:2.6.1 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.948.vb_8050d697fec sshd:3.322.v159e91f6a_550 startup-trigger-plugin:2.9.4 structs:337.v1b_04ea_4df7c8 subversion:2.17.3 support-core:1375.va_256158e8881 swarm:3.44 template-project:1.5.2 testng-plugin:835.v51ed3da_fcc35 thinBackup:1.18 timestamper:1.26 token-macro:400.v35420b_922dcb_ translation:1.16 trilead-api:2.133.vfb_8a_7b_9c5dd1 uno-choice:2.8.1 unreliable-slave-plugin:1.3-SNAPSHOT (private-12/28/2017 14:24-akom) uptime:1.0 variant:60.v7290fc0eb_b_cd view-job-filters:369.ve0513a_a_f5524 warnings-ng:10.7.0 windows-slaves:1.8.1 workflow-aggregator:596.v8c21c963d92d workflow-api:1291.v51fd2a_625da_7 workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3853.vb_a_490d892963 workflow-cps-global-lib:612.v55f2f80781ef workflow-durable-task-step:1327.ve57634fb_09ce workflow-job:1400.v7fd111b_ec82f workflow-multibranch:773.vc4fe1378f1d5 workflow-scm-step:415.v434365564324 workflow-step-api:657.v03b_e8115821b_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

CentOS Stream 8 on master (also same results when running Jenkins in a container) Docker Classic Swarm: Version = swarm/1.2.9, API Version = 1.30

Reproduction steps

The following works with Jenkins up to 2.437 but fails as follows:

  1. Install Docker Plugin 1.5 in Jenkins 2.444
  2. Create a new cloud. In my case, it points to a Docker Classic Swarm manager port tunnelled via SSH from localhost.
  3. Create a template. In my case, it uses a custom built Jenkins slave image using "Connect with JNLP" connect method, but jenkins/inbound-agent yields the same results.
Docker Cloud Definition ```xml Docker-Swarm-Classic 2 container docker dockerswarm centos centos9 linux linux64 mem12 mem16 mem32 /data/jenkins-slave 15 EXCLUSIVE 10 some-host:5000/jenkins-centos-9-java type=bind,source=/nfs00,destination=/nfs00 type=bind,source=/nfs00,destination=/nfs00-ro,readonly false 32000 -1 0 0 false false host.docker.internal:host-gateway false 10 PULL_ALWAYS 300 false docker-centos9 tcp://localhost:2375 10 30 10 true false ```

Expected Results

Container should get provisioned (as they do with Jenkins up to 2.437)

Actual Results

Container is not provisioned. The following is in the Jenkins master log:

Feb 04, 2024 10:57:43 PM INFO io.jenkins.docker.client.DockerAPI getOrMakeClient
Cached connection io.jenkins.docker.client.DockerAPI$SharableDockerClient@89fddee to DockerClientParameters{dockerUri='tcp://localhost:2375', credentialsId='null', readTimeoutInMsOrNull=30000, connectTimeoutInMsOrNull=10000}
Feb 04, 2024 10:57:43 PM INFO com.nirima.jenkins.plugins.docker.DockerCloud canAddProvisionedAgent
Provisioning 'some-host:5000/jenkins-centos-9-java' number 1 (of 15) on 'Docker-Swarm-Classic'; Total containers: 0 (of 10)
Feb 04, 2024 10:57:43 PM INFO com.nirima.jenkins.plugins.docker.DockerCloud provision
Will provision 'some-host:5000/jenkins-centos-9-java', for label: 'dockerswarm&&centos', in cloud: 'Docker-Swarm-Classic'
Feb 04, 2024 10:57:43 PM INFO com.nirima.jenkins.plugins.docker.DockerTemplate pullImage
Pulling image 'some-host:5000/jenkins-centos-9-java:latest'. This may take awhile...
Feb 04, 2024 10:57:43 PM INFO hudson.slaves.NodeProvisioner$StandardStrategyImpl apply
Started provisioning docker-centos9 (some-host:5000/jenkins-centos-9-java) from Docker-Swarm-Classic with 1 executors. Remaining excess workload: 0
Feb 04, 2024 10:57:43 PM INFO io.jenkins.docker.client.DockerAPI getOrMakeClient
Cached connection io.jenkins.docker.client.DockerAPI$SharableDockerClient@13322a40 to DockerClientParameters{dockerUri='tcp://localhost:2375', credentialsId='null', readTimeoutInMsOrNull=300000, connectTimeoutInMsOrNull=10000}
Feb 04, 2024 10:57:43 PM INFO com.nirima.jenkins.plugins.docker.DockerTemplate pullImage
Finished pulling image 'some-host:5000/jenkins-centos-9-java:latest', took 69 ms
Feb 04, 2024 10:57:43 PM INFO com.nirima.jenkins.plugins.docker.DockerTemplate doProvisionNode
Trying to run container for image "some-host:5000/jenkins-centos-9-java"
Feb 04, 2024 10:57:43 PM SEVERE com.nirima.jenkins.plugins.docker.DockerCloud$1 run
Error in provisioning; template='DockerTemplate{configVersion=2, labelString='container docker dockerswarm centos centos9 linux linux64 mem12 mem16 mem32', 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, extraHosts=[host.docker.internal:host-gateway]}, removeVolumes=false, stopTimeout=10, pullStrategy=PULL_ALWAYS, pullTimeout=300, disabled=BySystem,0 ms,4 min 59 sec,Template provisioning failed., name='docker-centos9'}' for cloud='Docker-Swarm-Classic'
java.lang.NullPointerException
    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(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Feb 04, 2024 10:57:43 PM WARNING jenkins.util.ErrorLoggingExecutorService lambda$wrap$0
null
java.lang.NullPointerException
    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(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

Anything else?

I attempted to downgrade the docker plugin to 1.2.10 (The only option I had), but that version isn't compatible with the latest Docker API plugin (Class Not Found type errors), and Jenkins doesn't offer a downgrade for the API plugin.

Everything works on another Jenkins installation that has not been upgraded (Docker Plugin 1.2.10 on Jenkins 2.376)

Are you interested in contributing a fix?

I am happy to contribute a fix if someone can help me figure out what's failing here. The exception seem to point to this line which is odd, but if it in fact means line 202 then jnlpLauncher must be null. Why?

akomakom commented 8 months ago

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

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

akomakom commented 8 months ago

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
jglick commented 8 months ago

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

No, because Java 17 improves NPEs generally.

https://github.com/jenkinsci/docker-plugin/blob/84cce22cfd3c9ef67a501a2d969ff7c7f21556b6/src/main/java/io/jenkins/docker/connector/DockerComputerJNLPConnector.java#L201-L202 suggests that https://github.com/jenkinsci/docker-plugin/blob/84cce22cfd3c9ef67a501a2d969ff7c7f21556b6/src/main/java/io/jenkins/docker/connector/DockerComputerJNLPConnector.java#L59-L62 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 https://github.com/jenkinsci/remoting/pull/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. https://github.com/jenkinsci/docker-plugin/blob/84cce22cfd3c9ef67a501a2d969ff7c7f21556b6/src/main/java/io/jenkins/docker/connector/DockerComputerJNLPConnector.java#L240-L245 https://github.com/jenkinsci/docker-plugin/blob/84cce22cfd3c9ef67a501a2d969ff7c7f21556b6/src/main/java/io/jenkins/docker/connector/DockerComputerJNLPConnector.java#L169-L172 could be made just a generic thing a user could customize.

akomakom commented 8 months ago

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.

jglick commented 8 months ago

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

Looks like there is already https://github.com/jenkinsci/docker-plugin/blob/84cce22cfd3c9ef67a501a2d969ff7c7f21556b6/src/main/resources/io/jenkins/docker/connector/DockerComputerJNLPConnector/config.jelly#L27-L29 which ought to suffice for -tunnel as well as any of the other supported options, so it would suffice to just delete https://github.com/jenkinsci/docker-plugin/blob/84cce22cfd3c9ef67a501a2d969ff7c7f21556b6/src/main/resources/io/jenkins/docker/connector/DockerComputerJNLPConnector/config.jelly#L31 and deprecate the associated field (leave for settings compatibility) and switch to a @DataBoundSetter.

MarkEWaite commented 8 months ago

could draft a PR if you like

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

larsskj commented 7 months ago

We're hit severely by this as well.

jglick commented 7 months ago

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.

akomakom commented 7 months ago

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)