8000 fix: ensure networkmode "host" unless explicitly specified by ZauberNerd · Pull Request #1739 · nektos/act · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

ZauberNerd
Copy link
Contributor

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.

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>
@ZauberNerd ZauberNerd requested a review from a team as a code owner April 18, 2023 12:35
@github-actions
Copy link
Contributor
github-actions bot commented Apr 18, 2023

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 1 0 0.02s
✅ REPOSITORY gitleaks yes no 2.88s
✅ REPOSITORY git_diff yes no 0.01s
✅ REPOSITORY secretlint yes no 1.6s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@mergify
Copy link
Contributor
mergify bot commented Apr 18, 2023

@ZauberNerd this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label Apr 18, 2023
@ZauberNerd
Copy link
Contributor Author

@ZauberNerd this pull request has failed checks hammer_and_wrench

Downloading node.js from nodejs.org failed with an HTTP error 500. Retriggering the test-linux checks fixed it.

@codecov
Copy link
codecov bot commented Apr 18, 2023

Codecov Report

Merging #1739 (2f7221b) into master (4989f44) will increase coverage by 1.18%.
The diff coverage is 66.70%.

@@            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     
Impacted Files Coverage Δ
pkg/common/outbound_ip.go 0.00% <0.00%> (ø)
pkg/container/docker_cli.go 82.23% <ø> (ø)
pkg/container/docker_logger.go 52.08% <ø> (ø)
pkg/container/docker_pull.go 33.33% <ø> (ø)
pkg/container/docker_run.go 13.99% <0.00%> (+0.40%) ⬆️
pkg/container/docker_volume.go 0.00% <ø> (ø)
pkg/container/file_collector.go 39.68% <0.00%> (+2.38%) ⬆️
pkg/container/host_environment.go 0.00% <0.00%> (ø)
pkg/exprparser/functions.go 66.32% <0.00%> (-1.04%) ⬇️
pkg/model/workflow.go 41.68% <13.33%> (-0.44%) ⬇️
... and 21 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mergify mergify bot removed the needs-work Extra attention is needed label Apr 18, 2023
@mergify mergify bot merged commit de06444 into master Apr 18, 2023
@mergify mergify bot deleted the default-networkmode-host branch April 18, 2023 14:38
makrsmark pushed a commit to makrsmark/act that referenced this pull request Aug 3, 2023
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>
badeball added a commit to badeball/cypress-cucumber-preprocessor that referenced this pull request Apr 28, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0