-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix: ensure networkmode "host" unless explicitly specified #1739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
@ZauberNerd this pull request has failed checks 🛠 |
Downloading node.js from nodejs.org failed with an HTTP error 500. Retriggering the test-linux checks fixed it. |
Codecov Report
@@ Coverage Diff @@
## master #1739 +/- ##
==========================================
+ Coverage 61.22% 62.41% +1.18%
==========================================
Files 46 48 +2
Lines 7141 7537 +396
==========================================
+ Hits 4372 4704 +332
- Misses 2462 2509 +47
- Partials 307 324 +17
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
In [nektos/pull/1739](nektos#1739), the container network mode defaults to `host` if the network option isn't specified in `options`. When calling `ConnectToNetwork`, the `host` network mode may cause the error: `Error response from daemon: container sharing network namespace with another container or host cannot be connected to any other network` see the code: https://gitea.com/gitea/act/src/commit/a94a01bff2576fcf9fefaf879ea09c11e383cdab/pkg/container/docker_run.go#L51-L68 To avoid the error, this logic needs to be removed to keep the default network mode as `bridge`. Reviewed-on: https://gitea.com/gitea/act/pulls/55 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
Using `act` [1]. However, act uses network mode `host` by default [2]. Multiple Cypress instances will check for X and start it, concurrently and not in an atomic way, causing issues. Container options specified in workflows and using --container-options *aren't* merged [3]. Furthermore, specifying a network option that works both on GHA and locally appears to be a bit tricky [4]. Thus, using `xvfb-run` to create a shared fb appears to be the easiest solution. However, `act` doesn't support env pass through, so we must parse `$DISPLAY` inside the xvfb environment in order to explicitly provide it to `act`. This would have all been unnecessary if `ELECTRON_RUN_AS_NODE` had even remotely worked [5]. [1] https://nektosact.com/ [2] nektos/act#1739 [3] nektos/act#1696 [4] nektos/act#1740 [5] cypress-io/cypress-documentation#5666
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.