Skip to content

Commit 554f7b1

Browse files
feat:[STO-10833]: set clone cache path as env variable (#46)
* feat:[STO-10833]: updated the env for child process to add clone cache path
1 parent be1b624 commit 554f7b1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

plugin/harness/execer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ func (e *Execer) runShellExecutable(ctx context.Context, out *spec) error {
153153
script := fmt.Sprintf(
154154
"$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; %s", path)
155155
cmd := exec.Command("pwsh", "-Command", script)
156-
return runCmds(ctx, []*exec.Cmd{cmd}, e.Environ, e.Workdir, e.Stdout, e.Stderr)
156+
envWithClonePath := append(e.Environ, fmt.Sprintf("CLONE_CACHE_PATH=%s", e.Source))
157+
return runCmds(ctx, []*exec.Cmd{cmd}, envWithClonePath, e.Workdir, e.Stdout, e.Stderr)
157158
case "linux", "darwin":
158159
path := filepath.Join(e.Source, out.Run.Bash.Path)
159160

@@ -166,7 +167,8 @@ func (e *Execer) runShellExecutable(ctx context.Context, out *spec) error {
166167
slog.Debug("execute", slog.String("file", path))
167168

168169
cmd := exec.Command(shell, path)
169-
return runCmds(ctx, []*exec.Cmd{cmd}, e.Environ, e.Workdir, e.Stdout, e.Stderr)
170+
envWithClonePath := append(e.Environ, fmt.Sprintf("CLONE_CACHE_PATH=%s", e.Source))
171+
return runCmds(ctx, []*exec.Cmd{cmd}, envWithClonePath, e.Workdir, e.Stdout, e.Stderr)
170172
default:
171173
return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
172174
}

0 commit comments

Comments
 (0)