feat: add option for custom socket path (#698)
This commit is contained in:
parent
764263ce0e
commit
799098b0e6
5 changed files with 39 additions and 29 deletions
58
README.md
58
README.md
|
@ -131,34 +131,36 @@ It will save that information to `~/.actrc`, please refer to [Configuration](#co
|
||||||
# Flags
|
# Flags
|
||||||
|
|
||||||
```none
|
```none
|
||||||
-a, --actor string user that triggered the event (default "nektos/act")
|
-a, --actor string user that triggered the event (default "nektos/act")
|
||||||
-b, --bind bind working directory to container, rather than copy
|
-b, --bind bind working directory to container, rather than copy
|
||||||
--container-architecture string Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.
|
--container-architecture string Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.
|
||||||
--defaultbranch string the name of the main branch
|
--container-daemon-socket string Path to Docker daemon socket which will be mounted to containers (default "/var/run/docker.sock")
|
||||||
--detect-event Use first event type from workflow as event that triggered the workflow
|
--defaultbranch string the name of the main branch
|
||||||
-C, --directory string working directory (default ".")
|
--detect-event Use first event type from workflow as event that triggered the workflow
|
||||||
-n, --dryrun dryrun mode
|
-C, --directory string working directory (default ".")
|
||||||
--env stringArray env to make available to actions with optional value (e.g. --env myenv=foo or -s myenv)
|
-n, --dryrun dryrun mode
|
||||||
--env-file string environment file to read and use as env in the containers (default ".env")
|
--env stringArray env to make available to actions with optional value (e.g. --e myenv=foo or -s myenv)
|
||||||
-e, --eventpath string path to event JSON file
|
--env-file string environment file to read and use as env in the containers (default ".env")
|
||||||
--github-instance string GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server. (default "github.com")
|
-e, --eventpath string path to event JSON file
|
||||||
-g, --graph draw workflows
|
--github-instance string GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server. (default "github.com")
|
||||||
-h, --help help for act
|
-g, --graph draw workflows
|
||||||
--insecure-secrets NOT RECOMMENDED! Doesn't hide secrets while printing logs.
|
-h, --help help for act
|
||||||
-j, --job string run job
|
--insecure-secrets NOT RECOMMENDED! Doesn't hide secrets while printing logs.
|
||||||
-l, --list list workflows
|
-j, --job string run job
|
||||||
-P, --platform stringArray custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04)
|
-l, --list list workflows
|
||||||
--privileged use privileged mode
|
--no-recurse Flag to disable running workflows from subdirectories of specified path in '--workflows'/'-W' flag
|
||||||
-p, --pull pull docker image(s) even if already present
|
-P, --platform stringArray custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04)
|
||||||
-q, --quiet disable logging of output from steps
|
--privileged use privileged mode
|
||||||
-r, --reuse reuse action containers to maintain state
|
-p, --pull pull docker image(s) even if already present
|
||||||
-s, --secret stringArray secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret)
|
-q, --quiet disable logging of output from steps
|
||||||
--secret-file string file with list of secrets to read from (e.g. --secret-file .secrets) (default ".secrets")
|
-r, --reuse reuse action containers to maintain state
|
||||||
--use-gitignore Controls whether paths specified in .gitignore should be copied into container (default true)
|
-s, --secret stringArray secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret)
|
||||||
--userns string user namespace to use
|
--secret-file string file with list of secrets to read from (e.g. --secret-file .secrets) (default ".secrets")
|
||||||
-v, --verbose verbose output
|
--use-gitignore Controls whether paths specified in .gitignore should be copied into container (default true)
|
||||||
-w, --watch watch the contents of the local repo and run when files change
|
--userns string user namespace to use
|
||||||
-W, --workflows string path to workflow file(s) (default "./.github/workflows/")
|
-v, --verbose verbose output
|
||||||
|
-w, --watch watch the contents of the local repo and run when files change
|
||||||
|
-W, --workflows string path to workflow file(s) (default "./.github/workflows/")
|
||||||
```
|
```
|
||||||
|
|
||||||
In case you want to pass a value for `${{ github.token }}`, you should pass `GITHUB_TOKEN` as secret: `act -s GITHUB_TOKEN=[insert token or leave blank for secure input]`.
|
In case you want to pass a value for `${{ github.token }}`, you should pass `GITHUB_TOKEN` as secret: `act -s GITHUB_TOKEN=[insert token or leave blank for secure input]`.
|
||||||
|
|
|
@ -28,6 +28,7 @@ type Input struct {
|
||||||
privileged bool
|
privileged bool
|
||||||
usernsMode string
|
usernsMode string
|
||||||
containerArchitecture string
|
containerArchitecture string
|
||||||
|
containerDaemonSocket string
|
||||||
noWorkflowRecurse bool
|
noWorkflowRecurse bool
|
||||||
useGitIgnore bool
|
useGitIgnore bool
|
||||||
githubInstance string
|
githubInstance string
|
||||||
|
|
|
@ -61,6 +61,7 @@ func Execute(ctx context.Context, version string) {
|
||||||
rootCmd.PersistentFlags().BoolVarP(&input.insecureSecrets, "insecure-secrets", "", false, "NOT RECOMMENDED! Doesn't hide secrets while printing logs.")
|
rootCmd.PersistentFlags().BoolVarP(&input.insecureSecrets, "insecure-secrets", "", false, "NOT RECOMMENDED! Doesn't hide secrets while printing logs.")
|
||||||
rootCmd.PersistentFlags().StringVarP(&input.envfile, "env-file", "", ".env", "environment file to read and use as env in the containers")
|
rootCmd.PersistentFlags().StringVarP(&input.envfile, "env-file", "", ".env", "environment file to read and use as env in the containers")
|
||||||
rootCmd.PersistentFlags().StringVarP(&input.containerArchitecture, "container-architecture", "", "", "Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.")
|
rootCmd.PersistentFlags().StringVarP(&input.containerArchitecture, "container-architecture", "", "", "Architecture which should be used to run containers, e.g.: linux/amd64. If not specified, will use host default architecture. Requires Docker server API Version 1.41+. Ignored on earlier Docker server platforms.")
|
||||||
|
rootCmd.PersistentFlags().StringVarP(&input.containerDaemonSocket, "container-daemon-socket", "", "/var/run/docker.sock", "Path to Docker daemon socket which will be mounted to containers")
|
||||||
rootCmd.PersistentFlags().StringVarP(&input.githubInstance, "github-instance", "", "github.com", "GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server.")
|
rootCmd.PersistentFlags().StringVarP(&input.githubInstance, "github-instance", "", "github.com", "GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server.")
|
||||||
rootCmd.SetArgs(args())
|
rootCmd.SetArgs(args())
|
||||||
|
|
||||||
|
@ -255,6 +256,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
||||||
Privileged: input.privileged,
|
Privileged: input.privileged,
|
||||||
UsernsMode: input.usernsMode,
|
UsernsMode: input.usernsMode,
|
||||||
ContainerArchitecture: input.containerArchitecture,
|
ContainerArchitecture: input.containerArchitecture,
|
||||||
|
ContainerDaemonSocket: input.containerDaemonSocket,
|
||||||
UseGitIgnore: input.useGitIgnore,
|
UseGitIgnore: input.useGitIgnore,
|
||||||
GitHubInstance: input.githubInstance,
|
GitHubInstance: input.githubInstance,
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,12 @@ func (rc *RunContext) jobContainerName() string {
|
||||||
func (rc *RunContext) GetBindsAndMounts() ([]string, map[string]string) {
|
func (rc *RunContext) GetBindsAndMounts() ([]string, map[string]string) {
|
||||||
name := rc.jobContainerName()
|
name := rc.jobContainerName()
|
||||||
|
|
||||||
|
if rc.Config.ContainerDaemonSocket == "" {
|
||||||
|
rc.Config.ContainerDaemonSocket = "/var/run/docker.sock"
|
||||||
|
}
|
||||||
|
|
||||||
binds := []string{
|
binds := []string{
|
||||||
fmt.Sprintf("%s:%s", "/var/run/docker.sock", "/var/run/docker.sock"),
|
fmt.Sprintf("%s:%s", rc.Config.ContainerDaemonSocket, "/var/run/docker.sock"),
|
||||||
}
|
}
|
||||||
|
|
||||||
mounts := map[string]string{
|
mounts := map[string]string{
|
||||||
|
|
|
@ -37,6 +37,7 @@ type Config struct {
|
||||||
Privileged bool // use privileged mode
|
Privileged bool // use privileged mode
|
||||||
UsernsMode string // user namespace to use
|
UsernsMode string // user namespace to use
|
||||||
ContainerArchitecture string // Desired OS/architecture platform for running containers
|
ContainerArchitecture string // Desired OS/architecture platform for running containers
|
||||||
|
ContainerDaemonSocket string // Path to Docker daemon socket
|
||||||
UseGitIgnore bool // controls if paths in .gitignore should not be copied into container, default true
|
UseGitIgnore bool // controls if paths in .gitignore should not be copied into container, default true
|
||||||
GitHubInstance string // GitHub instance to use, default "github.com"
|
GitHubInstance string // GitHub instance to use, default "github.com"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue