-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: use actions/runner hashfiles in container #1940
Conversation
Previously hashfiles ran on the host, this don't work for container generated content
@ChristopherHX this pull request has failed checks 🛠 |
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
@ChristopherHX this pull request has failed checks 🛠 |
Codecov Report
@@ Coverage Diff @@
## master #1940 +/- ##
==========================================
+ Coverage 61.22% 61.71% +0.49%
==========================================
Files 46 52 +6
Lines 7141 8544 +1403
==========================================
+ Hits 4372 5273 +901
- Misses 2462 2848 +386
- Partials 307 423 +116
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Co-authored-by: Jason Song <i@wolfogre.com>
I don't like vendoring hashfiles like this - make maintenance challenging. Is there other options? For example, can we use docker to copy the file out of container and then hash using existing function? |
Yes we could copy act itself into the container and exec act, if we add a hashfiles entrypoint. EDIT This creates a problem for my github-act-runner project, because it also need to implement that entrypoint and act may be 10MB or larger.
This would be inefficient, imagine you have a 5GB repo and need to copy it out of the container everytime you call hashfiles. |
You know actions/runner doesn't have this problem, because they use bind mounts. The workspace and home folder is accessible by the host (but not in act) While actions/runner has problems with ssh and tcp protocols (without hacks) this just works in act due to using docker volumes and file exchange by using docker cp. |
We could create a minimal golang build of the existing hashfiles implementation as a cli tool.
|
How can we ensure that the a cli tool can execute in all host environments? There may be some arch or os that are very unpopular, although they do not fully support running act, users may run some simple steps on them. Since actions always assume that the environment has nodejs, I prefer this PR which uses js to compute hash. |
Yes this is a problem, we cannot enshure this. I have plan9, solaris, openbsd and freebsd builds. In my runner.server code I inspect the docker image used to run to get it's docker platform and bind mount hopefully matching external tools and download them on use if they are missing. In .net I also runtime detect the os, arch and alpine via .net apis. I agree with wolfogre this sounds to be more maintenance work after all to use this as an alternative. I just vendored this file https://github.com/actions/runner/blob/main/src/Misc/layoutbin/hashFiles/index.js (removed trailing spaces and added a newline at the end to satify the linter) Sourcecode is here: https://github.com/actions/runner/tree/main/src/Misc/expressionFunc/hashFiles |
* fix: use actions/runner hashfiles in container Previously hashfiles ran on the host, this don't work for container generated content * fix: lint * fix: lint * fix assign follow symlink flag Co-authored-by: Jason Song <i@wolfogre.com> --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Previously hashfiles ran on the host,
this don't work for container generated content
Primary for github-act-runner and act_runner downstream projects, because they don't have a checkout on the host.
The src of hashfiles can be found in actions/runner. I don't see any legal issues both act and actions/runner use the same type of license.
Fixes #2014