Skip to content

Conversation

adpg24
Copy link

@adpg24 adpg24 commented Jun 25, 2025

On release 4350.va_0283de0d6d6 the following PR was included #1699.

The container logs were still not visible through the UI so I logged the following issue: https://issues.jenkins.io/browse/JENKINS-75787

Testing done

There were no existing unit tests, so I didn't bother creating new tests. I tested the plugin by running a minikube setup locally, must of the setup comes from the README.

  • Install the Kubernetes plugin dependencies
  • Copy the kubernetes.hpi file into /var/jenkins_home/plugins/
  • Configure a Kubernetes cloud
  • Run a Jenkins job with the podTemplate step function

This is the Jenkinsfile used for testing:

def pod = """
apiVersion: "v1"
kind: "Pod"
metadata:
spec:
  containers:
  - name: jnlp
    env:
    - name: CONTAINER_ENV_VAR
      value: jnlp
  - name: nginx
    env:
    - name: CONTAINER_ENV_VAR
      value: nginx
    image: nginx:latest
    ports:
    - containerPort: 80
"""

podTemplate(label: "container-logs", yaml: pod, idleMinutes: 10) {
	node("container-logs") {
		stage("Test container logs") {
		    script {
			echo "Hello from my pod"
		    }
		}
	}
}

Once a pod has been created I can follow the link in the console logs of the job:

Created Pod: Kubernetes kubernetes-plugin/container-logs-r0s74-vlgkd
[PodInfo] kubernetes-plugin/container-logs-r0s74-vlgkd
	Container [jnlp] waiting [ContainerCreating] No message
	Container [nginx] waiting [ContainerCreating] No message
	Pod [Pending][ContainersNotReady] containers with unready status: [jnlp nginx]
Agent container-logs-r0s74-vlgkd is provisioned from template container-logs-r0s74

The container logs can now be viewed from the UI. The screenshot below shows the JNLP container logs.
Screenshot from 2025-06-25 14-41-31

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@adpg24 adpg24 requested a review from a team as a code owner June 25, 2025 12:44
@Vlatombe
Copy link
Member

There were no existing unit tests

Since this regressed, now is probably a good time to introduce such tests!

@adpg24 adpg24 force-pushed the fix/kubernetes-container-logs branch from 7451f8a to cee76b3 Compare June 25, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants