Skip to content

Conversation

@tiran
Copy link
Collaborator

@tiran tiran commented Jun 26, 2025

The external_commands.run() function now logs all environment variables. Before it only logged extra environment variables defined in a plugin. The logs were missing information about global environment variables, e.g. env vars defined in a build container. These additional env vars influence a build, too.

The run log file now contains the command, env vars, and current working directory, too.

Potentially sensitive env vars are masked. This is an additional precaution. GitHub and GitLab already mask sensitive values in logs.

@tiran tiran requested a review from a team as a code owner June 26, 2025 06:39
@tiran tiran requested review from EmilienM and dhellmann June 26, 2025 06:39
@tiran
Copy link
Collaborator Author

tiran commented Jun 26, 2025

I'm investigating a vLLM build problem and could not figure out the exact build environment from our build logs. This PR includes all build environment variables in the global log and the run log.

@tiran tiran force-pushed the debug-external-command branch from a23bd17 to 29aec4f Compare June 26, 2025 06:51
@mergify mergify bot added the ci label Jun 26, 2025
@EmilienM
Copy link
Contributor

@tiran is there any risk to expose secret environments in CI logs, e.g. credentials embedded in URLs, or secrets? etc.

Copy link
Contributor

@rd4398 rd4398 left a comment

Choose a reason for hiding this comment

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

Looks good!
I will wait to approve till @EmilienM gets answer to his question

Copy link
Member

@LalatenduMohanty LalatenduMohanty left a comment

Choose a reason for hiding this comment

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

/lgtm

@tiran tiran force-pushed the debug-external-command branch from 29aec4f to b431951 Compare June 27, 2025 08:40
@tiran
Copy link
Collaborator Author

tiran commented Jun 27, 2025

@tiran is there any risk to expose secret environments in CI logs, e.g. credentials embedded in URLs, or secrets? etc.

That is a good point! GitHub and GitLab already mask sensitive values. I have added additional code to also mask keys that look like they hold sensitive values.

@tiran tiran force-pushed the debug-external-command branch from b431951 to 876f694 Compare June 27, 2025 08:42
@tiran tiran requested review from LalatenduMohanty and rd4398 June 27, 2025 09:05
@tiran tiran force-pushed the debug-external-command branch from 876f694 to e59971b Compare June 27, 2025 09:11
The `external_commands.run()` function now logs all environment
variables. Before it only logged extra environment variables defined in
a plugin. The logs were missing information about global environment
variables, e.g. env vars defined in a build container. These additional
env vars influence a build, too.

The run log file now contains the command, env vars, and current
working directory, too.

Potentially sensitive env vars are masked. This is an additional
precaution. GitHub and GitLab already mask sensitive values in logs.

Signed-off-by: Christian Heimes <[email protected]>
@tiran tiran force-pushed the debug-external-command branch from e59971b to 7a8dcd7 Compare June 29, 2025 06:05

# *PAT (GitLab), SECRET, PASSWORD, PASSPHRASE, CRED(entials), TOKEN
SENSITIVE_KEYS = re.compile(
"^(*.PAT|.*SECRET.*|.*PASSWORD.*|.*PASSPHRASE.*|.*CRED.*|.*TOKEN.*)$",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"^(*.PAT|.*SECRET.*|.*PASSWORD.*|.*PASSPHRASE.*|.*CRED.*|.*TOKEN.*)$",
"^(.*PAT|.*SECRET.*|.*PASSWORD.*|.*PASSPHRASE.*|.*CRED.*|.*TOKEN.*)$",

I think the tests are failing because of a typo here in the regex that makes it look like a glob pattern.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants