From 7d24ac55678350f4a6fd7db61b0fdc8178d7ca40 Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Wed, 17 Apr 2024 21:39:44 +0200 Subject: [PATCH] osbuildexecutor/ec2: pass extraEnv only to sources invocation The extra env only contains paths to secrets which are needed to pull sources. Since the sources don't get pulled on the executor, don't pass the env along to the executor. --- internal/osbuildexecutor/runner-impl-aws-ec2.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/osbuildexecutor/runner-impl-aws-ec2.go b/internal/osbuildexecutor/runner-impl-aws-ec2.go index 45ebc4264..6486b1b3f 100644 --- a/internal/osbuildexecutor/runner-impl-aws-ec2.go +++ b/internal/osbuildexecutor/runner-impl-aws-ec2.go @@ -18,16 +18,16 @@ type awsEC2Executor struct { cloudWatchGroup string } -func prepareSources(manifest []byte, store string, result bool, errorWriter io.Writer) error { +func prepareSources(manifest []byte, store string, extraEnv []string, result bool, errorWriter io.Writer) error { hostExecutor := NewHostExecutor() - _, err := hostExecutor.RunOSBuild(manifest, store, "", nil, nil, nil, nil, result, errorWriter) + _, err := hostExecutor.RunOSBuild(manifest, store, "", nil, nil, nil, extraEnv, result, errorWriter) return err } func (ec2e *awsEC2Executor) RunOSBuild(manifest []byte, store, outputDirectory string, exports, exportPaths, checkpoints, extraEnv []string, result bool, errorWriter io.Writer) (*osbuild.Result, error) { - err := prepareSources(manifest, store, result, errorWriter) + err := prepareSources(manifest, store, extraEnv, result, errorWriter) if err != nil { return nil, err } @@ -67,9 +67,6 @@ func (ec2e *awsEC2Executor) RunOSBuild(manifest []byte, store, outputDirectory s for _, exp := range exportPaths { args = append(args, "--export-file", exp) } - for _, env := range extraEnv { - args = append(args, "--environment", env) - } args = append(args, "--output", outputDirectory) cmd := exec.Command(