jenkinsci / docker

Docker official jenkins repo
https://hub.docker.com/r/jenkins/jenkins
MIT License
6.67k stars 4.52k forks source link

jenkins/jenkins:latest does not reflect kubernetes jnlp image tag #1226

Closed schroedt closed 1 year ago

schroedt commented 2 years ago

Version report

Jenkins and plugins versions report:

Jenkins: 2.317
OS: Linux - 5.8.0-63-generic
---
ace-editor:1.1
alauda-devops-credentials-provider:2.4.1
alauda-kubernetes-support:2.3.0
ant:1.12
antisamy-markup-formatter:2.4
apache-httpcomponents-client-4-api:4.5.13-1.0
authentication-tokens:1.4
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.25.1
blueocean-commons:1.25.1
blueocean-config:1.25.1
blueocean-core-js:1.25.1
blueocean-dashboard:1.25.1
blueocean-display-url:2.4.1
blueocean-events:1.25.1
blueocean-git-pipeline:1.25.1
blueocean-github-pipeline:1.25.1
blueocean-i18n:1.25.1
blueocean-jwt:1.25.1
blueocean-personalization:1.25.1
blueocean-pipeline-api-impl:1.25.1
blueocean-pipeline-editor:1.25.1
blueocean-pipeline-scm-api:1.25.1
blueocean-rest:1.25.1
blueocean-rest-impl:1.25.1
blueocean-web:1.25.1
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.1-1
bouncycastle-api:2.25
branch-api:2.7.0
build-timeout:1.20
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-bitbucket-branch-source:2.9.11
cloudbees-folder:6.16
command-launcher:1.6
conditional-buildstep:1.4.1
config-file-provider:3.8.1
credentials:2.6.2
credentials-binding:1.27
display-url-api:2.3.5
docker-commons:1.17
docker-workflow:1.26
durable-task:1.39
echarts-api:5.2.1-2
email-ext:2.84
external-monitor-job:1.7
favorite:2.3.3
font-awesome-api:5.15.4-1
git:4.9.0
git-client:3.10.0
git-server:1.10
gitbucket:0.8
github:1.34.1
github-api:1.133
github-branch-source:2.11.3
google-oauth-plugin:1.0.6
gradle:1.37.1
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.27
jackson2-api:2.13.0-230.v59243c64b0a5
javadoc:1.6
jaxb:2.3.0.1
jdk-tool:1.5
jenkins-design-language:1.25.1
jjwt-api:0.11.2-9.c8b45b8bb173
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.53
keycloak:2.3.0
kubernetes:1.30.5
kubernetes-client-api:5.4.1
kubernetes-credentials:0.9.0
ldap:2.7
lockable-resources:2.12
mailer:1.34
mapdb-api:1.0.9.0
matrix-auth:2.6.8
matrix-project:1.19
maven-plugin:3.15
mercurial:2.15
metrics:4.0.2.8
momentjs:1.1.1
oauth-credentials:0.4
oic-auth:1.8
okhttp-api:3.14.9
pam-auth:1.6
parameterized-trigger:2.41
pipeline-build-step:2.15
pipeline-github-lib:1.0
pipeline-graph-analysis:1.11
pipeline-input-step:2.12
pipeline-milestone-step:1.3.2
pipeline-model-api:1.9.2
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:1.9.2
pipeline-model-extensions:1.9.2
pipeline-rest-api:2.19
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.9.2
pipeline-stage-view:2.19
plain-credentials:1.7
plugin-util-api:2.5.0
popper-api:1.16.1-2
popper2-api:2.10.2-1
publish-over:0.22
publish-over-ssh:1.22
pubsub-light:1.16
resource-disposer:0.16
role-strategy:3.2.0
run-condition:1.5
scm-api:2.6.5
script-security:1.78
simple-theme-plugin:0.7
snakeyaml-api:1.29.1
sse-gateway:1.24
ssh-credentials:1.19
ssh-slaves:1.33.0
sshd:3.1.0
strict-crumb-issuer:2.1.0
structs:1.23
subversion:2.15.0
timestamper:1.13
token-macro:266.v44a80cf277fd
trilead-api:1.0.13
variant:1.4
windows-slaves:1.8
workflow-aggregator:2.6
workflow-api:2.47
workflow-basic-steps:2.24
workflow-cps:2.94
workflow-cps-global-lib:2.21
workflow-durable-task-step:2.40
workflow-job:2.42
workflow-multibranch:2.26
workflow-scm-step:2.13
workflow-step-api:2.24
workflow-support:3.8
ws-cleanup:0.39
xframe-filter-plugin:1.2
jenkins/jenkins:latest
jenkins/inbound-agent:latest

Reproduction steps

Trigger a build of any project. Stated jenkins/inbound-agent:latest resolves to jenkins/inbound-agent:4.3.4-jdk11 (not correct) instead of 4.10-3-jdk11 (correct). grafik

Following https://plugins.jenkins.io/kubernetes/, I can overwrite the default agent image at Jenkinsfile (which resolves the issue of running an outdated container):

podTemplate(label: label, containers: [
  containerTemplate(name: 'jnlp', image: 'jenkins/inbound-agent:latest', args: '${computer.jnlpmac} ${computer.name}')
],

Results

Expected result:

JNLP is using latest or 4.10-3-jdk11 or newer (if available). Instead a tagged version is used, instead of configured one. I was able to update the container name jenkins-slave » jnlp. Tag is not updated.

Actual result:

Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  105s  default-scheduler  Successfully assigned jenkins/worker-afaffbf9-13f3-4c7c-8037-65a7afe4a386-qrqqw-wxvzs to kubernetes-worker01
  Normal  Pulling    103s  kubelet            Pulling image "lachlanevenson/k8s-kubectl:latest"
  Normal  Pulled     97s   kubelet            Successfully pulled image "lachlanevenson/k8s-kubectl:latest" in 5.981890343s
  Normal  Created    95s   kubelet            Created container kubectl
  Normal  Started    95s   kubelet            Started container kubectl
  Normal  Pulling    95s   kubelet            Pulling image "jenkins/inbound-agent:4.3-4-jdk11"
  Normal  Pulled     38s   kubelet            Successfully pulled image "jenkins/inbound-agent:4.3-4-jdk11" in 56.534006584s
  Normal  Created    16s   kubelet            Created container jnlp
  Normal  Started    15s   kubelet            Started container jnlp
  Normal  Killing    4s    kubelet            Stopping container kubectl
  Normal  Killing    4s    kubelet            Stopping container jnlp
MarkEWaite commented 2 years ago

This is still an issue. https://github.com/jenkinsci/docker-inbound-agent/releases shows that 4.13-2 is the most recent release, yet the output of the commands shows that jenkins/inbound-agent:latest is reporting version 4.10 instead of 4.13.

$ docker run --rm -i -t jenkins/inbound-agent:latest -version
4.10
$ docker run --rm -i -t jenkins/inbound-agent:4.13-2 -version
4.13

Expected output from docker run --rm -i -t jenkins/inbound-agent:latest -version is 4.13, not 4.10

ghost commented 2 years ago

The problem also manifests itself when deploying to the cloud using Helm.

The agent version specified in the podTemplate is ignored. It was revealed that the removal and re-deployment of Jenkins leads to an update of the used version of the agent. Which is probably equivalent to re-installing on the local machine.

Currently, the "jenkins/inbound-agent" version is used:4.11-1-jdk11". Despite the fact that the command: docker ru --rmit jenkins/inbound-agent:latest -version outputs "4.10".

Where does "4.11-1-jdk11" come from???

ghost commented 2 years ago

CasS outputs the version of the agent for deployment specified in the podTemplate.

ghost commented 2 years ago

Source code, Helm output, Jenkins configs non't contain "4.11-1-jdk11" (((

mattjwarren commented 1 year ago

is in not true that 'latest' does not refer to the latest version of an image?

https://vsupalov.com/docker-latest-tag/

dduportal commented 1 year ago

Hi, this issue is not related to the official Docker controller image but to the Kubernetes Plugin: there are no change in this repository that could help in the described problem.

Also, since May 2022, the Kubernetes plugin did regularly update the default image using the following Dockerfile: https://github.com/jenkinsci/kubernetes-plugin/blob/442524fea3d730812196f9fc5dd4d01109a255e9/src/main/resources/org/csanchez/jenkins/plugins/kubernetes/Dockerfile#L1

As such, I'm gonna close this issue as completed.

sagara00 commented 9 months ago

It works. In my case, Jenkins rebooted and updated automatically. I've updated the Docker image 4.13. but, It still shows the log below. You saved my ass. Thanks.

java.io.IOException: Agent version 4.13 or newer is required. at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:229) at hudson.remoting.Engine.innerRun(Engine.java:724) at hudson.remoting.Engine.run(Engine.java:540)

Hi, this issue is not related to the official Docker controller image but to the Kubernetes Plugin: there are no change in this repository that could help in the described problem.

Also, since May 2022, the Kubernetes plugin did regularly update the default image using the following Dockerfile: https://github.com/jenkinsci/kubernetes-plugin/blob/442524fea3d730812196f9fc5dd4d01109a255e9/src/main/resources/org/csanchez/jenkins/plugins/kubernetes/Dockerfile#L1

As such, I'm gonna close this issue as completed.