Commit Graph
60 Commits
Author SHA1 Message Date
Lunny Xiao 39a54e0013 refactor: use the shared expression evaluation layer
Gitea carries a copy of this evaluation layer, as
modules/actions/jobparser/evaluator.go says itself: "copied from
runner.expressionEvaluator, to avoid unnecessary dependencies". It now
lives in gitea.dev/actionslib/pkg/expreval, so both sides split
sub-expressions, interpolate, keep the type of a lone expression and
apply the default status check the same way.

expressionEvaluator keeps the logging and the mask of every single
evaluation, which is what the shared Evaluator takes a function for.

Signed-off-by: Lunny Xiao <[email protected]>
2026-08-06 15:14:18 -07:00
Lunny Xiao 573e811492 refactor: move act/model and act/exprparser to actionslib
Gitea needs the workflow model and the expression evaluator to parse
workflows and to build the task payload this runner consumes, so it had
to depend on gitea.com/gitea/runner for it. Both packages now live in
gitea.dev/actionslib, the module both sides already share, and this
repository consumes them from there.

The GithubContext helpers that need a git checkout on disk (SetRef,
SetSha and SetRepositoryAndOwner) are not moved: they are runner only and
would drag a git client and the act context logger into the shared
module. They become functions of the new act/ghcontext package, together
with their tests.

act/common.CartesianProduct moved to the shared model package as well,
act/model was its only user. act/model/testdata/container-volumes is now
act/runner/testdata/container-volumes, its only user is runner_test.go.

The x-runner-uuid and x-runner-token header names come from
actionslib too, so the runner and Gitea cannot drift apart.

The generated runner API code moved along with the repository, from
gitea.dev/actions-proto-go to gitea.dev/actionslib, so the imports of
ping/v1 and runner/v1 follow the new module path. Both cannot be used at
once: the generated types would no longer be the same types.

Signed-off-by: Lunny Xiao <[email protected]>
2026-08-06 15:14:18 -07:00
24c13a1fd0 chore: revert 4c2ab943a8 (#1148)
Revert #1136 and use actionslib instead.

revert chore: bump the module path to `/v3`, take the version from the VCS stamp (#1136)

gitea can not consume the runner's api by version while it's version mismatches the module version:

```
go: gitea.com/gitea/[email protected]: invalid version: module contains a go.mod file,
so module path must match major version ("gitea.com/gitea/runner/v3")
```

Fix that by bumping the module version now. The existing `v3.0.0` and `v3.0.1` tags stay unusable, so a new tag is needed after this lands.

Also drop the version `-X` linker flags, which would otherwise have to repeat the new path in both `Makefile` and `.goreleaser.yaml`, where a stale path makes injection silently no-op. Go has recorded the module version in the build info since 1.24, so `Version()` reads it from there, keeping the variable as an override for builds without a VCS stamp.

That part started as https://gitea.com/gitea/runner/pulls/1137 but belongs here: the stamp resolves against the tags that are legal for the module path, so without the `/v3` bump it would report `v1.0.9-0.<ts>-<sha>`. Since `release-nightly.yml` triggers on every push to `main`, splitting them would publish a nightly with a `v1` version.

---------

Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1136
Reviewed-by: techknowlogick <[email protected]>
Reviewed-by: bircni <[email protected]>
Co-authored-by: silverwind <[email protected]>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1148
Reviewed-by: Zettat123 <[email protected]>
2026-08-06 21:50:21 +00:00
Lunny Xiao 94ab020204 ci: mirror release artifacts to Cloudflare R2 (#1114)
Mirrors every release artifact into Cloudflare R2 alongside the existing AWS S3
upload, so both buckets carry the same objects during a parallel period. S3 is
untouched and stays authoritative for now; once R2 is confirmed complete it can
be dropped by deleting the `blobs:` block and pointing this at R2 alone.

### Why `publishers:` and not a second `blobs:` entry

goreleaser's blob pipe authenticates from the global `AWS_*` environment and has
no per-entry credential fields, so two different credential sets (AWS S3 and
Cloudflare R2) cannot coexist in `blobs:`. Custom publishers do support
per-entry `env:`, which is the supported way to isolate the two.

### Why `curl --aws-sigv4` and not `aws`/`rclone`

The CI image `docker.gitea.com/runner-images:ubuntu-latest` ships none of `aws`,
`rclone`, `s3cmd` or `mc`, but does ship curl 8.5 with `--aws-sigv4`. This keeps
the change zero-install. Credentials are fed to curl through a config file on
stdin rather than argv, so they never appear in the process list.

### Behaviour

- Object layout is identical to S3 (`gitea-runner/<version>/<artifact>`), so
  migrating consumers later means changing only the host, not the path.
- Nightly gets R2 too, matching the existing nightly-to-S3 behaviour.
- Missing R2 configuration fails the build. Because custom publishers run as the
  very last step of the publish pipeline, a preflight `--check-config` step runs
  right after checkout so the failure happens before anything is built or
  published rather than after the release already exists.
- Verified against a local MinIO instance (site region `auto`, matching R2):
  successful upload byte-compared after download, plus the missing-variable,
  wrong-credentials, missing-file and bad-argument paths.

### Required repository secrets

These must be configured before the next release run, otherwise the new
preflight step will fail the workflow:

- `R2_ENDPOINT` (full base URL, e.g. `https://<account>.r2.cloudflarestorage.com`)
- `R2_BUCKET`
- `R2_ACCESS_KEY_ID`
- `R2_SECRET_ACCESS_KEY`

### Known, deliberate wart

The publisher runs 109 times for 73 distinct object keys: goreleaser's release
pipe already registers `release.extra_files` as `UploadableFile` artifacts, and
`internal/exec` appends the publisher's own `extra_files` on top with no
de-duplication. It cannot be globbed away because `gobwas/glob` has no
substring-exclusion matcher, so `./**.sha256` cannot be narrowed to exclude
`*.xz.sha256`. It is harmless since PUT is idempotent, and the redundant
`./**.xz` glob is kept on purpose so the publisher declares its own complete
file set instead of implicitly depending on the `release:` block's globs. This
is documented in a comment above the block.

Reviewed-on: https://gitea.com/gitea/runner/pulls/1114
Reviewed-by: Zettat123 <[email protected]>
2026-07-26 03:26:46 +00:00
Lunny XiaoandNicolas 5464d33eef fix: Return if executors length is zero in ParallelExecutor (#960)
It displayed an unused log and start an unused go routine. We should check the executors number before continue.

```
INFO[2026-05-12T21:01:04-07:00] Running job with maxParallel=1 for 1 matrix combinations
INFO[2026-05-12T21:01:04-07:00] NewParallelExecutor: Creating 1 workers for 1 executors
INFO[2026-05-12T21:01:04-07:00] NewParallelExecutor: Creating 1 workers for 0 executors
INFO[2026-05-12T21:01:04-07:00] NewParallelExecutor: Creating 1 workers for 0 executors
```

Reviewed-on: https://gitea.com/gitea/runner/pulls/960
Reviewed-by: silverwind <[email protected]>
Reviewed-by: Nicolas <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2026-05-15 22:14:13 +00:00
Lunny Xiao a7e972d8de fix: respect proxy env vars in runner client (#962)
Fixes #957.

## Why
The runner builds a custom `http.Transport` for its RPC client. From first principles, once we stop using the default transport we also stop inheriting its default proxy resolution behavior, so `HTTP_PROXY`/`HTTPS_PROXY` are ignored unless we wire that behavior back explicitly.

## What
- set `Proxy: http.ProxyFromEnvironment` on the custom transport
- add a regression test that verifies `getHTTPClient` honors proxy environment variables

Reviewed-on: https://gitea.com/gitea/runner/pulls/962
Reviewed-by: ChristopherHX <[email protected]>
2026-05-13 19:10:52 +00:00
Lunny XiaoandNicolas 763b38ece3 fix: isolate per-task runner envs (#959)
## Summary
- clone the runner environment map for each task before injecting runtime and OIDC tokens
- keep the shared base environment immutable so concurrent jobs cannot hit `concurrent map writes`
- add a unit test covering task-local env cloning

Fixes #958

---------

Co-authored-by: Nicolas <[email protected]>
Reviewed-on: https://gitea.com/gitea/runner/pulls/959
Reviewed-by: Nicolas <[email protected]>
2026-05-12 18:50:25 +00:00
13dc9386fe Rename act_runner to runner (#850)
## Consumer-facing breaking changes

- **Go module path**: `gitea.com/gitea/act_runner` → `gitea.com/gitea/runner`. Anything importing `act/...` or `internal/...` packages (notably Gitea itself) must update imports.
- **Binary name**: `act_runner` → `gitea-runner`. Wrapper scripts, systemd units, init scripts, and documentation referencing the binary by `act_runner` will break.
- **Docker image**: `gitea/act_runner` → `gitea/runner` (incl. `*-dind-rootless` variants). Users pulling `gitea/act_runner:nightly` etc. will get stale images. Note: the image name is `gitea/runner`, not `gitea/gitea-runner`.
- **Release artifact paths**: S3 directory `act_runner/{{.Version}}` → `gitea-runner/{{.Version}}`, and artifact filenames change with the new project name. Existing download URLs break.
- **Metrics namespace**: changed from `act_runner` to `gitea_runner` (e.g. `act_runner_jobs_total` → `gitea_runner_jobs_total`); existing monitors/dashboards must be updated.
- **ldflags version path**: `gitea.com/gitea/act_runner/internal/pkg/ver.version` → `gitea.com/gitea/runner/internal/pkg/ver.version`. Affects anyone building with custom ldflags.
- **Kubernetes example resource names**: `act-runner` / `act-runner-vol` → `runner` / `runner-vol`. Users who copied the manifests verbatim will see resource churn on apply.
- **s6 service name**: `scripts/s6/act_runner/` → `scripts/s6/gitea-runner/` (image-internal; only matters for downstream image overrides).

Unchanged: YAML config field names, env vars (`GITEA_*`), CLI flags/subcommands, registration file format.
---------

Co-authored-by: silverwind <[email protected]>
Reviewed-on: https://gitea.com/gitea/runner/pulls/850
Reviewed-by: Zettat123 <[email protected]>
Reviewed-by: silverwind <[email protected]>
Reviewed-by: Nicolas <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2026-04-30 20:12:51 +00:00
Lunny Xiao b5c50bb3ab upgrade go git 2026-04-23 14:38:25 -07:00
Lunny Xiao 90c1275f0e Upgrade yaml (#816)
~wait https://gitea.com/gitea/act/pulls/157~

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/816
Reviewed-by: Zettat123 <[email protected]>
2026-03-28 16:18:47 +00:00
Lunny Xiao 3232358e71 downgrade yaml from rc.4 to rc.3 and upgrade action lint (#158)
Reviewed-on: https://gitea.com/gitea/act/pulls/158
Reviewed-by: Zettat123 <[email protected]>
2026-03-28 04:13:07 +00:00
Lunny Xiao 2e98baa34a Upgrade yaml (#157)
Reviewed-on: https://gitea.com/gitea/act/pulls/157
Reviewed-by: Zettat123 <[email protected]>
2026-03-28 03:31:27 +00:00
Lunny Xiao 28740d7788 Upgrade go mod (#154)
Reviewed-on: https://gitea.com/gitea/act/pulls/154
Reviewed-by: silverwind <[email protected]>
2026-02-22 20:39:43 +00:00
Lunny Xiao ddf9159a8f Remove jobparser because of moving to Gitea main project (#155)
Reviewed-on: https://gitea.com/gitea/act/pulls/155
Reviewed-by: silverwind <[email protected]>
Reviewed-by: ChristopherHX <[email protected]>
2026-02-22 19:04:16 +00:00
Lunny Xiao 6b1aea9c04 Upgrade github.com/go-git/go-git/v5 to v5.16.2 (#706)
Fix #695

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/706
Reviewed-by: techknowlogick <[email protected]>
2025-06-11 17:59:35 +00:00
Lunny Xiao 4c8179ee12 upgrade to go1.24, act to 0.261.4 and actions-proto-go to 0.4.1 (#662)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/662
Reviewed-by: ChristopherHX <[email protected]>
2025-03-01 20:18:36 +00:00
Lunny XiaoandJason Song b5f901b2d9 Upgrade act from v0.261.2 -> v0.261.3 (#607)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/607
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2024-10-18 04:33:57 +00:00
Lunny Xiao 6cdf1e5788 Fix ParseRawOn sequence problem (#119)
Fix https://gitea.com/gitea/act/actions/runs/277/jobs/0

Reviewed-on: https://gitea.com/gitea/act/pulls/119
2024-10-05 19:29:55 +00:00
Lunny Xiao ab381649da Add parsing for workflow dispatch (#118)
Reviewed-on: https://gitea.com/gitea/act/pulls/118
2024-10-03 02:56:58 +00:00
Lunny XiaoandJason Song 65ed62d2f5 Upgrade dependencies (#537)
Patially fix #513

Co-authored-by: Jason Song <[email protected]>
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/537
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2024-04-11 04:36:00 +00:00
Lunny Xiao c93462e19f Merge pull request 'bump nektos to 0.2.52' (#79) from bump-nektos into main
Reviewed-on: https://gitea.com/gitea/act/pulls/79
Reviewed-by: John Olheiser <[email protected]>
2023-10-13 01:20:21 +00:00
Lunny XiaoandJason Song c701ba4787 Add a quick start runner method in README (#282)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/282
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-07-12 01:43:26 +00:00
Lunny Xiao fcc016e9b3 Special the release tag signing sub key (#121)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/121
2023-04-13 18:56:15 +08:00
Lunny XiaoandJason Song 9e26208e13 Add signature for tag releases, upload to gitea releases itself (#116)
GPG signature keys are not set yet.

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/116
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-04-13 16:49:50 +08:00
Lunny Xiaoandtechknowlogick a05c5ba3ad Add make docker (#115)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/115
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-04-13 04:17:08 +08:00
Lunny XiaoandJason Song 10d639cc6b add release tag (#111)
Fix #108

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/111
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-04-11 14:04:08 +08:00
Lunny Xiao c8fad20f49 handle possible panic (#88)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/88
Reviewed-by: Jason Song <[email protected]>
2023-03-28 23:51:38 +08:00
Lunny XiaoandJason Song 83fb85f702 Fix bug (#31)
Reviewed-on: https://gitea.com/gitea/act/pulls/31
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-03-26 21:01:46 +08:00
Lunny Xiaoandappleboy 7c5400d75b ParseRawOn support schedules (#29)
Fix gitea/act_runner#71

Reviewed-on: https://gitea.com/gitea/act/pulls/29
Reviewed-by: Jason Song <[email protected]>
Reviewed-by: Zettat123 <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-03-24 20:15:46 +08:00
Lunny Xiao 63a57edaa3 check go version when build (#53)
Fix #51

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/53
2023-03-16 11:37:08 +08:00
Lunny XiaoandJason Song 5180cd56e1 Support cache on ci (#47)
Fix #46

Co-authored-by: Jason Song <[email protected]>
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/47
Reviewed-by: techknowlogick <[email protected]>
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-03-15 12:28:18 +08:00
Lunny Xiao 71f470d670 Fix make don't rebuild when go.mod changed (#49)
Fix #13

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/49
Reviewed-by: delvh <[email protected]>
2023-03-14 18:43:05 +08:00
Lunny Xiaoandtechknowlogick c0c363bf59 Update readme to add pre-built binary download links (#45)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/45
Reviewed-by: techknowlogick <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-03-14 13:39:12 +08:00
Lunny Xiao a4513405b5 Enable action as CI to test/build/release (#26)
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/26
2023-02-24 23:30:09 +08:00
Lunny XiaoandJason Song f1869f70b9 Allow request an insecure gitea server (#18)
When deploy a Gitea server with a self-signed HTTPS certification. Runner will be failed when connect to Gitea server. This PR will fix that to allow ignore the HTTPS certification verification.

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/18
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-02-15 16:51:14 +08:00
Lunny XiaoandJason Song 4b99ed8916 Support go run on action (#12)
Reviewed-on: https://gitea.com/gitea/act/pulls/12
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-02-15 16:10:15 +08:00
Lunny XiaoandJason Song e46ede1b17 parse raw on (#11)
Reviewed-on: https://gitea.com/gitea/act/pulls/11
Reviewed-by: Jason Song <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2023-01-31 15:49:55 +08:00
Lunny Xiao 715d0e85ce Merge pull request 'Fix duplicated log when register failed' (#3) from lunny/act_runner:lunny/fix_register_failure_hint into main
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/3
2022-11-25 00:55:16 +08:00
Lunny Xiao 1ab84ac8e8 Fix duplicated log when register failed 2022-11-25 00:54:32 +08:00
Lunny Xiao 1d50f0f5fd Merge pull request 'Update README about register' (#2) from lunny/act_runner:lunny/update_readme into main
Reviewed-on: https://gitea.com/gitea/act_runner/pulls/2
2022-11-25 00:42:46 +08:00
Lunny Xiao d1017d752f Update README about register 2022-11-25 00:40:00 +08:00
Lunny XiaoandJason Song 519726b46b Update act 2022-11-24 15:38:14 +08:00
Lunny XiaoandJason Song 5fc35faf17 Support bot site 2022-11-24 15:38:06 +08:00
Lunny XiaoandJason Song 8cffac65d9 Use normal images which includes git command 2022-11-24 15:38:00 +08:00
Lunny XiaoandJason Song 222b5100b6 add new envs 2022-11-24 15:37:48 +08:00
Lunny XiaoandJason Song 93c8de3ec4 get token 2022-11-24 15:37:46 +08:00
Lunny XiaoandJason Song 378966e45f add forgeinstance 2022-11-24 15:37:40 +08:00
Lunny XiaoandJason Song 9c7d2be7c6 Fix bug 2022-11-24 15:37:39 +08:00
Lunny XiaoandJason Song b83f36674b Fix build 2022-11-24 15:36:47 +08:00
Lunny XiaoandJason Song 3b7ac17410 Use fork instead of act 2022-11-24 15:36:45 +08:00
Lunny XiaoandJason Song 906d52ae0b Use gitea.com/gitea/act replace original 2022-11-24 15:36:31 +08:00
Lunny XiaoandJason Song db7ee2eaf4 log 2022-11-24 15:36:22 +08:00
Lunny XiaoandJason Song c7cb750616 refactor functions 2022-11-24 15:36:21 +08:00
Lunny XiaoandJason Song 5903c08c14 update protocol 2022-11-24 15:36:20 +08:00
Lunny XiaoandJason Song 2babadbc94 Add websocket 2022-11-24 15:36:19 +08:00
Lunny XiaoandJason Song e397fcc259 Add license 2022-11-24 15:36:16 +08:00
Lunny XiaoandJason Song d7e9ea75fc disable graphql url because gitea doesn't support that 2022-11-22 14:42:48 +08:00
Lunny XiaoandJason Song b9a9812ad9 Fix API 2022-11-22 14:22:03 +08:00
Lunny XiaoandJason Song 113c3e98fb support bot site 2022-11-22 14:17:06 +08:00
Lunny Xiao eee792a019 init project 2022-04-27 17:45:53 +08:00