summaryrefslogtreecommitdiffstats
path: root/internal/app/run/runner.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* expose "ForceRebuild" as a config optiongratux2024-12-291-1/+1
|
* Merge pull request 'Rebrand container prefix to Forgejo' (#377) from ↵earl-warren2024-12-151-1/+1
|\ | | | | | | | | | | | | fnetx/rebrand-prefix into main Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/377 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
| * Rebrand container prefix to ForgejoOtto Richter2024-12-091-1/+1
| |
* | feat: use FORGEJO_TOKEN as runtime tokenxtex2024-12-131-1/+3
|/ | | | Link: https://codeberg.org/forgejo/forgejo/pulls/6199
* Cherry-pick gitea act_runner #543Kwonunn2024-11-031-0/+4
| | | | | | | | | | From: https://gitea.com/gitea/act_runner/commit/1735b26e66f8e81c526204c128f1bcfd7f578906 Don't log job output when debug logging is not enabled We wanted the ability to disable outputting the logs from the individual job to the console. This changes the logging so that job logs are only output to the console whenever debug logging is enabled in `act_runner`, while still allowing the `Reporter` to receive these logs and forward them to Gitea when debug logging is not enabled. Signed-off-by: Kwonunn <kwonunnx@gmail.com>
* Add configurable logging level for jobsThorben Günther2024-11-021-0/+9
| | | | | | This changes the default for JobLoggerLevel from "trace" to "info". Closes #298
* chore: bump actions-proto-go to v0.4.0Mike Rochefort2024-07-311-1/+1
| | | | | | | bufbuild/connect-go was archived with maintenance transferred to the ConnectRPC organization. Gitea's protobuf library for actions now uses the ConnectRPC dependency as of v0.4.0, removing the need to continue using the dead package.
* Add report_interval option to configLennart Austenfeld2024-07-271-1/+1
|
* wait for jobs to complete when stopping the runnerEarl Warren2024-06-071-0/+4
| | | | | | | | | | | | | | | | When receiving a signal (INT or TERM) wait for running jobs to complete instead of terminating them right away. The new shutdown_timeout configuration setting can be used to force the termination after a grace delay. If not specified or zero it will shutdown immediately, for backward compatibility. It will be the case with existing configuration files or when a configuration file is not specified. The config.yml created with the generate-config subcommand will however default shutdown_timeout to 3h (same as timeout) because it is likely what a new admin would expect: shutting down waits for jobs to complete and not abort them.
* Add support for workflow inputsMai-Lapyst2024-05-241-0/+8
| | | | | | | | | This is a somewhat "hacky" way; it copies the inputs from the "event" object's "inputs" field when the event is a "workflow_dispatch". But this way we do not need to change the protobuf powered runner protocol to also include the inputs. Espc. since they're also present inside the event anyway.
* add label change post runner creationTheFox0x72024-04-101-0/+4
|
* Support cloning remote actions from insecure Gitea instances (#508)Earl Warren2024-03-111-0/+1
| | | | (cherry picked from commit 75006a59cc4e6d18653926ec2578de5072ba6c32)
* Add ACTIONS_RESULTS_URL to env (#473)Christopher Homberger2024-03-111-0/+1
| | | | | | | | | | | | | actions/upload-artifact@v4 and actions/download-artifact@v4 depend on this variable BaseUrl in a url are ignored by the nodejs code of the new actions, so this change doesn't append the path of the older `ACTIONS_RUNTIME_URL`. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/473 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de> (cherry picked from commit e14f42c40ac91d032c6a7c3e912646e55b2031a8)
* Use artifacts v4 jwt if available (#471)Christopher Homberger2024-03-111-2/+6
| | | | | | | | | | | | | | Needs https://github.com/go-gitea/gitea/pull/28885 to provide jwt if sent by server Could fix #459, but that has not been verified. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/471 Reviewed-by: delvh <dev.lh@web.de> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de> (cherry picked from commit e6630e2e369f41fc9d9f9e570610611da18dda1d)
* feat(docker): Add flag to enable IPv6 in auto-created networkss3lph2023-11-141-22/+23
|
* [FORGEJO] no double / in WorkDir, it would fail local actionsEarl Warren2023-08-231-1/+1
|
* [FORGEJO] GITHUB_SERVER_URL is always the runner registration addrEarl Warren2023-08-231-0/+7
|
* Add ForcePull option (#339)Gianni Angelozzi2023-08-171-1/+1
| | | | | | | | | | | Close #271 What it does: instead of forcing the value of `ForcePull` to false, the user can now configure it on the runner yaml Reviewed-on: https://gitea.com/gitea/act_runner/pulls/339 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Gianni Angelozzi <gianni@sistema3.it> Co-committed-by: Gianni Angelozzi <gianni@sistema3.it>
* ci(lint): refactor code for clarity and linting compliance (#289)Bo-Yi Wu2023-07-131-3/+2
| | | | | | | | | | | | | | | | - Removed `deadcode`, `structcheck`, and `varcheck` linters from `.golangci.yml` - Fixed a typo in a comment in `daemon.go` - Renamed `defaultActionsUrl` to `defaultActionsURL` in `exec.go` - Removed unnecessary else clause in `exec.go` and `runner.go` - Simplified variable initialization in `exec.go` - Changed function name from `getHttpClient` to `getHTTPClient` in `http.go` - Removed unnecessary else clause in `labels_test.go` Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/289 Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com> Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Run as cache server (#275)Zettat1232023-07-071-10/+14
| | | | | | | | | | This PR - adds the `cache-server` command so act_runner can run as a cache server. When running as a cache server, act_runner only processes the requests related to cache and does not run jobs. - adds the `external_server` configuration for cache. If specified, act_runner will use this URL as the ACTIONS_CACHE_URL instead of starting a cache server itself. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/275 Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
* Revert supporting multiple default actions URLs and use github for exec by ↵Jason Song2023-06-301-11/+1
| | | | | | | | | | | | | | default (#262) ## :warning: BREAKING :warning: Follow https://github.com/go-gitea/gitea/pull/25581 and gitea/act#70 . - Revert "Parse multiple default actions URLs (#200)" - Revert "fix defaultActionsUrls config for exec (#233)" - Use `https://github.com` for exec by default. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/262
* Improve the usage of `docker_host` configuration (#260)Zettat1232023-06-301-21/+22
| | | | | | | | | | | | | | Follow #242, #244 Fixes #258 Users could use `docker_host` configuration to specify which docker daemon will be used by act_runner. - If `docker_host` is **empty**, act_runner will find an available docker host automatically. - If `docker_host` is **"-"**, act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers. - If `docker_host` is **not empty or "-"**, the specified docker host will be used. An error will be returned if it doesn't work. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/260 Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
* Add option to configure workspace on host (#238)Marius Zwicker2023-06-201-2/+3
| | | | | | | | | | | | | | | | Adds a new section to the configuration which is used to control options when running in host mode. The first option added is to allow configuration of the location workspaces get created in. Depends on ~~gitea/act#65~~ Will resolve #235 Reviewed-on: https://gitea.com/gitea/act_runner/pulls/238 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Marius Zwicker <marius.zwicker@mlba-team.de> Co-committed-by: Marius Zwicker <marius.zwicker@mlba-team.de>
* Add `ValidVolumes` config (#226)Zettat1232023-06-161-0/+1
| | | | | | | | | | | | | | Follow https://gitea.com/gitea/act/pulls/60, https://gitea.com/gitea/act/pulls/64 This PR adds the `valid_volumes` configuration. `valid_volumes` is a sequence containing the volumes (including bind mounts) that can be mounted to the container. By default, `valid_volumes` is empty, which means that no volumes can be mounted. Users can specify multiple valid volumes and [glob](https://github.com/gobwas/glob) is supported. All volumes will be allowed when using `exec` to run workflows locally. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/226 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
* Support changing labels (#201)sillyguodong2023-06-151-0/+8
| | | | | | | | | | | | | | Implement proposal: https://github.com/go-gitea/gitea/issues/24540 Related: - Protocol: https://gitea.com/gitea/actions-proto-def/pulls/9 - Gitea side: https://github.com/go-gitea/gitea/pull/24806 Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/201 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: sillyguodong <gedong_1994@163.com> Co-committed-by: sillyguodong <gedong_1994@163.com>
* Parse multiple default actions URLs (#200)Zettat1232023-06-061-20/+30
| | | | | | | | | | | | Follow https://gitea.com/gitea/act/pulls/58 Resolve https://github.com/go-gitea/gitea/issues/24789 Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/200 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>
* Remove trailing slash from instance address (#197)harryzcy2023-05-221-1/+1
| | | | | | | | | | | Related #136 Co-authored-by: harryzcy <harry@harryzheng.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/197 Reviewed-by: Jason Song <i@wolfogre.com> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: harryzcy <harryzcy@noreply.gitea.io> Co-committed-by: harryzcy <harryzcy@noreply.gitea.io>
* Add configuration item of `container.network` (#184)sillyguodong2023-05-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close https://gitea.com/gitea/act_runner/issues/177 Related https://gitea.com/gitea/act/pulls/56 ### ⚠️ Breaking The `container.network_mode` is a deprecated configuration item. It may be removed after Gitea 1.20 released. Previously, if the value of `container.network_mode` is `bridge`, it means that `act_runner` will create a new network for job.But `bridge` is easily confused with the bridge network created by Docker by default. We recommand that using `container.network` to specify the network to which containers created by `act_runner` connect. ### 🆕 container.network The configuration file of `act_runner` add a new item of `contianer.network`. In `config.example.yaml`: ```yaml container: # Specifies the network to which the container will connect. # Could be host, bridge or the name of a custom network. # If it's empty, act_runner will create a network automatically. network: "" ``` As the comment in the example above says, the purpose of the `container.network` is specifying the network to which containers created by `act_runner` will connect. `container.network` accepts the following valid values: - `host`: All of containers (including job containers and service contianers) created by `act_runner` will be connected to the network named `host` which is created automatically by Docker. Containers will share the host’s network stack and all interfaces from the host will be available to these containers. - `bridge`: It is similar to `host`. All of containers created by `act_runner` will be connected to the network named `bridge` which is created automatically by Docker. All containers connected to the `bridge` (Perhaps there are containers that are not created by `act_runner`) are allowed to communicate with each other, while providing isolation from containers which are not connected to that `bridge` network. - `<custom_network>`: Please make sure that the `<custom_network>` network already exists firstly (`act_runner` does not detect whether the specified network exists currently. If not exists yet, will return error in the stage of `docker create`). All of containers created by `act_runner` will be connected to `<custom_network>`. After the job is executed, containers are removed and automatically disconnected from the `<custom_network>`. - empty: `act_runner` will create a new network for each job container and their service containers (if defined in workflow). So each job container and their service containers share a network environment, but are isolated from others container and the Docker host. Of course, these networks created by `act_runner` will be removed at last. ### Others - If you do not have special needs, we highly recommend that setting `container.network` to empty string (and do not use `container.network_mode` any more). Because the containers created by `act_runner` will connect to the networks that are created by itself. This point will provide better isolation. - If you set `contianer.network` to empty string or `<custom_network>`, we can be access to service containers by `<service-id>:<port>` in the steps of job. Because we added an alias to the service container when connecting to the network. Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/184 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: sillyguodong <gedong_1994@163.com> Co-committed-by: sillyguodong <gedong_1994@163.com>
* Upgrade act and use new artifactcache (#174)Jason Song2023-05-041-2/+7
| | | | | | | | - Upgrade act to v0.245.1 - Replace `gitea.com/gitea/act_runner/internal/app/artifactcache` with `github.com/nektos/act/pkg/artifactcache` Reviewed-on: https://gitea.com/gitea/act_runner/pulls/174 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
* Support `configuration variables` (#157)sillyguodong2023-04-281-0/+1
| | | | | | | | | | | related to: https://gitea.com/gitea/act_runner/issues/127 `act_runner` only needs to pass `vars` from `Gitea` to `act`. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/157 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: sillyguodong <gedong_1994@163.com> Co-committed-by: sillyguodong <gedong_1994@163.com>
* Add parent directory for working directory (#154)Zettat1232023-04-281-3/+3
| | | | | | | | | | | | | | | Fixes #145 At present, the working directory of a work flow is a path like `/<owner>/<repo>`, so the directory may conflict with system directory like `/usr/bin`. We need to add a parent directory for the working directory. In this PR, the parent directory is `/workspace` by default and users could configure it by the `workdir_parent` option. This change doesn't affect the host mode because in host mode the working directory will always be in `$HOME/.cache/act/` directory. Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/154 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
* Support upload `outputs` and use `needs` context (#133)Jason Song2023-04-201-8/+4
| | | | | | | | | | | | | | See [Example usage of the needs context](https://docs.github.com/en/actions/learn-github-actions/contexts#example-usage-of-the-needs-context). Related to: - [actions-proto-def #5](https://gitea.com/gitea/actions-proto-def/pulls/5) - [gitea #24230](https://github.com/go-gitea/gitea/pull/24230) Reviewed-on: https://gitea.com/gitea/act_runner/pulls/133 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Zettat123 <zettat123@noreply.gitea.io> Co-authored-by: Jason Song <i@wolfogre.com> Co-committed-by: Jason Song <i@wolfogre.com>
* Set specific environments to distinguish between Gitea and GitHub (#113)Jason Song2023-04-121-0/+4
| | | | | | | | | | Close https://github.com/go-gitea/gitea/issues/24038 Reviewed-on: https://gitea.com/gitea/act_runner/pulls/113 Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com> Co-committed-by: Jason Song <i@wolfogre.com>
* Run as a container (#8) including Docker-in-Docker. (#84)Thomas E Lackey2023-04-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This adds a very simple Dockerfile and run script for running `act_runner` as a container. It also allows setting `Privileged` and `ContainerOptions` flags via the new config file when spawning task containers. The combination makes it possible to use Docker-in-Docker (which requires `privileged` mode) as well as pass any other options child Docker containers may require. For example, if Gitea is running in Docker on the same machine, for the `checkout` action to behave as expected from a task container launched by `act_runner`, it might be necessary to map the hostname via something like: ``` container: network_mode: bridge privileged: true options: --add-host=my.gitea.hostname:host-gateway ``` > NOTE: Description updated to reflect latest code. > NOTE: Description updated to reflect latest code (again). Reviewed-on: https://gitea.com/gitea/act_runner/pulls/84 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com> Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
* feat: add artifact api from gitea server (#103)fuxiaohei2023-04-101-0/+8
| | | | | | | | | | | add action api for artifacts upload and download. It's related to https://github.com/go-gitea/gitea/pull/22738 Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/103 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: fuxiaohei <fuxiaohei@vip.qq.com> Co-committed-by: fuxiaohei <fuxiaohei@vip.qq.com>
* Refactor to new framework (#98)Jason Song2023-04-041-0/+199
- Adjust directory structure ```text ├── internal │   ├── app │   │   ├── artifactcache │   │   ├── cmd │   │   ├── poll │   │   └── run │   └── pkg │   ├── client │   ├── config │   ├── envcheck │   ├── labels │   ├── report │   └── ver └── main.go ``` - New pkg `labels` to parse label - New pkg `report` to report logs to Gitea - Remove pkg `engine`, use `envcheck` to check if docker running. - Rewrite `runtime` to `run` - Rewrite `poller` to `poll` - Simplify some code and remove what's useless. Reviewed-on: https://gitea.com/gitea/act_runner/pulls/98 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com> Co-committed-by: Jason Song <i@wolfogre.com>