Skip to content

Conversation

@ayaegashi
Copy link
Contributor

@ayaegashi ayaegashi commented Sep 11, 2025

🔍 Description

This PR allows for Storm to accept a list of env vars with which to run Trident, not just HTTP(S)_PROXY

📝 Checks

pr-e2e: https://dev.azure.com/mariner-org/ECF/_build/results?buildId=932743&view=results
trident-testing (baremetal, example with multiple env vars): https://dev.azure.com/mariner-org/ECF/_build/results?buildId=931964&view=results

@ayaegashi ayaegashi requested a review from a team as a code owner September 11, 2025 20:25
# Alternate HTTP(S) proxy which can be used with AEP02 is "http://192.168.229.51:3128"
- name: BAREMETAL_HTTPS_PROXY
value: "http://172.16.1.10:3128"
- name: BAREMETAL_ENV_VARS
Copy link
Contributor

Choose a reason for hiding this comment

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

So, these BAREMETAL_ENV_VARS will include other var-s, and HTTPS_PROXY will only be one of them? Just curious why this change is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's correct. This PR is in response to this comment on my previous PR a couple weeks back: #86 (comment) I didn't see this comment until recently haha

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest that everything in the pipeline stays mostly the same, otherwise there are many edge cases not being considered, and only when we get to invoking the storm binary we transform it into the proxy, ie

storm-bin ... --env HTTPS_PROXY=${{ parameters.HTTPS_PROXY }} ...

default: ""

- name: httpsProxy
- name: envVars
Copy link
Contributor

@alejandro-microsoft alejandro-microsoft Sep 12, 2025

Choose a reason for hiding this comment

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

I think this could be a little misleading. The Go code was modified to receive the list of env variables, and I think each is received with the same flag, but here the parameter is just for the httpsProxy and it will use the env-vars flag. Changing the name here, would imply these are all the env variables, but more can be added by using the same flag too. This parameter only carries the httpsProxy value, but maybe the idea would be to store the rest here too (if so, I think you may need to handle the input in Go in a different way).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, although I was thinking that any env vars used for clean install would be the same ones used during a/b updates as well so it makes sense to set them once in baremetal-testing.yml and then just receive and use them here.
I think if we needed to add another env var in this template, we can also just append to the parameter env var and pass the whole list.

Copy link
Contributor

@alejandro-microsoft alejandro-microsoft Sep 12, 2025

Choose a reason for hiding this comment

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

If we needed to add another env var in this template, we can append to the parameter env var and pass the whole list.

I definitely, agree with this approach, but I'm unsure if with the current code the whole list of env vars can be passed in one string with just the flag at the beginning.

For example, can you pass just the flag and then the list of env variables (space separated or comma separated):
-env-vars HTTPS_PROXY=http://0.0.0.0 env-var2 env-var3
or do you need to precede each variable with the flag:
-env-vars HTTPS_PROXY=http://0.0.0.0 --env-vars env-var2 --env-vars env-var3
?

If it is the former, I see no problem. For the latter, it may be a good idea to explicitly add each env variable, change how the flags are added, or simply add a comment for clarification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Either format should work, so both --env-vars VAR_ONE="var_one",VAR_TWO="var_two" and --env-vars VAR_ONE="var_one" --env-vars VAR_TWO="var_two should lead to the equivalent outcome.

I think though as you said it may be confusing, so I switched the parameter back to httpsProxy :)

@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 22:04
Copy link
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 refactors the Storm tool to accept multiple environment variables when running Trident, expanding beyond just proxy variables to support any arbitrary environment variables.

  • Changed function signatures to accept []string for environment variables instead of a single proxy string
  • Updated command-line flag from --proxy to --env-vars with support for multiple values
  • Modified environment variable handling logic to process arrays of key-value pairs

Reviewed Changes

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

File Description
tools/storm/utils/trident.go Core logic changes to handle multiple env vars in Trident command building and invocation
tools/storm/helpers/ab_update.go Updated struct field and function calls to use new env vars parameter
.pipelines/templates/stages/testing_common/e2e-test-run.yml Pipeline configuration updates to use new --env-vars flag syntax
.pipelines/templates/stages/testing_common/e2e-ab-update-stage-finalize-test-run.yml Pipeline configuration updates to use new --env-vars flag syntax

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 22:56
Copy link
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 60 to 61
if key := strings.Split(v, "=")[0]; key != "" {
envKeys = append(envKeys, key)
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

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

This code doesn't handle environment variables without an equals sign (e.g., just 'PATH'). strings.Split(v, "=")[0] will return the entire string if no '=' is found, but the check key != "" will always pass for non-empty strings, potentially causing issues with malformed env vars.

Suggested change
if key := strings.Split(v, "=")[0]; key != "" {
envKeys = append(envKeys, key)
if strings.Contains(v, "=") {
if key := strings.SplitN(v, "=", 2)[0]; key != "" {
envKeys = append(envKeys, key)
}

Copilot uses AI. Check for mistakes.
@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 23:21
Copy link
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 23:46
Copy link
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 23:51
Copy link
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 00:01
Copy link
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 00:13
Copy link
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ayaegashi ayaegashi marked this pull request as draft September 19, 2025 00:41
@ayaegashi ayaegashi marked this pull request as ready for review September 19, 2025 16:43
@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 16:43
Copy link
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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

5 participants