Skip to content

fix: host builder passes environment variables to spawned subprocesses#3577

Open
gauron99 wants to merge 1 commit intoknative:mainfrom
gauron99:push-xwxrtyspwuot
Open

fix: host builder passes environment variables to spawned subprocesses#3577
gauron99 wants to merge 1 commit intoknative:mainfrom
gauron99:push-xwxrtyspwuot

Conversation

@gauron99
Copy link
Copy Markdown
Contributor

@gauron99 gauron99 commented Apr 2, 2026

The runPython() and runGo() functions in runner.go were setting cmd.Env by appending to a nil slice, which discarded the parent environment and any func.yaml/CLI environment variables. Now both functions inherit the parent process environment via os.Environ() and inject Run.Envs using Interpolate(), matching the behavior of container-based builders.

@knative-prow knative-prow bot requested review from dsimansk and jrangelramos April 2, 2026 19:04
@knative-prow
Copy link
Copy Markdown

knative-prow bot commented Apr 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauron99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added approved 🤖 PR has been approved by an approver from all required OWNERS files. size/L 🤖 PR changes 100-499 lines, ignoring generated files. labels Apr 2, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 69.44444% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.26%. Comparing base (849838f) to head (e302a7c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/functions/runner.go 69.44% 8 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3577      +/-   ##
==========================================
+ Coverage   53.77%   56.26%   +2.49%     
==========================================
  Files         180      180              
  Lines       20465    20483      +18     
==========================================
+ Hits        11005    11525     +520     
+ Misses       8354     7755     -599     
- Partials     1106     1203      +97     
Flag Coverage Δ
e2e 36.14% <36.11%> (+0.01%) ⬆️
e2e go 32.57% <46.42%> (+0.02%) ⬆️
e2e node 28.31% <0.00%> (-0.06%) ⬇️
e2e python 32.92% <39.28%> (+<0.01%) ⬆️
e2e quarkus 28.45% <0.00%> (-0.06%) ⬇️
e2e rust 27.87% <0.00%> (-0.06%) ⬇️
e2e springboot 26.31% <0.00%> (-0.05%) ⬇️
e2e typescript 28.42% <0.00%> (-0.06%) ⬇️
e2e-config-ci 18.11% <0.00%> (-0.04%) ⬇️
integration 17.37% <0.00%> (?)
unit macos-14 43.39% <53.57%> (+0.01%) ⬆️
unit macos-latest 43.39% <53.57%> (+0.01%) ⬆️
unit ubuntu-24.04-arm 43.57% <50.00%> (+<0.01%) ⬆️
unit ubuntu-latest 44.26% <53.57%> (+0.01%) ⬆️
unit windows-latest 43.41% <57.14%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gauron99 gauron99 force-pushed the push-xwxrtyspwuot branch 2 times, most recently from 97588a6 to 01c4816 Compare April 3, 2026 12:21
The runPython() and runGo() functions in runner.go were setting cmd.Env
by appending to a nil slice, which discarded the parent environment and
any func.yaml/CLI environment variables. Now both functions inherit the
parent process environment via os.Environ() and inject Run.Envs using
Interpolate(), matching the behavior of container-based builders.
@gauron99 gauron99 force-pushed the push-xwxrtyspwuot branch from 01c4816 to e302a7c Compare April 3, 2026 12:27
)

const (
defaultRunHost = "127.0.0.1" // TODO allow to be altered via a runOpt
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

just removing the comment, we are already parsing the address

Comment on lines +173 to +179
cmd.Cancel = func() error {
if runtime.GOOS == "windows" {
// Interrupt is not implemented on windows apparently
return cmd.Process.Kill()
}
return cmd.Process.Signal(os.Interrupt)
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the new Cancel function.
Windows apparently does not implement safer interrupt so we have to Kill

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

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant