Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 12570e4

Browse files
authored
Revert "fix(sg): resolve overwrite env ordering in sg (#63838)" (#63924)
https://github.com/sourcegraph/sourcegraph/pull/63838 accidentally broke the local-dev site configuration workflow (the site-configuration from local dev was replaced with a stock configuration). Reverting this is probably the fastest way to resolve this. See https://sourcegraph.slack.com/archives/C07KZF47K/p1721329375844059 for more context. ## Test plan CI ## Changelog - The flawed env overwriting logic in sg from https://github.com/sourcegraph/sourcegraph/pull/63838 has been reverted.
1 parent fcdcfef commit 12570e4

File tree

3 files changed

+4
-64
lines changed

3 files changed

+4
-64
lines changed

dev/sg/internal/run/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ go_test(
4343
srcs = [
4444
"docker_command_test.go",
4545
"logger_test.go",
46-
"run_test.go",
4746
],
4847
embed = [":run"],
4948
tags = [TAG_INFRA_DEVINFRA],

dev/sg/internal/run/command.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ type outputOptions struct {
265265
}
266266

267267
func startSgCmd(ctx context.Context, cmd SGConfigCommand, parentEnv map[string]string) (*startedCmd, error) {
268-
ex, err := cmd.GetExecCmd(ctx)
268+
exec, err := cmd.GetExecCmd(ctx)
269269
if err != nil {
270270
return nil, err
271271
}
@@ -279,12 +279,9 @@ func startSgCmd(ctx context.Context, cmd SGConfigCommand, parentEnv map[string]s
279279
}
280280

281281
opts := commandOptions{
282-
name: conf.Name,
283-
exec: ex,
284-
// The ordering here is quite important because we want to allow the `parentEnv` and `secretsEnv`
285-
// to override the config values for a command. This ensures env vars in the sg overwrite file
286-
// are always the final authority.
287-
env: makeEnv(conf.Env, parentEnv, secretsEnv),
282+
name: conf.Name,
283+
exec: exec,
284+
env: makeEnv(parentEnv, secretsEnv, conf.Env),
288285
dir: conf.RepositoryRoot,
289286
stdout: outputOptions{ignore: conf.IgnoreStdout},
290287
stderr: outputOptions{ignore: conf.IgnoreStderr},

dev/sg/internal/run/run_test.go

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)