Add support for service containers#1949
Conversation
|
@GuessWhoSamFoo this pull request has failed checks 🛠 |
00f0139 to
b858cd2
Compare
|
@GuessWhoSamFoo this pull request has failed checks 🛠 |
b858cd2 to
a4792b3
Compare
|
@GuessWhoSamFoo this pull request has failed checks 🛠 |
a4792b3 to
b74a929
Compare
|
Not sure what is up with the artifact upload/download test. Maybe there's a side effect somewhere, gonna have to investigate later EDIT: Realized it's because |
b74a929 to
de466a6
Compare
Codecov Report
@@ Coverage Diff @@
## master #1949 +/- ##
==========================================
+ Coverage 61.22% 61.45% +0.23%
==========================================
Files 46 53 +7
Lines 7141 8774 +1633
==========================================
+ Hits 4372 5392 +1020
- Misses 2462 2953 +491
- Partials 307 429 +122
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
LGTM, and I believe more practical tests are needed.
Some notes for other reviewers:
- Services always run in containers, so docker will be required to run services (even run jobs in host mode).
- It will create a new docker network for service containers, and let the job container join the network. And delete the network when it has done.
- IIRC, there will be some problems to conntect to serivces when runing jobs in host mode without job containers. Since there's no job container, it's impossible to let the job container join the network.
- A new docker network make it possible to let services bind any ports without conflict, however, it also make things more complex. (That's why the team of Gitea are cautious to port it upstream)
- IIRC, act will keep the job container to reuse (while gitea/act never reuse), I'm not sure if the network could be used and deleted correctly.
- Docker can only provide a limited number of networks, so the network must be deleted timely.
|
Please create stubs for NewDockerNetworkCreateExecutor, NewDockerNetworkRemoveExecutor returning an empty noop executor. In this file: https://github.com/nektos/act/blob/master/pkg/container/docker_stub.go I rely on extended platform support, where docker libraries does not compile. (see build tags) Seems like CI tests should be extended to test this |
There was a problem hiding this comment.
This has been a static code review from my side, I haven't tested anything locally.
IIRC, there will be some problems to conntect to serivces when runing jobs in host mode without job containers. Since there's no job container, it's impossible to let the job container join the network.
Yeah that's why GitHub advise to use a job container, the ports section is used to expose ports in that case and also allows assigning an random port.
|
Actually it makes sense to just merge this change, otherwise act may never has this feature. |
|
@ChristopherHX Thanks for the review - I'll take a closer look if something got missed in the backport and likely want to explicitly test https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idservicesservice_idvolumes as well |
There was a problem hiding this comment.
I found a file descriptor leak, this have to be fixed in my opinion.
I opened a gitea/act issue about this: https://gitea.com/gitea/act/issues/76
If you don't use act with very large workflows or in watch mode for a long time you won't notice the consequences of this code.
Yes act had this problem on more places, before I fixed them all. In 2021 the fd leak per job was very large, but due to high limits you didn't see any errors in short term.
de466a6 to
7a29ed9
Compare
|
@wolfogre @ChristopherHX Still missing some tests, but wanted to run by the feedback so far. The I have also thought about creating a network name by convention and re-using instead. Higher chance of port conflicts but less complexity |
ChristopherHX
left a comment
There was a problem hiding this comment.
All good now for me
Does gitea/act provide contextdata for services? If not it's also ok for me
Removed createSimpleContainerName and AutoRemove flag Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act/pulls/42 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/45 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
|
PR to update the documentation accordingly: nektos/act-docs#30 |
Closes #173
This PR cherry picks:
https://gitea.com/gitea/act/pulls/50 is not moved over as it does not exist as a Github Action feature.
Gitea specific features such as
createSimpleContainerNameand theAutoRemoveflag was removed during this process. In addition,ContainerMaxLifetimeis also removed as since running/bin/sleep 0by default can be confusing and doesn't seem to have a use case outside of usage as an sdk.