Skip to content

ContainerListenDecorator#2837

Draft
jglick wants to merge 42 commits into
jenkinsci:masterfrom
jglick:ContainerStepExecution
Draft

ContainerListenDecorator#2837
jglick wants to merge 42 commits into
jenkinsci:masterfrom
jglick:ContainerStepExecution

Conversation

@jglick

@jglick jglick commented May 20, 2026

Copy link
Copy Markdown
Member

Fixes #2832.

@jglick jglick added the enhancement Improvements label May 20, 2026
@jglick jglick changed the title Sketch of ContainerListenDecorator ContainerListenDecorator May 21, 2026
jglick and others added 13 commits May 21, 2026 12:06
Implement environment variable filtering to prevent the JNLP agent
container's environment from polluting target containers. Only export
variables that differ from the Computer's environment, allowing each
container to use its native environment (e.g., JAVA_HOME).

This matches the behavior in ContainerExecDecorator and fixes tests
like KubernetesDeclarativeAgentTest#declarative and
ContainerExecDecoratorPipelineTest#containerEnvironmentIsHonored.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ion was suppressed due to packing args in `command`
@jglick

This comment was marked as resolved.

r.waitForCompletion(b);
// docker login will fail but we can check that it runs the correct command
r.assertLogContains(
"Executing command: \"docker\" \"login\" \"-u\" \"myusername\" \"-p\" ******** \"https://index.docker.io/v1/\"",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was too strict: this particular format dates to #68 but differs from the usual style in Jenkins core.

@jglick

This comment was marked as resolved.

…nce`: fail more clearly if `container` called with a nonexistent name
Comment thread README.md

To execute commands in another container part of the pod (different from the one running the Jenkins agent), you can use the `container` step.

**Note**

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was misformatted

protected static final String GLOBAL = "GLOBAL";

@SuppressWarnings("unused")
@RegisterExtension

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgotten in #1734 I guess.

"go version go1.6.3", r.assertBuildStatusSuccess(r.waitForCompletion(createJobThenScheduleRun())));
}

// TODO missing test coverage (compare https://github.com/jenkinsci/kubernetes-plugin/pull/2837/commits):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving up for now on the notion of automatically running all other tests using the container step with this flag both off and on.

"""
// see runInPod.groovy
sh '''
echo "script file: $(find ../../.. -path '*@tmp/durable-*/script.sh'))"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sort of change is no longer strictly required here, as this PR is no longer running this test in activeContainers mode, but is desirable anyway, and would be needed in case this sort of test code were copied and pasted for ContainerListenDecoratorTest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redesigned ContainerExecDecorator

1 participant