diff options
author | Hibariya <hibariya@gmail.com> | 2021-02-27 17:31:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-27 17:31:25 +0100 |
commit | 8de7b956b781bd4bb97bf6136d30e789501b17b4 (patch) | |
tree | f77acee9e159f1e09db59af37477490df4202027 /cmd | |
parent | #534 feat: step continues when continue-on-error is ture (#544) (diff) | |
download | forgejo-act-8de7b956b781bd4bb97bf6136d30e789501b17b4.tar.xz forgejo-act-8de7b956b781bd4bb97bf6136d30e789501b17b4.zip |
Add --userns flag to support Docker daemon that enables user namespace (#533)
I got an error like this after hitting `act` command.
> Error: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled
According to the document, when user namespaces are enabled on the Docker daemon,
neither host network mode and --privileged work without --userns=host. Since `act`
uses host network mode to match GitHub Actions runners, it cannot run jobs when
user namespaces are enabled. So I added the flag.
https://docs.docker.com/engine/security/userns-remap/#user-namespace-known-limitations
Co-authored-by: Casey Lee <cplee@nektos.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/input.go | 1 | ||||
-rw-r--r-- | cmd/root.go | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/cmd/input.go b/cmd/input.go index 5a61d2b..aa1cecd 100644 --- a/cmd/input.go +++ b/cmd/input.go @@ -25,6 +25,7 @@ type Input struct { insecureSecrets bool defaultBranch string privileged bool + usernsMode string } func (i *Input) resolve(path string) string { diff --git a/cmd/root.go b/cmd/root.go index 2a9a80c..826c783 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -47,6 +47,7 @@ func Execute(ctx context.Context, version string) { rootCmd.Flags().StringVarP(&input.eventPath, "eventpath", "e", "", "path to event JSON file") rootCmd.Flags().StringVar(&input.defaultBranch, "defaultbranch", "", "the name of the main branch") rootCmd.Flags().BoolVar(&input.privileged, "privileged", false, "use privileged mode") + rootCmd.Flags().StringVar(&input.usernsMode, "userns", "", "user namespace to use") rootCmd.PersistentFlags().StringVarP(&input.actor, "actor", "a", "nektos/act", "user that triggered the event") rootCmd.PersistentFlags().StringVarP(&input.workflowsPath, "workflows", "W", "./.github/workflows/", "path to workflow file(s)") rootCmd.PersistentFlags().StringVarP(&input.workdir, "directory", "C", ".", "working directory") @@ -260,6 +261,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str InsecureSecrets: input.insecureSecrets, Platforms: input.newPlatforms(), Privileged: input.privileged, + UsernsMode: input.usernsMode, } r, err := runner.New(config) if err != nil { |