Skip to content

Commit

Permalink
Command env is already inherited, so undo the unneccesary PATH assign…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
mars committed Dec 10, 2024
1 parent 0dd2602 commit 6978e39
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 1 addition & 6 deletions buildpacks/release-phase/src/bin/exec-release-commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ fn exec_release_sequence(commands_toml_path: &Path) -> Result<(), release_comman
if let Some(args) = release_build_config.args {
cmd.args(args.clone());
}
if let Ok(path) = env::var("PATH") {
cmd.env("PATH", path);
}

let status = cmd
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
Expand All @@ -63,9 +61,6 @@ fn exec_release_sequence(commands_toml_path: &Path) -> Result<(), release_comman
if let Some(args) = &config.args {
cmd.args(args.clone());
}
if let Ok(path) = env::var("PATH") {
cmd.env("PATH", path);
}

let status = cmd
.stdout(Stdio::inherit())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ args = ["-c", "echo 'Hello from Release Phase Buildpack!' && sleep 1 && echo 1 &

[[com.heroku.phase.release]]
command = "bash"
args = ["-c", "echo 'Hello again from Release Phase Buildpack!'"]
args = ["-c", "echo $TEST_ENV_INHERITED"]
7 changes: 5 additions & 2 deletions buildpacks/release-phase/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,18 @@ fn project_uses_release() {
assert_contains!(ctx.pack_stdout, "Successfully built image");
start_container_entrypoint(
&ctx,
&mut ContainerConfig::new(),
ContainerConfig::new().env(
"TEST_ENV_INHERITED",
"Container env is available to release command",
),
&"release".to_string(),
|container| {
let log_output = container.logs_now();
assert_contains!(log_output.stderr, "release-phase plan");
assert_contains!(log_output.stdout, "Hello from Release Phase Buildpack!");
assert_contains!(
log_output.stdout,
"Hello again from Release Phase Buildpack!"
"Container env is available to release command"
);
assert_contains!(log_output.stderr, "release-phase complete.");
},
Expand Down

0 comments on commit 6978e39

Please sign in to comment.