Skip to content

Pass HOME env var to CLI subprocesses#2238

Open
maor-rozenfeld wants to merge 1 commit intomainfrom
fix-cli
Open

Pass HOME env var to CLI subprocesses#2238
maor-rozenfeld wants to merge 1 commit intomainfrom
fix-cli

Conversation

@maor-rozenfeld
Copy link
Copy Markdown
Contributor

Fixes OPS-4158.

Forward the HOME environment variable from the parent process into CLI subprocesses for AWS, Azure, and Google Cloud blocks. Without HOME, CLI tools can fail when resolving paths for credential caches, config files, or other home-relative resources.

Changes

  • AWS CLI (aws-cli.ts): Forward HOME if set
  • Azure CLI (azure-cli.ts): Forward HOME via setEnvIfExists
  • Google Cloud CLI (google-cloud-cli.ts): Forward HOME if set
  • Google Cloud auth (auth.ts): Forward HOME if set

Testing Checklist

  • I tested the feature thoroughly, including edge cases
  • I verified all affected areas still work as expected
  • Automated tests were added/updated if necessary
  • Changes are backwards compatible with any existing data, otherwise a migration script is provided

Copilot AI review requested due to automatic review settings April 17, 2026 11:04
@linear
Copy link
Copy Markdown

linear Bot commented Apr 17, 2026

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses OPS-4158 by forwarding the parent process HOME environment variable into cloud CLI subprocesses so AWS/Azure/GCP tooling can resolve home-relative credential/config/cache paths reliably.

Changes:

  • Forward HOME into AWS CLI subprocess env when present.
  • Forward HOME into Azure CLI subprocess env via setEnvIfExists.
  • Forward HOME into Google Cloud CLI and GCP auth subprocess env when present.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/openops/src/lib/google-cloud/auth.ts Adds HOME to env passed into GCP auth/login subprocess when present.
packages/blocks/google-cloud/src/lib/google-cloud-cli.ts Adds HOME to env passed into gcloud subprocess when present.
packages/blocks/azure/src/lib/azure-cli.ts Forwards HOME into az subprocess env via existing env-forwarding helper.
packages/blocks/aws/src/lib/actions/cli/aws-cli.ts Adds HOME to env passed into aws subprocess when present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +41 to +43
if (process.env['HOME']) {
envVars['HOME'] = process.env['HOME'];
}
Comment on lines +60 to +62
if (process.env['HOME']) {
envVars['HOME'] = process.env['HOME'];
}
Comment on lines +14 to +16
if (process.env['HOME']) {
envVars.HOME = process.env['HOME'];
}
Comment on lines 23 to +25
setEnvIfExists(envVars, 'AZURE_CONFIG_DIR');
setEnvIfExists(envVars, 'AZURE_EXTENSION_DIR');
setEnvIfExists(envVars, 'HOME');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants