jenkinsci / docker-agent

Jenkins agent (base image) and inbound agent Docker images
https://hub.docker.com/r/jenkins/inbound-agent/
MIT License
282 stars 228 forks source link

jenkins-agent.ps1 is missing in jenkins/agent:jdk17-nanoserver-ltsc2022 #834

Closed MarcoGrimmeissen closed 1 month ago

MarcoGrimmeissen commented 1 month ago

Jenkins and plugins versions report

Environment ```text Not necessary for this issue ```

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

We are using Kubernetes plugin for Jenkins to run build pods on a RKE2 Cluster with Windows (Server 2022) and Linux (Ubuntu 24.04) nodes. Currently we are testing this setup.

We want to use jenkins/agent:jdk17-nanoserver-ltsc2022 as agent container

TL;DR

Reproduction steps

  1. Define a pod template in Kubernetes plugin for Jenkins
  2. Configure a custom jnlp container
  3. Set ${computer.jnlpmac} ${computer.name} in Arguments
  4. Run a job

Or start the container with docker run -it jenkins/agent:jdk17-nanoserver-ltsc2022 . A cmd.exe is started instead of the ps script

Expected Results

${computer.jnlpmac} ${computer.name} are interpreted by the jenkins-agent.ps1 PowerShell script because it is configured as entry point of jenkins/agent:jdk17-nanoserver-ltsc2022

Actual Results

The kubernetes pod is terminated, because the jnlp container fails to start. Reason: cmd.exe is the defined entry point and the default arguments defined in the template make obviosly no sense for cmd.exe

Anything else?

It is caused by a failing copy command in Line 133 of the Dockerfile in windows/nanoserver/.

Are you interested in contributing a fix?

No response

lemeurherve commented 1 month ago

You have to use the jenkins/inbound-agent:jdk17-nanoserver-ltsc2022 inbound-agent image instead of the agent one, cf https://github.com/jenkinsci/docker-agent/blob/7b32976be8ff33dabfd3652f2e16b55c1a7558db/windows/nanoserver/Dockerfile#L131-L133

The agent image isn't meant to be used as agent except in that case: https://github.com/jenkinsci/docker-agent/blob/master/README_agent.md#usage