mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-20 03:46:09 +08:00
feat: custom host env dir for api (#92)
This commit is contained in:
@@ -188,9 +188,18 @@ func (rc *RunContext) startHostEnvironment() common.Executor {
|
||||
return true
|
||||
})
|
||||
cacheDir := rc.ActionCacheDir()
|
||||
randBytes := make([]byte, 8)
|
||||
_, _ = rand.Read(randBytes)
|
||||
miscpath := filepath.Join(cacheDir, hex.EncodeToString(randBytes))
|
||||
var miscpath string
|
||||
workdir := rc.Config.HostEnvironmentDir
|
||||
if workdir == "" {
|
||||
randBytes := make([]byte, 8)
|
||||
_, _ = rand.Read(randBytes)
|
||||
workdir = hex.EncodeToString(randBytes)
|
||||
}
|
||||
if filepath.IsAbs(workdir) {
|
||||
miscpath = workdir
|
||||
} else {
|
||||
miscpath = filepath.Join(cacheDir, workdir)
|
||||
}
|
||||
actPath := filepath.Join(miscpath, "act")
|
||||
if err := os.MkdirAll(actPath, 0o777); err != nil {
|
||||
return err
|
||||
|
||||
@@ -61,6 +61,7 @@ type Config struct {
|
||||
Matrix map[string]map[string]bool // Matrix config to run
|
||||
ContainerNetworkMode docker_container.NetworkMode // the network mode of job containers (the value of --network)
|
||||
ActionCache ActionCache // Use a custom ActionCache Implementation
|
||||
HostEnvironmentDir string // Custom folder for host environment, parallel jobs must be 1
|
||||
}
|
||||
|
||||
type caller struct {
|
||||
|
||||
Reference in New Issue
Block a user