Skip to content
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

fix: Rootless error concerning /var/run/docker.sock #2181

Merged
merged 40 commits into from
Feb 6, 2024

Conversation

AndesKrrrrrrrrrrr
Copy link
Contributor

Fixes #724
Fixes #2016

Copy link
Contributor

mergify bot commented Jan 30, 2024

⚠️ The sha of the head commit of this PR conflicts with #2178. Mergify cannot evaluate rules on this PR. ⚠️

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (5a80a04) 61.56% compared to head (e8d4192) 61.76%.
Report is 10 commits behind head on master.

Files Patch % Lines
pkg/container/docker_socket.go 85.52% 9 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2181      +/-   ##
==========================================
+ Coverage   61.56%   61.76%   +0.20%     
==========================================
  Files          53       54       +1     
  Lines        9002     9078      +76     
==========================================
+ Hits         5542     5607      +65     
- Misses       3020     3029       +9     
- Partials      440      442       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr marked this pull request as ready for review January 30, 2024 13:05
@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr requested a review from a team as a code owner January 30, 2024 13:05
Copy link
Contributor

mergify bot commented Jan 30, 2024

@AndesKrrrrrrrrrrr this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label Jan 30, 2024
@AndesKrrrrrrrrrrr
Copy link
Contributor Author

@ChristopherHX, do you mind taking a look? Tests are passing, but coverage diff is failing; the greater part of the modified files are untested and are CLI. Does test coverage apply here?

@ChristopherHX
Copy link
Contributor

ChristopherHX commented Jan 30, 2024

coverage diff is failing

My own PR's failing in that metric and requiring tests of old code.

I'm not the owner, converage wasn't configured by me (this check is required to pass, if the owner doesn't bypass the rules).
You can suggest to decrease the diff coverage target here https://github.com/nektos/act/blob/master/codecov.yml, if cplee agree's then we can do it.
Maybe it is possible to exclude the cli, but it seems your unrelated docker_run.go is causing the failure (I suggest to split it out into another PR).

Recently coverage metrics were broken, because it compared the diff with a over 400days old version of act, this allowed 0% diff coverage to pass.

@nektos nektos deleted a comment from mergify bot Jan 30, 2024
@mergify mergify bot removed the needs-work Extra attention is needed label Jan 30, 2024
@ChristopherHX
Copy link
Contributor

Coverage not affected when comparing 5a80a04...ee5a166

So yes it worked.

Copy link
Contributor

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess your change is okish

cmd/root.go Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team January 30, 2024 14:24
Copy link
Contributor

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found breaking change I don't like to see

cmd/root.go Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team January 30, 2024 16:47
Copy link
Contributor

mergify bot commented Feb 1, 2024

@AndesKrrrrrrrrrrr this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label Feb 1, 2024
ChristopherHX
ChristopherHX previously approved these changes Feb 1, 2024
Copy link
Contributor

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding tests, but one of them still fails.

I revoke my veto now

@AndesKrrrrrrrrrrr
Copy link
Contributor Author

I think we should be there... finally ❤️

Your code breaks setting DOCKER_HOST if shouldMount is false.

One thing, though, still bugs me about this comment above. Now that I've refactored shouldMount out, what is the intention here? I added a test (see 1) to verify this case, but no longer sure what is right. What should we do in this case?

🌮 DOCKER_HOST --container-daemon-socket Socket at common locations? Expectation
B) What I want Missing Missing Yes Use sane default socket & host
A) What your comment suggests Missing Missing Yes Only set DOCKER_HOST, not socket

Footnotes

  1. https://github.com/AndesKrrrrrrrrrrr/act/blob/b3566aacc4fd92cd4dd48332ce824a6c46f0031b/pkg/container/docker_socket_test.go#L94

@ChristopherHX
Copy link
Contributor

  • A is how it was before, because I was talking about things that no longer worked in some revisions
  • I agree B is better than A (would this has been your initial new behavior I wouldn't have commented about it)

@mergify mergify bot removed the needs-work Extra attention is needed label Feb 2, 2024
@mergify mergify bot requested a review from a team February 2, 2024 13:31
ChristopherHX
ChristopherHX previously approved these changes Feb 3, 2024
Copy link
Contributor

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, the comments about tests don't have to be addressed as they would still work.

pkg/container/docker_socket_test.go Outdated Show resolved Hide resolved
pkg/container/docker_socket_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

mergify bot commented Feb 5, 2024

@AndesKrrrrrrrrrrr this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label Feb 5, 2024
@AndesKrrrrrrrrrrr
Copy link
Contributor Author

Looking at the logs, it seems like unrelated tests are failing.

Passing -> swap test assertions -> other tests fail 🤔

@mergify mergify bot removed the needs-work Extra attention is needed label Feb 6, 2024
@mergify mergify bot merged commit f2e65e1 into nektos:master Feb 6, 2024
10 checks passed
@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr deleted the fix/docker-socket branch February 7, 2024 08:22
jmikedupont2 pushed a commit to meta-introspector/act that referenced this pull request Mar 10, 2024
* Use same socket defaulting strategy every time

* Always default to DOCKER_HOST

* Add more debug logs

* Commenting, and massively simplified socket logic

* Rever to upstream run_context.go

* Fix EACCESS error regarding /opt/hostedtoolcache

* Revert "Fix EACCESS error regarding /opt/hostedtoolcache"

This reverts commit b2a8394.

* Revert CLI debug logs

* Move socket and host handling to own function, and simplify logic

* Move to container package

* Make return be a struct

* Write tests to verify functionality

* Fix DOCKER_HOST being set to the string "DOCKER_HOST"

* Always use struct

* Use socketLocation, for DOCKER_HOST and more defaults

* Fixup arguments to GetSocketAndHost in test and root.go

* Un-struct hasDockerHost

* Fixup logic and set hasDockerHost

* Minor scoping & variable name change

* Move functionality to a new file

* Rename corresponding test

* Reviewfix

* Fix DOCKER_HOST expected

* Fix test assertions and add comments

* Swap comparison actual, expected

* Fixed no-DOCKER_HOST env test

* Fixed default socket test

* Add test to verify review comments

* Add more test for greater test coverage

* Consistent comment references

* Fix bug found while writing tests

* Passing tests

* NoMountNoHost testfix

* Rename test appropriately

* NoMount testfix

* Fixed OnlySocket

* Swap expected <-> actual in tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants