add flag of privileged mode
This commit is contained in:
parent
bbc8123f27
commit
24bdb024bf
6 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,7 @@ type Input struct {
|
|||
noOutput bool
|
||||
envfile string
|
||||
secretfile string
|
||||
privileged bool
|
||||
}
|
||||
|
||||
func (i *Input) resolve(path string) string {
|
||||
|
|
|
@ -41,6 +41,7 @@ func Execute(ctx context.Context, version string) {
|
|||
rootCmd.Flags().BoolVarP(&input.bindWorkdir, "bind", "b", false, "bind working directory to container, rather than copy")
|
||||
rootCmd.Flags().BoolVarP(&input.forcePull, "pull", "p", false, "pull docker image(s) if already present")
|
||||
rootCmd.Flags().StringVarP(&input.eventPath, "eventpath", "e", "", "path to event JSON file")
|
||||
rootCmd.Flags().BoolVar(&input.privileged, "privileged", false, "use privileged mode")
|
||||
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")
|
||||
|
@ -168,6 +169,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
|||
Env: envs,
|
||||
Secrets: secrets,
|
||||
Platforms: input.newPlatforms(),
|
||||
Privileged: input.privileged,
|
||||
}
|
||||
runner, err := runner.New(config)
|
||||
if err != nil {
|
||||
|
|
|
@ -40,6 +40,7 @@ type NewContainerInput struct {
|
|||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
NetworkMode string
|
||||
Privileged bool
|
||||
}
|
||||
|
||||
// FileEntry is a file to copy to a container
|
||||
|
@ -261,6 +262,7 @@ func (cr *containerReference) create() common.Executor {
|
|||
Binds: input.Binds,
|
||||
Mounts: mounts,
|
||||
NetworkMode: container.NetworkMode(input.NetworkMode),
|
||||
Privileged: input.Privileged,
|
||||
}, nil, input.Name)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
|
|
|
@ -104,6 +104,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
Binds: binds,
|
||||
Stdout: logWriter,
|
||||
Stderr: logWriter,
|
||||
Privileged: rc.Config.Privileged,
|
||||
})
|
||||
|
||||
var copyWorkspace bool
|
||||
|
|
|
@ -28,6 +28,7 @@ type Config struct {
|
|||
Env map[string]string // env for containers
|
||||
Secrets map[string]string // list of secrets
|
||||
Platforms map[string]string // list of platforms
|
||||
Privileged bool // use privileged mode
|
||||
}
|
||||
|
||||
type runnerImpl struct {
|
||||
|
|
|
@ -191,6 +191,7 @@ func (sc *StepContext) newStepContainer(ctx context.Context, image string, cmd [
|
|||
Binds: binds,
|
||||
Stdout: logWriter,
|
||||
Stderr: logWriter,
|
||||
Privileged: rc.Config.Privileged,
|
||||
})
|
||||
return stepContainer
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue