act/pkg/runner/testdata
Sam Foo ceeb6c160c
Add support for service containers (#1949)
* Support services (#42)

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>

* Support services options (#45)

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>

* Support intepolation for `env` of `services` (#47)

Reviewed-on: https://gitea.com/gitea/act/pulls/47
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>

* Support services `credentials` (#51)

If a service's image is from a container registry requires authentication, `act_runner` will need `credentials` to pull the image, see [documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idservicesservice_idcredentials).
Currently, `act_runner` incorrectly uses the `credentials` of `containers` to pull services' images and the `credentials` of services won't be used, see the related code: 0c1f2edb99/pkg/runner/run_context.go (L228-L269)

Co-authored-by: Jason Song <i@wolfogre.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/51
Reviewed-by: Jason Song <i@wolfogre.com>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>

* Add ContainerMaxLifetime and ContainerNetworkMode options

from: b9c20dcaa4

* Fix container network issue (#56)

Follow: https://gitea.com/gitea/act_runner/pulls/184
Close https://gitea.com/gitea/act_runner/issues/177

- `act` create new networks only if the value of `NeedCreateNetwork` is true, and remove these networks at last. `NeedCreateNetwork` is passed by `act_runner`. 'NeedCreateNetwork' is true only if  `container.network` in the configuration file of the `act_runner` is empty.
- In the `docker create` phase, specify the network to which containers will connect. Because, if not specify , container will connect to `bridge` network which is created automatically by Docker.
  - If the network is user defined network ( the value of `container.network` is empty or `<custom-network>`.  Because, the network created by `act` is also user defined network.), will also specify alias by `--network-alias`. The alias of service is `<service-id>`. So we can be access service container by `<service-id>:<port>` in the steps of job.
- Won't try to `docker network connect ` network after `docker start` any more.
  - Because on the one hand,  `docker network connect` applies only to user defined networks, if try to `docker network connect host <container-name>` will return error.
  - On the other hand, we just specify network in the stage of `docker create`, the same effect can be achieved.
- Won't try to remove containers and networks berfore  the stage of `docker start`, because the name of these containers and netwoks won't be repeat.

Co-authored-by: Jason Song <i@wolfogre.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/56
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: sillyguodong <gedong_1994@163.com>
Co-committed-by: sillyguodong <gedong_1994@163.com>

* Check volumes (#60)

This PR adds a `ValidVolumes` config. Users can specify the volumes (including bind mounts) that can be mounted to containers by this config.

Options related to volumes:
- [jobs.<job_id>.container.volumes](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontainervolumes)
- [jobs.<job_id>.services.<service_id>.volumes](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idservicesservice_idvolumes)

In addition, volumes specified by `options` will also be checked.

Currently, the following default volumes (see a72822b3f8/pkg/runner/run_context.go (L116-L166)) will be added to `ValidVolumes`:
- `act-toolcache`
- `<container-name>` and `<container-name>-env`
- `/var/run/docker.sock` (We need to add a new configuration to control whether the docker daemon can be mounted)

Co-authored-by: Jason Song <i@wolfogre.com>
Reviewed-on: https://gitea.com/gitea/act/pulls/60
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>

* Remove ContainerMaxLifetime; fix lint

* Remove unused ValidVolumes

* Remove ConnectToNetwork

* Add docker stubs

* Close docker clients to prevent file descriptor leaks

* Fix the error when removing network in self-hosted mode (#69)

Fixes https://gitea.com/gitea/act_runner/issues/255

Reviewed-on: https://gitea.com/gitea/act/pulls/69
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>

* Move service container and network cleanup to rc.cleanUpJobContainer

* Add --network flag; default to host if not using service containers or set explicitly

* Correctly close executor to prevent fd leak

* Revert to tail instead of full path

* fix network duplication

* backport networkingConfig for aliaes

* don't hardcode netMode host

* Convert services test to table driven tests

* Add failing tests for services

* Expose service container ports onto the host

* Set container network mode in artifacts server test to host mode

* Log container network mode when creating/starting a container

* fix: Correctly handle ContainerNetworkMode

* fix: missing service container network

* Always remove service containers

Although we usually keep containers running if the workflow errored
(unless `--rm` is given) in order to facilitate debugging and we have
a flag (`--reuse`) to always keep containers running in order to speed
up repeated `act` invocations, I believe that these should only apply
to job containers and not service containers, because changing the
network settings on a service container requires re-creating it anyway.

* Remove networks only if no active endpoints exist

* Ensure job containers are stopped before starting a new job

* fix: go build -tags WITHOUT_DOCKER

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: sillyguodong <gedong_1994@163.com>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: ZauberNerd <zaubernerd@zaubernerd.de>
2023-10-19 09:24:52 +00:00
..
.github/workflows fix: reusable workflow panic (#1728) 2023-04-13 13:47:59 +00:00
GITHUB_ENV-use-in-env-ctx refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
GITHUB_STATE refactor: fix savestate in pre steps (#1466) 2022-12-15 17:08:31 +00:00
act-composite-env-test refactor: remove composite action runcontext workaround (#1085) 2022-05-11 19:06:05 +00:00
actions feat: support node20 runtime (#1988) 2023-09-15 02:24:46 +00:00
actions-environment-and-context-tests Pass dockerfile to build executor (#1606) 2023-02-08 17:14:43 +00:00
basic feat: add node16 support (#922) 2021-12-22 19:34:18 +00:00
checkout Hotfix: Skip Checkout Regression (#680) 2021-05-10 15:12:57 +00:00
commands Update images, fix extrapath (#723) 2021-06-10 23:12:05 +00:00
composite-fail-with-output fix: set composite outputs on failure (#945) 2022-01-21 08:08:30 -08:00
container-hostname fix: support docker create arguments from container.options (#1022) (#1351) 2022-10-06 22:09:43 +00:00
defaults-run Support setting shell via defaults.run (#343) 2020-08-28 11:52:25 -07:00
dir with spaces Add proper support for working-directory & fix command builder (#772) 2021-08-10 19:40:20 +00:00
do-not-leak-step-env-in-composite refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
docker-action-custom-path refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
ensure-post-steps fix: ensure all post steps are executed (#1286) 2022-07-29 19:43:24 +00:00
env-and-path Fixes #1387 (#1388) 2022-10-18 22:27:28 +00:00
environment-files refactor: share UpdateFromEnv logic (#1457) 2022-12-06 16:19:27 +00:00
environment-files-parser-bug refactor: share UpdateFromEnv logic (#1457) 2022-12-06 16:19:27 +00:00
environment-variables fix: handle env-vars case sensitive (#1493) 2022-12-07 15:31:33 +00:00
evalenv Made env interpolated instead of evaluated. (#1222) 2022-07-27 19:46:04 +00:00
evalmatrix fix: processing of strategy.matrix.include (#1200) 2022-06-20 15:33:07 -07:00
evalmatrix-merge-array fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
evalmatrix-merge-map fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
evalmatrixneeds fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
evalmatrixneeds2 fix: deep evaluate matrix strategy (#964) 2022-02-15 16:35:02 +00:00
fail feat: add node16 support (#922) 2021-12-22 19:34:18 +00:00
if-env-act Test: env.ACT in if condition of the workflow (#965) 2022-01-25 09:27:27 -08:00
if-expressions fix: continue jobs + steps after failure (#840) 2021-12-08 20:57:42 +00:00
input-from-cli Input (#1524) 2023-01-13 19:28:17 +00:00
inputs-via-env-context fix: step env is unavailable in with property expr (#1458) 2022-12-06 16:46:20 +00:00
issue-104 fix: ci is failing since 2022-10-17 (#1397) 2022-10-17 16:03:17 +00:00
issue-122 fix #122 - support actions/checkout for repos other the one for this workflow (#143) 2020-03-09 17:45:42 -07:00
issue-141 fix #141 - use host network to match GitHub Actions runners (#142) 2020-03-09 17:43:24 -07:00
issue-597 Expression evaluator fixes (#1009) 2022-02-25 18:39:50 +00:00
issue-598 Fixes #598 (#628) 2021-05-05 13:04:03 -07:00
issue-1195 pkg/runner: add support to replace GitHub's env (#1197) 2022-06-08 15:25:51 +00:00
issue-1595 fix: tolerate workflow that needs a missing job (#1595) (#1619) 2023-02-16 16:41:59 +00:00
job-container feat: add node16 support (#922) 2021-12-22 19:34:18 +00:00
job-container-invalid-credentials fix: crash on invalid docker credentials (#1348) 2022-09-26 06:17:06 +00:00
job-container-non-root fix: use docker images from dockerhub (#1249) 2022-07-08 00:21:51 +00:00
job-needs-context-contains-result feat: Support "result" on "needs" context. (#1497) 2022-12-19 08:37:53 +00:00
job-nil-step fix: panic if a step in a job is nil (#1145) 2022-05-12 19:23:34 +00:00
job-status-check fix: continue jobs + steps after failure (#840) 2021-12-08 20:57:42 +00:00
local-action-docker-url Refactor local, composite actions and run steps (#712) 2021-06-10 15:28:23 +00:00
local-action-dockerfile Feature: uses in composite (#793) 2021-12-22 19:19:50 +00:00
local-action-js feat: support node20 runtime (#1988) 2023-09-15 02:24:46 +00:00
local-action-via-composite-dockerfile fix: ci is failing since 2022-10-17 (#1397) 2022-10-17 16:03:17 +00:00
localdockerimagetest_ Fix docker: invalid reference format (#767) 2021-08-09 18:16:31 +00:00
mask-values Improve logging (#1171) 2022-06-17 15:55:21 +00:00
matrix fix #108 - ensure container names are unique for matrix runs 2020-03-04 16:24:14 -08:00
matrix-exitcode fix: preserve job result state in case of failure (#1519) 2023-01-10 21:31:12 +00:00
matrix-include-exclude Fixes include when using matrix and strategy build. (#415) 2020-12-08 10:13:07 -08:00
matrix-with-user-inclusions feat: specify matrix on command line (#1675) 2023-03-19 17:25:55 +00:00
networking test: add test for networking setup in act (#1375) 2022-10-12 16:30:56 +00:00
nix-prepend-path feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
no-panic-on-invalid-composite-action fix: crash malformed composite action (#1616) 2023-02-23 22:16:07 +00:00
node fix: #170 add RUNNER_TEMP 2020-04-23 08:18:36 -07:00
non-existent-action Fix: regression run after failure (#971) 2022-01-27 16:20:44 +00:00
outputs Don't interpolate joboutputs, before job is done (#894) 2021-11-24 15:49:08 +00:00
parallel feat: add node16 support (#922) 2021-12-22 19:34:18 +00:00
path-handling fix: extra path lost in composite actions (#1531) 2023-01-10 21:55:05 +00:00
pull-request fix: keep path to event json file in composite actions (#1428) 2022-11-16 17:00:49 +00:00
python fix #100 - change RUNNER_TOOL_CACHE to /opt/hostedtoolcache (#103) 2020-02-25 08:52:04 -08:00
remote-action-composite-action-ref fix action_ref (composite action) (#2020) 2023-10-03 23:13:05 +00:00
remote-action-composite-js-pre-with-defaults fix: missing defaults in nodejs pre (#1349) 2022-09-26 06:08:08 +00:00
remote-action-docker fix: ci is failing since 2022-10-17 (#1397) 2022-10-17 16:03:17 +00:00
remote-action-js actions/hello-world-javascript-action@master moved to main, use stable tag (#326) 2020-08-01 19:05:25 -07:00
remote-action-js-node-user fix: crash if the id tool fails to run in the container (1660) 2023-03-08 14:41:25 +00:00
runs-on Add support for runs-on array form (closes #146) (#155) 2020-03-16 14:58:10 -07:00
secrets feat: load every environment from --env-file to workflow (#184) 2020-04-17 10:04:40 -07:00
services Support services (#42) 2023-04-19 11:23:28 +08:00
services-host-network Add support for service containers (#1949) 2023-10-19 09:24:52 +00:00
services-with-container Add support for service containers (#1949) 2023-10-19 09:24:52 +00:00
set-env-new-env-file-per-step refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
set-env-step-env-override refactor: GITHUB_ENV command / remove env.PATH (#1503) 2023-02-04 13:35:13 +00:00
shells fix: use docker images from dockerhub (#1249) 2022-07-08 00:21:51 +00:00
steps-context Add more steps context support (#887) 2021-11-27 17:55:26 +00:00
uses-action-with-pre-and-post-step implement pre and post steps (#1089) 2022-05-24 13:36:06 +00:00
uses-and-run-in-one-step fix: return error if both `run:`/`uses:` keys are used (#593) 2021-04-01 11:36:41 -07:00
uses-composite Fix composite input handling (#1345) 2022-10-06 21:58:16 +00:00
uses-composite-with-error Feature: uses in composite (#793) 2021-12-22 19:19:50 +00:00
uses-composite-with-inputs fix: re-evaluate env for remote composite actions (#1385) 2022-10-12 16:19:32 +00:00
uses-composite-with-pre-and-post-steps implement pre and post steps (#1089) 2022-05-24 13:36:06 +00:00
uses-docker-url fix: don't overwrite with empty cmd/entrypoint (#1076) 2022-03-29 18:00:52 +00:00
uses-github-empty Throw an error if the steps has a invalid uses directive (#500) 2021-01-23 08:07:28 -08:00
uses-github-full-sha refactor: return more errors, add more tests (#679) 2021-05-08 03:29:03 +00:00
uses-github-noref Throw an error if the steps has a invalid uses directive (#500) 2021-01-23 08:07:28 -08:00
uses-github-path Throw an error if the steps has a invalid uses directive (#500) 2021-01-23 08:07:28 -08:00
uses-github-root Throw an error if the steps has a invalid uses directive (#500) 2021-01-23 08:07:28 -08:00
uses-github-short-sha refactor: return more errors, add more tests (#679) 2021-05-08 03:29:03 +00:00
uses-nested-composite fix: add-matcher fails github workflow (#1532) 2023-01-13 17:01:40 +00:00
uses-workflow fix: reusable workflow panic (#1728) 2023-04-13 13:47:59 +00:00
windows-add-env prefer pwsh on windows if found (#1942) 2023-08-08 14:14:46 +00:00
windows-prepend-path fix: environment handling windows (host mode) (#1732) 2023-04-18 18:09:57 +00:00
windows-shell-cmd feat: cmd support for windows (#1941) 2023-08-08 15:44:25 +00:00
workdir Make sure working directory is respected when configured from matrix (#1686) 2023-03-28 12:24:03 +00:00
workflow_call_inputs Allow inputs for workflow_calls (#1845) 2023-06-27 17:32:04 +00:00
workflow_dispatch Mapping `workflow_dispatch` inputs into the Expression `inputs` context (#1363) 2022-10-17 16:25:26 +00:00
workflow_dispatch-scalar fix: nil pointer access ( workflow_dispatch ) 2022-11-10 20:16:00 +00:00
workflow_dispatch-scalar-composite-action fix: nil pointer access ( workflow_dispatch ) 2022-11-10 20:16:00 +00:00
workflow_dispatch_no_inputs_mapping fix: nil pointer access ( workflow_dispatch ) 2022-11-10 20:16:00 +00:00