mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
fix: ensure networkmode "host" unless explicitly specified (#1739)
act defaults network mode to "host", but when `--container-options` are passed on the CLI, it uses the docker CLI options parser, which fills empty values with defaults, in which case network mode is set to "default". Unless the user explicitly sets `--container-options="--network=xxx"`, we should always default to "host", to keep act's behaviour. Co-authored-by: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
8d2c320f7a
commit
1a239d7ab7
1 changed files with 6 additions and 0 deletions
|
@ -348,6 +348,12 @@ func (cr *containerReference) mergeContainerConfigs(ctx context.Context, config
|
|||
return nil, nil, fmt.Errorf("Cannot parse container options: '%s': '%w'", input.Options, err)
|
||||
}
|
||||
|
||||
if len(copts.netMode.Value()) == 0 {
|
||||
if err = copts.netMode.Set("host"); err != nil {
|
||||
return nil, nil, fmt.Errorf("Cannot parse networkmode=host. This is an internal error and should not happen: '%w'", err)
|
||||
}
|
||||
}
|
||||
|
||||
containerConfig, err := parse(flags, copts, "")
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("Cannot process container options: '%s': '%w'", input.Options, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue