fix file permission for non root user docker image (#334)

This commit is contained in:
watiko 2020-08-09 05:31:26 +09:00 committed by GitHub
parent 17c7ecead2
commit 26e4270e41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 3 deletions

View file

@ -122,11 +122,11 @@ func (rc *RunContext) startJobContainer() common.Executor {
rc.JobContainer.CopyDir(copyToPath, rc.Config.Workdir+"/.").IfBool(copyWorkspace), rc.JobContainer.CopyDir(copyToPath, rc.Config.Workdir+"/.").IfBool(copyWorkspace),
rc.JobContainer.Copy("/github/", &container.FileEntry{ rc.JobContainer.Copy("/github/", &container.FileEntry{
Name: "workflow/event.json", Name: "workflow/event.json",
Mode: 644, Mode: 0644,
Body: rc.EventJSON, Body: rc.EventJSON,
}, &container.FileEntry{ }, &container.FileEntry{
Name: "home/.act", Name: "home/.act",
Mode: 644, Mode: 0644,
Body: "", Body: "",
}), }),
)(ctx) )(ctx)

View file

@ -45,6 +45,7 @@ func TestRunEvent(t *testing.T) {
{"fail", "push", "exit with `FAILURE`: 1"}, {"fail", "push", "exit with `FAILURE`: 1"},
{"runs-on", "push", ""}, {"runs-on", "push", ""},
{"job-container", "push", ""}, {"job-container", "push", ""},
{"job-container-non-root", "push", ""},
{"uses-docker-url", "push", ""}, {"uses-docker-url", "push", ""},
{"remote-action-docker", "push", ""}, {"remote-action-docker", "push", ""},
{"remote-action-js", "push", ""}, {"remote-action-js", "push", ""},

View file

@ -129,7 +129,7 @@ func (sc *StepContext) setupShellCommand() common.Executor {
sc.Cmd = strings.Fields(strings.Replace(step.ShellCommand(), "{0}", containerPath, 1)) sc.Cmd = strings.Fields(strings.Replace(step.ShellCommand(), "{0}", containerPath, 1))
return rc.JobContainer.Copy("/github/", &container.FileEntry{ return rc.JobContainer.Copy("/github/", &container.FileEntry{
Name: scriptName, Name: scriptName,
Mode: 755, Mode: 0755,
Body: script.String(), Body: script.String(),
})(ctx) })(ctx)
} }

View file

@ -0,0 +1,10 @@
name: job-container
on: push
jobs:
test:
runs-on: ubuntu-latest
container:
image: ocaml/opam2:debian-9-opam
steps:
- run: echo PASS