ContainerListenDecorator#2837
Draft
jglick wants to merge 42 commits into
Draft
Conversation
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`
This comment was marked as resolved.
This comment was marked as resolved.
…a custom `workingDir`
… a Decl stage using `defaultContainer`
…ndLine` or equivalent
jglick
commented
May 26, 2026
| 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/\"", |
Member
Author
There was a problem hiding this comment.
Was too strict: this particular format dates to #68 but differs from the usual style in Jenkins core.
This comment was marked as resolved.
This comment was marked as resolved.
…nce`: fail more clearly if `container` called with a nonexistent name
… into ContainerStepExecution
…MPLIANT_ENV_VAR`
…fused by an unrelated `script.sh`
… getting `KubernetesPipelineTest#runInPodWithDifferentShell` to pass requires jenkinsci/durable-task-plugin#561 (see jenkinsci#871).
…tly, but getting `KubernetesPipelineTest#runInPodWithDifferentShell` to pass requires jenkinsci/durable-task-plugin#561 (see jenkinsci#871)." This reverts commit ee5a90b. Retaining the production code fix but reverting the test changes, which would require more complex upstream fixes to `durable-task`. The behavior is anyway somewhat marginal: the shell is rarely customized, and this is only about helpful error reporting when it is wrong.
jglick
commented
Jul 13, 2026
|
|
||
| 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** |
jglick
commented
Jul 13, 2026
| protected static final String GLOBAL = "GLOBAL"; | ||
|
|
||
| @SuppressWarnings("unused") | ||
| @RegisterExtension |
jglick
commented
Jul 13, 2026
| "go version go1.6.3", r.assertBuildStatusSuccess(r.waitForCompletion(createJobThenScheduleRun()))); | ||
| } | ||
|
|
||
| // TODO missing test coverage (compare https://github.com/jenkinsci/kubernetes-plugin/pull/2837/commits): |
Member
Author
There was a problem hiding this comment.
Giving up for now on the notion of automatically running all other tests using the container step with this flag both off and on.
jglick
commented
Jul 13, 2026
| """ | ||
| // see runInPod.groovy | ||
| sh ''' | ||
| echo "script file: $(find ../../.. -path '*@tmp/durable-*/script.sh'))" |
Member
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2832.
BindExceptionincreateWebServerjenkins-test-harness#1175LAUNCH_DIAGNOSTICSbehavior durable-task-plugin#561 but Revert "ImprovedLAUNCH_DIAGNOSTICSbehavior" durable-task-plugin#568KubernetesCloudflagcontainerstep? (Migrate tests to JUnit5 #1734 first)