1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

move action cache to volume

This commit is contained in:
Casey Lee 2020-02-24 16:38:49 -08:00
parent 4955c2449c
commit 6df3e39a46
3 changed files with 110 additions and 40 deletions

View file

@ -80,11 +80,6 @@ func (rc *RunContext) startJobContainer() common.Executor {
bindModifiers = ":delegated"
}
hostActionCache := os.Getenv("ACT_HOST_ACTION_CACHE")
if hostActionCache == "" {
hostActionCache = rc.ActionCacheDir()
}
envList = append(envList, fmt.Sprintf("%s=%s", "ACT_HOST_ACTION_CACHE", hostActionCache))
envList = append(envList, fmt.Sprintf("%s=%s", "RUNNER_TOOL_CACHE", "/toolcache"))
rc.JobContainer = container.NewContainer(&container.NewContainerInput{
@ -97,11 +92,11 @@ func (rc *RunContext) startJobContainer() common.Executor {
Mounts: map[string]string{
name: "/github",
"act-toolcache": "/toolcache",
"act-actions": "/actions",
},
Binds: []string{
fmt.Sprintf("%s:%s%s", rc.Config.Workdir, "/github/workspace", bindModifiers),
fmt.Sprintf("%s:%s%s", hostActionCache, "/github/home/.cache/act", bindModifiers),
fmt.Sprintf("%s:%s", "/var/run/docker.sock", "/var/run/docker.sock"),
},
Stdout: logWriter,
@ -117,6 +112,10 @@ func (rc *RunContext) startJobContainer() common.Executor {
Name: "workflow/event.json",
Mode: 644,
Body: rc.EventJSON,
}, &container.FileEntry{
Name: "home/.act",
Mode: 644,
Body: "",
}),
)(ctx)
}