mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
use project dir instead of /github/workspace (#567)
This commit is contained in:
parent
391acea9e2
commit
d1cae38197
4 changed files with 20 additions and 21 deletions
|
@ -86,7 +86,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
fmt.Sprintf("%s:%s", "/var/run/docker.sock", "/var/run/docker.sock"),
|
||||
}
|
||||
if rc.Config.BindWorkdir {
|
||||
binds = append(binds, fmt.Sprintf("%s:%s%s", rc.Config.Workdir, "/github/workspace", bindModifiers))
|
||||
binds = append(binds, fmt.Sprintf("%s:%s%s", rc.Config.Workdir, rc.Config.Workdir, bindModifiers))
|
||||
}
|
||||
|
||||
if rc.Config.ContainerArchitecture == "" {
|
||||
|
@ -96,12 +96,12 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
rc.JobContainer = container.NewContainer(&container.NewContainerInput{
|
||||
Cmd: nil,
|
||||
Entrypoint: []string{"/usr/bin/tail", "-f", "/dev/null"},
|
||||
WorkingDir: "/github/workspace",
|
||||
WorkingDir: rc.Config.Workdir,
|
||||
Image: image,
|
||||
Name: name,
|
||||
Env: envList,
|
||||
Mounts: map[string]string{
|
||||
name: "/github",
|
||||
name: filepath.Dir(rc.Config.Workdir),
|
||||
"act-toolcache": "/toolcache",
|
||||
"act-actions": "/actions",
|
||||
},
|
||||
|
@ -118,7 +118,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
var copyToPath string
|
||||
if !rc.Config.BindWorkdir {
|
||||
copyToPath, copyWorkspace = rc.localCheckoutPath()
|
||||
copyToPath = filepath.Join("/github/workspace", copyToPath)
|
||||
copyToPath = filepath.Join(rc.Config.Workdir, copyToPath)
|
||||
}
|
||||
|
||||
return common.NewPipelineExecutor(
|
||||
|
@ -127,7 +127,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
rc.JobContainer.Create(),
|
||||
rc.JobContainer.Start(false),
|
||||
rc.JobContainer.CopyDir(copyToPath, rc.Config.Workdir+string(filepath.Separator)+".").IfBool(copyWorkspace),
|
||||
rc.JobContainer.Copy("/github/", &container.FileEntry{
|
||||
rc.JobContainer.Copy(filepath.Dir(rc.Config.Workdir), &container.FileEntry{
|
||||
Name: "workflow/event.json",
|
||||
Mode: 0644,
|
||||
Body: rc.EventJSON,
|
||||
|
@ -449,14 +449,14 @@ func (rc *RunContext) getGithubContext() *githubContext {
|
|||
}
|
||||
ghc := &githubContext{
|
||||
Event: make(map[string]interface{}),
|
||||
EventPath: "/github/workflow/event.json",
|
||||
EventPath: fmt.Sprintf("%s/%s", filepath.Dir(rc.Config.Workdir), "workflow/event.json"),
|
||||
Workflow: rc.Run.Workflow.Name,
|
||||
RunID: runID,
|
||||
RunNumber: runNumber,
|
||||
Actor: rc.Config.Actor,
|
||||
EventName: rc.Config.EventName,
|
||||
Token: token,
|
||||
Workspace: "/github/workspace",
|
||||
Workspace: rc.Config.Workdir,
|
||||
Action: rc.CurrentStep,
|
||||
}
|
||||
|
||||
|
@ -580,9 +580,8 @@ func withDefaultBranch(b string, event map[string]interface{}) map[string]interf
|
|||
func (rc *RunContext) withGithubEnv(env map[string]string) map[string]string {
|
||||
github := rc.getGithubContext()
|
||||
env["CI"] = "true"
|
||||
env["HOME"] = "/github/home"
|
||||
|
||||
env["GITHUB_ENV"] = "/github/workflow/envs.txt"
|
||||
env["HOME"] = fmt.Sprintf("%s/%s", filepath.Dir(rc.Config.Workdir), "home")
|
||||
env["GITHUB_ENV"] = fmt.Sprintf("%s/%s", filepath.Dir(rc.Config.Workdir), "workflow/envs.txt")
|
||||
env["GITHUB_WORKFLOW"] = github.Workflow
|
||||
env["GITHUB_RUN_ID"] = github.RunID
|
||||
env["GITHUB_RUN_NUMBER"] = github.RunNumber
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue