Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e049086
fix proxy in testing
ayaegashi Sep 11, 2025
df6b131
no noproxy
ayaegashi Sep 11, 2025
75411ad
revert target config
ayaegashi Sep 11, 2025
d10c8f8
remove noproxy
ayaegashi Sep 12, 2025
7e2c325
try as array of strings
ayaegashi Sep 12, 2025
0a11b46
test only misc
ayaegashi Sep 12, 2025
c55cc0a
revert target configs
ayaegashi Sep 12, 2025
41fa134
change variable name to env_var_args
ayaegashi Sep 12, 2025
cf07c74
rename to env-var-args in e2e-test-run
ayaegashi Sep 12, 2025
73143fe
go back to https proxy
ayaegashi Sep 18, 2025
12c5193
rename ot PROXYARG
ayaegashi Sep 18, 2025
1de9f14
rename contd
ayaegashi Sep 18, 2025
f1ce724
add test env vars
ayaegashi Sep 18, 2025
6fe7aa9
add log
ayaegashi Sep 18, 2025
e410774
add --env for each var
ayaegashi Sep 18, 2025
5c92b73
test again
ayaegashi Sep 18, 2025
910492f
fixed typo
ayaegashi Sep 18, 2025
faf8e97
revert test env vars
ayaegashi Sep 18, 2025
c644cdb
update help string
ayaegashi Sep 18, 2025
e66110d
nit
ayaegashi Sep 18, 2025
e3b8a44
use strings cut
ayaegashi Sep 18, 2025
6b28ac2
remove unnecessary log
ayaegashi Sep 18, 2025
1338975
use single quotes
ayaegashi Sep 19, 2025
34282b8
preserve env unnecessary
ayaegashi Sep 19, 2025
b5db98f
only run misc for validation
ayaegashi Sep 19, 2025
36eb1d3
revert target config
ayaegashi Sep 19, 2025
f0e8bbe
remove test env var
ayaegashi Sep 19, 2025
0fb3f2d
remove code declaring vars before sudo
ayaegashi Sep 19, 2025
449617b
Merge remote-tracking branch 'origin/main' into ayaegashi/proxy-update
ayaegashi Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ steps:
PROXY_ARG=""
if [ -n "${{ parameters.httpsProxy }}" ]; then
PROXY_ARG="--proxy HTTPS_PROXY=${{ parameters.httpsProxy }}"
PROXY_ARG="--env-vars HTTPS_PROXY=${{ parameters.httpsProxy }}"
fi
echo "Running script to stage A/B update..."
Expand Down Expand Up @@ -143,7 +143,7 @@ steps:
PROXY_ARG=""
if [ -n "${{ parameters.httpsProxy }}" ]; then
PROXY_ARG="--proxy HTTPS_PROXY=${{ parameters.httpsProxy }}"
PROXY_ARG="--env-vars HTTPS_PROXY=${{ parameters.httpsProxy }}"
fi
echo "Running script to finalize A/B update..."
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/templates/stages/testing_common/e2e-test-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ steps:

PROXY_ARG=""
if [ -n "${{ parameters.httpsProxy }}" ]; then
PROXY_ARG="--proxy HTTPS_PROXY=${{ parameters.httpsProxy }}"
PROXY_ARG="--env-vars HTTPS_PROXY=${{ parameters.httpsProxy }}"
fi

echo "Running script to stage and finalize A/B update..."
Expand Down Expand Up @@ -243,7 +243,7 @@ steps:

PROXY_ARG=""
if [ -n "${{ parameters.httpsProxy }}" ]; then
PROXY_ARG="--proxy HTTPS_PROXY=${{ parameters.httpsProxy }}"
PROXY_ARG="--env-vars HTTPS_PROXY=${{ parameters.httpsProxy }}"
fi

echo "Running script to stage and finalize A/B update..."
Expand Down
14 changes: 7 additions & 7 deletions tools/storm/helpers/ab_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ type AbUpdateHelper struct {
args struct {
utils.SshCliSettings `embed:""`
utils.EnvCliSettings `embed:""`
TridentConfig string `short:"c" required:"" help:"File name of the custom read-write Trident config on the host to point Trident to."`
Version string `short:"v" required:"" help:"Version of the Trident image to use for the A/B update."`
StageAbUpdate bool `short:"s" help:"Controls whether A/B update should be staged."`
FinalizeAbUpdate bool `short:"f" help:"Controls whether A/B update should be finalized."`
Proxy string `help:"Proxy address. Input should include the env var name, i.e. HTTPS_PROXY=http://0.0.0.0."`
TridentConfig string `short:"c" required:"" help:"File name of the custom read-write Trident config on the host to point Trident to."`
Version string `short:"v" required:"" help:"Version of the Trident image to use for the A/B update."`
StageAbUpdate bool `short:"s" help:"Controls whether A/B update should be staged."`
FinalizeAbUpdate bool `short:"f" help:"Controls whether A/B update should be finalized."`
EnvVars []string `short:"e" help:"Environment variables. Multiple vars can be passed as a list of comma-separated strings, or this flag can be used multiple times. Each var should include the env var name, i.e. HTTPS_PROXY=http://0.0.0.0."`
}

client *ssh.Client
Expand Down Expand Up @@ -65,7 +65,7 @@ func (h *AbUpdateHelper) getHostConfig(tc storm.TestCase) error {
}
})

out, err := utils.InvokeTrident(h.args.Env, h.client, h.args.Proxy, "get configuration")
out, err := utils.InvokeTrident(h.args.Env, h.client, h.args.EnvVars, "get configuration")
if err != nil {
return fmt.Errorf("failed to invoke Trident: %w", err)
}
Expand Down Expand Up @@ -230,7 +230,7 @@ func (h *AbUpdateHelper) triggerTridentUpdate(tc storm.TestCase) error {
for i := 1; ; i++ {
logrus.Infof("Invoking Trident attempt #%d with args: %s", i, args)

out, err := utils.InvokeTrident(h.args.Env, h.client, h.args.Proxy, args)
out, err := utils.InvokeTrident(h.args.Env, h.client, h.args.EnvVars, args)
if err != nil {
if err, ok := err.(*ssh.ExitMissingError); ok && strings.Contains(out.Stderr, "Rebooting system") {
// The connection closed without an exit code, and the output contains "Rebooting system".
Expand Down
21 changes: 13 additions & 8 deletions tools/storm/utils/trident.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ const (
DOCKER_IMAGE_PATH = "/var/lib/trident/trident-container.tar.gz"
)

func BuildTridentContainerCommand(env string) string {
func BuildTridentContainerCommand(envVars []string) string {
cmd := DOCKER_COMMAND_BASE
if env != "" {
cmd += fmt.Sprintf("--env %s ", env)
if len(envVars) != 0 {
for _, envVar := range envVars {
cmd += fmt.Sprintf("--env '%s' ", envVar)
}
}
cmd += TRIDENT_CONTAINER
return cmd
Expand All @@ -38,23 +40,26 @@ func BuildTridentContainerCommand(env string) string {
// - The SSH session cannot be created
// - There was an error starting the command.
// - Some IO error occurred while reading stdout or stderr.
func InvokeTrident(env TridentEnvironment, client *ssh.Client, proxy string, arguments string) (*SshCmdOutput, error) {
func InvokeTrident(env TridentEnvironment, client *ssh.Client, envVars []string, arguments string) (*SshCmdOutput, error) {
var cmd string
switch env {
case TridentEnvironmentHost:
cmd = TRIDENT_BINARY
case TridentEnvironmentContainer:
cmd = BuildTridentContainerCommand(proxy)
cmd = BuildTridentContainerCommand(envVars)
case TridentEnvironmentNone:
return nil, fmt.Errorf("trident service is not running")
default:
return nil, fmt.Errorf("invalid environment: %s", env)
}

var cmdPrefix string
if proxy != "" {
envVar := strings.Split(proxy, "=")[0]
cmdPrefix = fmt.Sprintf("%s sudo --preserve-env=%s", proxy, envVar)
if len(envVars) != 0 {
var quotedEnvVars = ""
for _, v := range envVars {
quotedEnvVars += fmt.Sprintf("'%s' ", v)
}
cmdPrefix = fmt.Sprintf("sudo %s", quotedEnvVars)
} else {
cmdPrefix = "sudo"
}
Expand Down
Loading