Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and document environment inside container step with current shortcomings #1486

Merged
merged 4 commits into from
Dec 21, 2023

Conversation

Vlatombe
Copy link
Member

Testing done

Submitter checklist

Preview Give feedback

@Vlatombe Vlatombe force-pushed the container-withMaven-env branch from 17ef480 to 6a7ea48 Compare December 20, 2023 14:06
@Vlatombe Vlatombe added the test Tests label Dec 20, 2023
@jglick
Copy link
Member

jglick commented Dec 20, 2023

I suspect the problem is that some code such as

EnvVars environment = computer.getEnvironment();
if (environment != null) {
Set<String> overriddenKeys = new HashSet<>();
for (String keyValue : envVars) {
String[] split = keyValue.split("=", 2);
if (!split[1].equals(environment.get(split[0]))) {
// Only keep environment variables that differ from Computer's environment
resultEnvVar.add(keyValue);
overriddenKeys.add(split[0]);
}
}
does not belong in this class at all, and should instead be in
EnvironmentExpander env = EnvironmentExpander.merge(
getContext().get(EnvironmentExpander.class),
EnvironmentExpander.constant(Collections.singletonMap("POD_CONTAINER", containerName)));
#1486 (comment) might make this more apparent.

@Vlatombe Vlatombe marked this pull request as ready for review December 21, 2023 08:27
@Vlatombe Vlatombe requested a review from a team as a code owner December 21, 2023 08:27
@Vlatombe Vlatombe changed the title Checking that environment is the one we expect inside container() step Test and document environment inside container() step with current shortcomings Dec 21, 2023
@Vlatombe Vlatombe changed the title Test and document environment inside container() step with current shortcomings Test and document environment inside container step with current shortcomings Dec 21, 2023
@Vlatombe Vlatombe merged commit 3954583 into jenkinsci:master Dec 21, 2023
6 checks passed
@Vlatombe Vlatombe deleted the container-withMaven-env branch January 8, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants