mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-25 08:15:02 +01: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
|
return true
|
||||||
})
|
})
|
||||||
cacheDir := rc.ActionCacheDir()
|
cacheDir := rc.ActionCacheDir()
|
||||||
|
var miscpath string
|
||||||
|
workdir := rc.Config.HostEnvironmentDir
|
||||||
|
if workdir == "" {
|
||||||
randBytes := make([]byte, 8)
|
randBytes := make([]byte, 8)
|
||||||
_, _ = rand.Read(randBytes)
|
_, _ = rand.Read(randBytes)
|
||||||
miscpath := filepath.Join(cacheDir, hex.EncodeToString(randBytes))
|
workdir = hex.EncodeToString(randBytes)
|
||||||
|
}
|
||||||
|
if filepath.IsAbs(workdir) {
|
||||||
|
miscpath = workdir
|
||||||
|
} else {
|
||||||
|
miscpath = filepath.Join(cacheDir, workdir)
|
||||||
|
}
|
||||||
actPath := filepath.Join(miscpath, "act")
|
actPath := filepath.Join(miscpath, "act")
|
||||||
if err := os.MkdirAll(actPath, 0o777); err != nil {
|
if err := os.MkdirAll(actPath, 0o777); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ type Config struct {
|
|||||||
Matrix map[string]map[string]bool // Matrix config to run
|
Matrix map[string]map[string]bool // Matrix config to run
|
||||||
ContainerNetworkMode docker_container.NetworkMode // the network mode of job containers (the value of --network)
|
ContainerNetworkMode docker_container.NetworkMode // the network mode of job containers (the value of --network)
|
||||||
ActionCache ActionCache // Use a custom ActionCache Implementation
|
ActionCache ActionCache // Use a custom ActionCache Implementation
|
||||||
|
HostEnvironmentDir string // Custom folder for host environment, parallel jobs must be 1
|
||||||
}
|
}
|
||||||
|
|
||||||
type caller struct {
|
type caller struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user