open-nomad/client/allocrunner/taskrunner/getter/util_windows.go
Seth Hoenig 2a7c7d85a5
artifact: fix sandbox behavior when destination is shared alloc directory (#15712)
This PR fixes the artifact sandbox (new in Nomad 1.5) to allow downloading
artifacts into the shared 'alloc' directory made available to each task in
a common allocation. Previously we assumed the 'alloc' dir would be mounted
under the 'task' dir, but this is only the case in fs isolation: chroot; in
other modes the alloc dir is elsewhere.
2023-01-09 09:46:32 -06:00

38 lines
811 B
Go

//go:build windows
package getter
import (
"os"
"path/filepath"
"syscall"
)
// attributes returns the system process attributes to run
// the sandbox process with
func attributes() *syscall.SysProcAttr {
return &syscall.SysProcAttr{}
}
func credentials() (uint32, uint32) {
return 0, 0
}
// lockdown has no effect on windows
func lockdown(string, string) error {
return nil
}
// defaultEnvironment is the default minimal environment variables for Windows.
func defaultEnvironment(taskDir string) map[string]string {
tmpDir := filepath.Join(taskDir, "tmp")
return map[string]string{
"HOMEPATH": os.Getenv("HOMEPATH"),
"HOMEDRIVE": os.Getenv("HOMEDRIVE"),
"USERPROFILE": os.Getenv("USERPROFILE"),
"PATH": os.Getenv("PATH"),
"TMP": tmpDir,
"TEMP": tmpDir,
}
}