summaryrefslogtreecommitdiffstats
path: root/pkg/runner (follow)
Commit message (Collapse)AuthorAgeFilesLines
* fix: do not ignore the config container.options when starting a jobEarl Warren2025-01-111-1/+1
|
* chore(refactor): split Options into ConfigOptions & JobOptionsEarl Warren2025-01-092-5/+10
| | | | | They are both command line options to be parsed as if provided to docker-run, but they are not to be trusted in the same way.
* feat: export runtime token as FORGEJO_TOKENxtex2025-01-042-0/+2
|
* chore(lint): fix lint errorsEarl Warren2024-12-305-28/+4
| | | | | | | | | - upgrade to golangci-lint@v1.62.2 - make it renovate friendly - remove most frequent lint check that are not of consequence (unused args, etc.) - fix remaining lint errors - add renovate custom manager to update the Makefile variable
* fix: log skipped job and step result as info instead of debugEarl Warren2024-11-215-5/+52
| | | | | This allows the Forgejo runner to obtain the job result from the logs even when it is not in debug mode.
* fix: [FORGEJO] do not share the act-toolcache volumeEarl Warren2024-11-201-4/+1
| | | | | | | | | In the context of Forgejo the act-toolcache must not be mounted otherwise independent workflows will race against each other when writing to it. For instance if a setup-go action is run at the same time as another, there is a probability that they both write the same file at the same time, which could lead to a truncated or invalid content.
* [FORGEJO] a network of "" is not the same as "host"Earl Warren2024-03-241-8/+1
| | | | | | | | | | The comment that introduced this change suggests it was motivated by a border case by which the image would be empty. It is however unclear why it should have any impact on how the network name is determined. The hunk is reverted. https://github.com/nektos/act/pull/1949/files#r1315163582
* [FORGEJO] Revert "Don't set GITHUB_TOKEN (#2089)"v1.20.0Earl Warren2024-03-112-0/+2
| | | | | | It is a breaking change. This reverts commit 18b4714e38d4871947eff0acb7f1c8f4625fda9f.
* [FORGEJO] feat(docker): Add flag to enable IPv6 in auto-created networks (#24)s3lph2024-03-112-7/+10
| | | | | | | | | Implements one part of forgejo/runner#119. The other part is a corresponding PR in forgejo/runner: forgejo/runner#120. Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/24 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: s3lph <codeberg@s3lph.me> Co-committed-by: s3lph <codeberg@s3lph.me>
* [LXC] global lock on startEarl Warren2024-03-111-0/+2
| | | | | | Since the start script may create LXC templates that are shared, they may race against each other when running for the first time. A lock global to the host needs to be used to guarantee that does not happen.
* [LXC] split platform into template, release and configEarl Warren2024-03-111-25/+50
|
* [FORGEJO] implement lxc separately from self-hostedEarl Warren2024-03-111-58/+71
|
* [FORGEJO] wrap self-hosted platform steps in an LXC containerEarl Warren2024-03-111-3/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | act PR https://github.com/nektos/act/pull/1682 * shell script to start the LXC container * create and destroy a LXC container * run commands with lxc-attach * expose additional devices for docker & libvirt to work * install node 16 & git for checkout to work [FORGEJO] start/stop lxc working directory is /tmp [FORGEJO] use lxc-helpers to create/destroy containers [FORGEJO] do not setup LXC (cherry picked from commit c2eaf440f591cc8800ff59fef9e155d2904e0e37) Conflicts: pkg/container/host_environment.go Conflicts: pkg/container/host_environment.go [FORGJEO] upgrade to node20
* [FORGEJO] sync lxc-helpers 231215c11d38df793521766dcce0e80e824614caEarl Warren2024-03-112-0/+599
|
* Support cloning remote actions from insecure Gitea instances (#92)Zettat1232024-03-052-0/+19
| | | | | | | | | Related to https://github.com/go-gitea/gitea/issues/28693 Reviewed-on: https://gitea.com/gitea/act/pulls/92 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
* Patched options() to let container options propagate to job containers (#80)Claudio Nicora2024-03-041-1/+1
| | | | | | | | | | | | | | This PR let "general" container config to be propagated to each job container. See: - https://gitea.com/gitea/act_runner/issues/265#issuecomment-744382 - https://gitea.com/gitea/act_runner/issues/79 - https://gitea.com/gitea/act_runner/issues/378 Reviewed-on: https://gitea.com/gitea/act/pulls/80 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Claudio Nicora <claudio.nicora@gmail.com> Co-committed-by: Claudio Nicora <claudio.nicora@gmail.com>
* Merge branch 'nektos/master' into bump-nektosChongyi Zheng2024-02-1714-114/+424
|\
| * fix: use correct path to toolcache (#1494)Markus Wolf2024-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | The toolcache on GitHub Actions need to be in /opt/hostedtoolcache. This is the case for all environment variables set by act, but it's not the case for the volume mounted into the container. Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de> Co-authored-by: ChristopherHX <christopher.homberger@web.de> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * fix: improve new-action-cache fetch failure error (#2172)ChristopherHX2024-01-282-2/+8
| | | | | | | | | | | | | | - include repoURL and repoRef in error - map NoErrAlreadyUptodate to `couldn't find remote ref` for branchOrtag fetch request Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * fix: subpath actions via new artifact cache (#2170)ChristopherHX2024-01-282-9/+10
| | | | | | Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * fix: improve action not found error (#2171)ChristopherHX2024-01-281-6/+18
| |
| * feat: support offline mode (#2128)TKaxv_7S2024-01-203-8/+11
| | | | | | | | | | | | | | | | | | * Add: Actions Offline Mode * Add: Actions Offline Mode --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * feat: cli option to enable the new action cache (#1954)ChristopherHX2024-01-206-9/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Enable the new action cache * fix * fix: CopyTarStream (Docker) * suppress panic in test * add a cli option for opt in * fixups * add package * fix * rc.Config nil in test??? * add feature flag * patch * Fix respect --action-cache-path Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de> * add remote reusable workflow to ActionCache * fixup --------- Co-authored-by: Björn Brauer <zaubernerd@zaubernerd.de> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * Fix noisy `runs-on` error logging (#2102)Jon Jensen2023-12-171-1/+4
| | | | | | | | | | | | | | | | | | | | Move the logging back up a level to fix a minor logging issue introduced in #2088 `RunContext`s for composite actions have dummy/blank `Job`s with no `runs-on`, meaning their calls to `withGithubEnv` would result in an inaccurate log message complaining that `'runs-on' key not defined in ...` Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * Evaluate if condition when calling a reusable workflow (#2087)Jon Jensen2023-11-122-2/+15
| | | | | | | | Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: ChristopherHX <christopher.homberger@web.de>
| * Evaluate all service values (#2054)Björn Brauer2023-11-121-4/+13
| | | | | | Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * Don't set GITHUB_TOKEN (#2089)Jon Jensen2023-11-122-2/+0
| | | | | | | | | | This needs to be explicitly in the `env` to be consistent with GitHub Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * Support array expressions in runs-on (#2088)Jon Jensen2023-11-122-16/+65
| | | | | | | | | | | | | | | | | | * Support array expressions in runs-on * Simplify appproach to use EvaluateYamlNode, fix case-sensitivity bug --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * Use unique name for reusable workflow (#2015)Andreas Taylor2023-11-121-1/+1
| | | | | | Co-authored-by: ChristopherHX <christopher.homberger@web.de>
| * Add support for service containers (#1949)Sam Foo2023-10-197-67/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: https://gitea.com/gitea/act/src/commit/0c1f2edb996a87ee17dcf3cfa7259c04be02abd7/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: https://gitea.com/gitea/act/commit/b9c20dcaa43899cb3bb327619d447248303170e0 * 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 https://gitea.com/gitea/act/src/commit/a72822b3f83d3e68ffc697101b713b7badf57e2f/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>
* | Merge remote-tracking branch 'upstream/master' into bump-nektostechknowlogick2023-10-116-10/+5200
|\|
| * fix action_ref (composite action) (#2020)ChristopherHX2023-10-044-2/+16
| | | | | | Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * fix: use actions/runner hashfiles in container (#1940)ChristopherHX2023-10-042-8/+5184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* | Merge nektos/act/v0.2.51techknowlogick2023-09-241499-371/+463134
|\|
| * feat: support node20 runtime (#1988)Oliver Bell2023-09-15502-5/+160196
| | | | | | | | | | | | | | | | | | | | | | * feat: support node20 * fix * more fixes * maybe final fixes? * format
| * feat: support interpolation in `<job>.container.options` (#1958)Elian Doran2023-09-121-4/+4
| |
| * refactor: remove unnecessary nil check in RunContext (#1955)Eng Zer Jun2023-08-091-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | From the Go docs: "For a nil slice, the number of iterations is 0" [1] Therefore, an additional nil check for `job.RunsOn()` before the loop is unnecessary because `job.RunsOn()` returns a `[]string`. [1]: https://go.dev/ref/spec#For_range Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
| * feat: Add new Action Cache (#1913)ChristopherHX2023-08-082-0/+214
| | | | | | | | | | | | | | | | | | | | | | * feat: Add new Action Cache * fix some linter errors / warnings * fix lint * fix empty fpath parameter returns empty archive * rename fpath to includePrefix
| * feat: cmd support for windows (#1941)ChristopherHX2023-08-083-1/+16
| | | | | | Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * refactor: docker build BuildContext field (#1914)ChristopherHX2023-08-081-7/+11
| | | | | | | | | | The old Container input parameter was not flexible enough Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * prefer pwsh on windows if found (#1942)ChristopherHX2023-08-082-10/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | * prefer pwsh on windows if found prefer bash over sh if found One windows test no longer defines a default shell to test if it's pwsh * add dep --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
| * build(deps): bump megalinter/megalinter from 7.1.0 to 7.2.1 (#1931)dependabot[bot]2023-08-08990-335/+302649
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bumps [megalinter/megalinter](https://github.com/megalinter/megalinter) from 7.1.0 to 7.2.1. - [Release notes](https://github.com/megalinter/megalinter/releases) - [Changelog](https://github.com/oxsecurity/megalinter/blob/main/CHANGELOG.md) - [Commits](https://github.com/oxsecurity/megalinter/compare/v7.1.0...v7.2.1) --- updated-dependencies: - dependency-name: megalinter/megalinter dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
* | Merge tag 'nektos/v0.2.49'Jason Song2023-08-0217-56/+176
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: cmd/input.go go.mod go.sum pkg/exprparser/interpreter.go pkg/model/workflow.go pkg/runner/expression.go pkg/runner/job_executor.go pkg/runner/runner.go
| * Add new CLI flag to log just the job id and not the entire job name (#1920)Thomas Eddy2023-07-192-9/+26
| | | | | | | | | | * Add new CLI flag to log just the job id and not the entire job name * Up the action test timeout to 20m from 15m
| * throw when invalid `uses` key is provided (#1804)Josh McCullough2023-07-112-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * throw if `uses` is invalid * update JobType to return error * lint * put //nolint:dupl on wrong test * update error message to remove end punctuation * lint * update remote job type check * move if statement * rm nolint:dupl ... we'll see how that goes --------- Co-authored-by: Casey Lee <cplee@nektos.com>
| * chore: upgrade golangci-lint and address findings (#1904)Casey Lee2023-07-1112-28/+28
| |
| * Allow inputs for workflow_calls (#1845)Sam Foo2023-06-274-0/+60
| |
| * Allow to override location of action cache dir (#1863)Marius Zwicker2023-06-152-0/+4
| | | | | | | | | | | | | | | | Adds an option to specify the directory below which actions and host workspaces will be stored. If left empty the previous location at $XDG_CACHE_HOME/act or $HOME/.cache/act will be used respectively. Co-authored-by: Casey Lee <cplee@nektos.com>
| * feature: Add support for github action variables (#1833)Kuan Yong2023-06-103-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feature: Add support for github action variables * add --var flag for github variables * unitests: Updated unittests to cover vars context. * Remove syntax extension for vars and correct unit tests * Update pkg/runner/expression.go Co-authored-by: ChristopherHX <christopher.homberger@web.de> --------- Co-authored-by: kuanyong-wong-partior <kuanyong.wong@partior.com> Co-authored-by: ChristopherHX <christopher.homberger@web.de>
| * Fix bug in processing jobs on platforms without Docker (#1834)psa2023-06-061-8/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Log incoming jobs. Log the full contents of the job protobuf to make debugging jobs easier * Ensure that the parallel executor always uses at least one thread. The caller may mis-calculate the number of CPUs as zero, in which case ensure that at least one thread is spawned. * Use runtime.NumCPU for CPU counts. For hosts without docker, GetHostInfo() returns a blank struct which has zero CPUs and causes downstream trouble. --------- Co-authored-by: Paul Armstrong <psa@users.noreply.gitea.com> Co-authored-by: Jason Song <i@wolfogre.com>