Compare commits

...

133 commits

Author SHA1 Message Date
d97839cd90
fix(workflow): point to correct repo
Some checks failed
cascade / debug (push) Failing after 0s
cascade / forgejo (push) Failing after 0s
checks / build and test (push) Failing after 1s
checks / validate mocks (push) Failing after 0s
checks / validate pre-commit-hooks file (push) Failing after 0s
ci / goreleaser (push) Successful in 5m40s
checks / runner integration tests (push) Has been cancelled
example / docker-build-push-action-in-lxc (push) Has been cancelled
/ example-docker-compose (push) Has been cancelled
/ example-lxc-systemd (push) Has been cancelled
checks / integration tests (push) Has been cancelled
checks / runner exec tests (push) Has been cancelled
Build release / release (push) Has been cancelled
publish / publish (push) Has been cancelled
2025-10-30 09:09:10 +00:00
1f8217d99b
fix(workflow): remove go generate from goreleaser
Some checks failed
example / docker-build-push-action-in-lxc (push) Waiting to run
/ example-docker-compose (push) Waiting to run
/ example-lxc-systemd (push) Waiting to run
cascade / forgejo (push) Failing after 0s
checks / build and test (push) Failing after 0s
cascade / debug (push) Failing after 0s
checks / validate mocks (push) Failing after 0s
checks / validate pre-commit-hooks file (push) Failing after 0s
ci / goreleaser (push) Failing after 5m37s
checks / integration tests (push) Has been cancelled
checks / runner exec tests (push) Has been cancelled
checks / runner integration tests (push) Has been cancelled
Build release / release (push) Has been cancelled
publish / publish (push) Has been cancelled
2025-10-30 08:57:37 +00:00
cd83c525c8
chore(workflow): set up simpler build pipeline
Some checks failed
example / docker-build-push-action-in-lxc (push) Waiting to run
/ example-docker-compose (push) Waiting to run
/ example-lxc-systemd (push) Waiting to run
cascade / debug (push) Failing after 0s
cascade / forgejo (push) Failing after 0s
checks / build and test (push) Failing after 0s
checks / validate mocks (push) Failing after 0s
checks / validate pre-commit-hooks file (push) Failing after 0s
ci / goreleaser (push) Failing after 3m59s
checks / integration tests (push) Has been cancelled
checks / runner exec tests (push) Has been cancelled
checks / runner integration tests (push) Has been cancelled
Build release / release (push) Has been cancelled
publish / publish (push) Has been cancelled
2025-10-30 08:48:02 +00:00
88e6654a6c feat(runner): Added waiting for a job arrival in the one-job command. 2025-10-29 11:12:12 +01:00
Renovate Bot
10a9ab9001
Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.7 (#1113)
Some checks are pending
Build release / release (push) Waiting to run
publish / publish (push) Waiting to run
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [code.forgejo.org/forgejo/forgejo](https://forgejo.org) ([source](https://codeberg.org/forgejo/forgejo)) | patch | `11.0.6` -> `11.0.7` |

---

### Release Notes

<details>
<summary>forgejo/forgejo (code.forgejo.org/forgejo/forgejo)</summary>

### [`v11.0.7`](https://codeberg.org/forgejo/forgejo/releases/tag/v11.0.7)

[Compare Source](https://codeberg.org/forgejo/forgejo/compare/v11.0.6...v11.0.7)

See <https://codeberg.org/forgejo/forgejo/src/branch/forgejo/release-notes-published/11.0.7.md>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNTIuOSIsInVwZGF0ZWRJblZlciI6IjQxLjE1Mi45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1113
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-27 07:33:24 +00:00
volkmnv
ea961a70c3
fix: windows compilation (#1101)
Original pull request: https://code.forgejo.org/forgejo/runner/pulls/987
Fixes https://code.forgejo.org/forgejo/runner/issues/1032

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1101): <!--number 1101 --><!--line 0 --><!--description Zml4OiB3aW5kb3dzIGNvbXBpbGF0aW9u-->fix: windows compilation<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1101
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: volkmnv <volkmnv@noreply.code.forgejo.org>
Co-committed-by: volkmnv <volkmnv@noreply.code.forgejo.org>
2025-10-24 07:00:43 +00:00
Renovate Bot
8a98a8a512
Update data.forgejo.org/oci/golang Docker tag to v1.25 (#1110)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [data.forgejo.org/oci/golang](https://hub.docker.com/_/golang) ([source](https://github.com/docker-library/golang)) | stage | minor | `1.24-alpine3.22` -> `1.25-alpine3.22` |

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNTIuOSIsInVwZGF0ZWRJblZlciI6IjQxLjE1Mi45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1110
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-24 06:37:56 +00:00
Earl Warren
2301db6f85
fix: ${{ env.VAR }} is allowed in container (#1108)
Resolves forgejo/forgejo-actions-feature-requests#62

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1108): <!--number 1108 --><!--line 0 --><!--description Zml4OiAke3sgZW52LlZBUiB9fSBpcyBhbGxvd2VkIGluIGNvbnRhaW5lcg==-->fix: ${{ env.VAR }} is allowed in container<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1108
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-22 06:31:45 +00:00
Renovate Bot
aab9e22819 Update dependency forgejo/lxc-helpers to v1.1.3 (#1106)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [forgejo/lxc-helpers](https://code.forgejo.org/forgejo/lxc-helpers) | patch | `1.1.1` -> `1.1.3` |

---

### Release Notes

<details>
<summary>forgejo/lxc-helpers (forgejo/lxc-helpers)</summary>

### [`v1.1.3`](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.1.2...v1.1.3)

[Compare Source](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.1.2...v1.1.3)

### [`v1.1.2`](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.1.1...v1.1.2)

[Compare Source](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.1.1...v1.1.2)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNTIuOSIsInVwZGF0ZWRJblZlciI6IjQxLjE1Mi45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1106
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-21 03:21:33 +00:00
Earl Warren
403489591e
Revert "chore(cleanup): lxc-helpers does not need a global lock (#1047)" (#1103)
This reverts commit 996ac343ee.

The lock is still needed to guard against the following scenario.

d92a892ece/act/runner/run_context.go (L225-L236)

- two or more jobs start
- one of them creates the act template (`lxc_build_template $(lxc_template_release) $name`) - lxc-helpers now has transactions and they won't race against each other
- once it is built all jobs will then try to install node in the container that was just built and race against each other

with a global lock only the first one will build and populate the act template. The other will then do nothing because it already exists.

The bug can trivially be reproduced with:

```yaml
on:
  pull_request:

jobs:
  test1:
    runs-on: lxc
    steps:
      - run: echo OK1
  test2:
    runs-on: lxc
    steps:
      - run: echo OK2
  test3:
    runs-on: lxc
    steps:
      - run: echo OK3
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1103): <!--number 1103 --><!--line 0 --><!--description UmV2ZXJ0ICJjaG9yZShjbGVhbnVwKTogbHhjLWhlbHBlcnMgZG9lcyBub3QgbmVlZCBhIGdsb2JhbCBsb2NrICgjMTA0Nyki-->Revert "chore(cleanup): lxc-helpers does not need a global lock (#1047)"<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1103
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: limiting-factor <limiting-factor@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-20 21:05:05 +00:00
cascading-pr
8034eaaabb
fix: lxc_exists_and_apt_not_old must be in a transaction (#1104)
cascading-pr from https://code.forgejo.org/forgejo/lxc-helpers/pulls/52

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1104): <!--number 1104 --><!--line 0 --><!--description Zml4OiBseGNfZXhpc3RzX2FuZF9hcHRfbm90X29sZCBtdXN0IGJlIGluIGEgdHJhbnNhY3Rpb24=-->fix: lxc_exists_and_apt_not_old must be in a transaction<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: cascading-pr <cascading-pr@example.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1104
Reviewed-by: limiting-factor <limiting-factor@noreply.code.forgejo.org>
Co-authored-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
Co-committed-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
2025-10-20 21:03:14 +00:00
Earl Warren
44f4557005
chore(ci): use code.forgejo.org/oci/alpine:latest (#1100)
The current AWS outage revealed one location still using docker.io instead of the code.forgejo.org mirror:

```
2025-10-20T09:22:44.6442259Z [actions-with-environment-and-context-tests/check] [DEBUG] Head "https://registry-1.docker.io/v2/library/alpine/manifests/3": received unexpected HTTP status: 503 Service Unavailable
```

https://code.forgejo.org/forgejo/runner/actions/runs/11442/jobs/2/attempt/3#jobstep-5-56398

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1100): <!--number 1100 --><!--line 0 --><!--description Y2hvcmUoY2kpOiB1c2UgY29kZS5mb3JnZWpvLm9yZy9vY2kvYWxwaW5lOmxhdGVzdA==-->chore(ci): use code.forgejo.org/oci/alpine:latest<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1100
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-20 15:18:52 +00:00
cascading-pr
d92a892ece
fix: enforce LXC bootstrap locks (#1098)
cascading-pr from https://code.forgejo.org/forgejo/lxc-helpers/pulls/51

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1098): <!--number 1098 --><!--line 0 --><!--description Zml4OiBlbmZvcmNlIExYQyBib290c3RyYXAgbG9ja3M=-->fix: enforce LXC bootstrap locks<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: cascading-pr <cascading-pr@example.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1098
Co-authored-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
Co-committed-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
2025-10-20 11:55:59 +00:00
Andrew Cassidy
a7487dadd7
fix: use automatic IP detection instead of cache proxy host config value for internal cache server (#1088)
The description for the `cache.host` config value is

```
  # The IP or hostname (195.84.20.30 or example.com) to use when constructing
  # ACTIONS_CACHE_URL which is the URL of the cache proxy.
```

however the internal cache *server* was being started using that value, despite it clearly stating its for the *proxy*.

While the address used to contact the cache proxy from the job is *usually* the same as the address for the cache proxy to contact the server, that is not the case with custom /etc/hosts entries, like what is used for the `host.containers.internal` address, which is needed for contacting the cache proxy on rootless podman (see #1075).

Since the cache proxy and internal cache server are always running on the same host (or container), it's safe to use localhost for the server address instead.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1088): <!--number 1088 --><!--line 0 --><!--description Zml4OiB1c2UgYXV0b21hdGljIElQIGRldGVjdGlvbiBpbnN0ZWFkIG9mIGNhY2hlIHByb3h5IGhvc3QgY29uZmlnIHZhbHVlIGZvciBpbnRlcm5hbCBjYWNoZSBzZXJ2ZXI=-->fix: use automatic IP detection instead of cache proxy host config value for internal cache server<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1088
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Reviewed-by: Kwonunn <kwonunn@noreply.code.forgejo.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Andrew Cassidy <drewcassidy@me.com>
Co-committed-by: Andrew Cassidy <drewcassidy@me.com>
2025-10-16 07:42:36 +00:00
Renovate Bot
aa6eef94fd
Update module golang.org/x/time to v0.14.0 (#1094)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [golang.org/x/time](https://pkg.go.dev/golang.org/x/time) | [`v0.13.0` -> `v0.14.0`](https://cs.opensource.google/go/x/time/+/refs/tags/v0.13.0...refs/tags/v0.14.0) | [![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftime/v0.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftime/v0.13.0/v0.14.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDYuMCIsInVwZGF0ZWRJblZlciI6IjQxLjE0Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1094
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-16 07:40:55 +00:00
Renovate Bot
f31a1b031e
Update module github.com/avast/retry-go/v4 to v4.7.0 (#1092)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/avast/retry-go/v4](https://github.com/avast/retry-go) | `v4.6.1` -> `v4.7.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2favast%2fretry-go%2fv4/v4.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2favast%2fretry-go%2fv4/v4.6.1/v4.7.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>avast/retry-go (github.com/avast/retry-go/v4)</summary>

### [`v4.7.0`](https://github.com/avast/retry-go/releases/tag/v4.7.0)

[Compare Source](https://github.com/avast/retry-go/compare/4.6.1...4.7.0)

#### What's Changed

- support context cancel cause by [@&#8203;NivKeidan](https://github.com/NivKeidan) in [#&#8203;117](https://github.com/avast/retry-go/pull/117)
- Bump github.com/stretchr/testify from 1.10.0 to 1.11.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;136](https://github.com/avast/retry-go/pull/136)
- Add FullJitterBackoffDelay  by [@&#8203;amirrezafahimi](https://github.com/amirrezafahimi) in [#&#8203;128](https://github.com/avast/retry-go/pull/128)
- No delay after final retry on max attempts by [@&#8203;StounhandJ](https://github.com/StounhandJ) in [#&#8203;129](https://github.com/avast/retry-go/pull/129)
- BackOffDelay multiplies attempts from zero by [@&#8203;StounhandJ](https://github.com/StounhandJ) in [#&#8203;130](https://github.com/avast/retry-go/pull/130)
- add Go version 1.25 to test matrix for expanded compatibility testing by [@&#8203;JaSei](https://github.com/JaSei) in [#&#8203;142](https://github.com/avast/retry-go/pull/142)

#### New Contributors

- [@&#8203;NivKeidan](https://github.com/NivKeidan) made their first contribution in [#&#8203;117](https://github.com/avast/retry-go/pull/117)
- [@&#8203;amirrezafahimi](https://github.com/amirrezafahimi) made their first contribution in [#&#8203;128](https://github.com/avast/retry-go/pull/128)
- [@&#8203;StounhandJ](https://github.com/StounhandJ) made their first contribution in [#&#8203;129](https://github.com/avast/retry-go/pull/129)

**Full Changelog**: <https://github.com/avast/retry-go/compare/4.6.1...v4.7.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDYuMCIsInVwZGF0ZWRJblZlciI6IjQxLjE0Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1092
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-15 06:54:17 +00:00
Andrew Cassidy
2de7e57e08
chore: log reason reverse proxy can't be started (#1089)
Following on to #1065, the reason that the reverse proxy cannot be started (such as an invalid cache server URL) wasn't being logged.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1089): <!--number 1089 --><!--line 0 --><!--description Y2hvcmU6IGxvZyByZWFzb24gcmV2ZXJzZSBwcm94eSBjYW4ndCBiZSBzdGFydGVk-->chore: log reason reverse proxy can't be started<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1089
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Andrew Cassidy <drewcassidy@me.com>
Co-committed-by: Andrew Cassidy <drewcassidy@me.com>
2025-10-14 08:08:03 +00:00
Renovate Bot
05795ee286
Update dependency go to v1.24.9 (#1087)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [go](https://go.dev/) ([source](https://github.com/golang/go)) | toolchain | patch | `1.24.8` -> `1.24.9` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDYuMCIsInVwZGF0ZWRJblZlciI6IjQxLjE0Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1087
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-14 08:07:05 +00:00
Roman K.
f48e9b3ba6 fix: prevent premature token revocation in reusable workflows (#1081)
## Problem

When using reusable workflows, the Forgejo runner prematurely revokes `GITHUB_TOKEN` after the first step completes, causing subsequent steps to fail with authentication errors.

### Reproduction

When the reusable workflow contains multiple steps that require authentication:
1. First step (e.g., checkout) completes successfully
2. Reporter receives completion banner from child workflow
3. Token is revoked prematurely
4. Second step fails with authentication error

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1081): <!--number 1081 --><!--line 0 --><!--description Zml4OiBwcmV2ZW50IHByZW1hdHVyZSB0b2tlbiByZXZvY2F0aW9uIGluIHJldXNhYmxlIHdvcmtmbG93cw==-->fix: prevent premature token revocation in reusable workflows<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1081
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Roman K. <devops@syncstack.net>
Co-committed-by: Roman K. <devops@syncstack.net>
2025-10-14 01:45:54 +00:00
Renovate Bot
4d685c129c
Update module golang.org/x/term to v0.36.0 (#1086)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [golang.org/x/term](https://pkg.go.dev/golang.org/x/term) | [`v0.35.0` -> `v0.36.0`](https://cs.opensource.google/go/x/term/+/refs/tags/v0.35.0...refs/tags/v0.36.0) | [![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fterm/v0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fterm/v0.35.0/v0.36.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1086
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-13 15:43:53 +00:00
Andrew Cassidy
2d359067f6
fix: don't prepend server URL with https:// if it's an empty string (#1083)
An attempt to address #1074 in a way that makes everyone happy

Right now, any server URL that doesnt start with `http://` or `https://` automatically gets `https://` prepended to it. When no instance is set while running `forgejo-runner exec` this results in the `{FORGEJO,GITHUB}_SERVER_URL` environment variables being set to simply "https://". Any action using the GitHub actions toolkit chokes on this as an invalid URL and fails the run with a nondescript error. This PR instead leaves empty strings alone, which the actions toolkit seems much happier with

Alternate fixes:
* default the `--forgejo-instance` flag to a valid but unresolved url like 'http://example.com' so the actions don't crash
* don't set the environment variables at all when the server URL is an empty string. This causes the actions toolkit to assume GitHub.com as a fallback

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1083): <!--number 1083 --><!--line 0 --><!--description Zml4OiBkb24ndCBwcmVwZW5kIHNlcnZlciBVUkwgd2l0aCBodHRwczovLyBpZiBpdCdzIGFuIGVtcHR5IHN0cmluZw==-->fix: don't prepend server URL with https:// if it's an empty string<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1083
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Andrew Cassidy <drewcassidy@me.com>
Co-committed-by: Andrew Cassidy <drewcassidy@me.com>
2025-10-12 08:53:45 +00:00
Renovate Bot
e25d6b3c91
Update module github.com/docker/docker to v28.5.1+incompatible (#1085)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/docker/docker](https://github.com/docker/docker) | `v28.4.0+incompatible` -> `v28.5.1+incompatible` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdocker%2fdocker/v28.5.1+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdocker%2fdocker/v28.4.0+incompatible/v28.5.1+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>docker/docker (github.com/docker/docker)</summary>

### [`v28.5.1+incompatible`](https://github.com/docker/docker/compare/v28.5.0...v28.5.1)

[Compare Source](https://github.com/docker/docker/compare/v28.5.0...v28.5.1)

### [`v28.5.0+incompatible`](https://github.com/docker/docker/compare/v28.4.0...v28.5.0)

[Compare Source](https://github.com/docker/docker/compare/v28.4.0...v28.5.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1085
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-12 06:53:05 +00:00
Renovate Bot
08723cf623 Update module github.com/rhysd/actionlint to v1.7.8 (#1084)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/rhysd/actionlint](https://github.com/rhysd/actionlint) | `v1.7.7` -> `v1.7.8` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2frhysd%2factionlint/v1.7.8?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2frhysd%2factionlint/v1.7.7/v1.7.8?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>rhysd/actionlint (github.com/rhysd/actionlint)</summary>

### [`v1.7.8`](https://github.com/rhysd/actionlint/blob/HEAD/CHANGELOG.md#v178---2025-10-11)

[Compare Source](https://github.com/rhysd/actionlint/compare/v1.7.7...v1.7.8)

- Support `models` permission in `permissions` section. ([#&#8203;531](https://github.com/rhysd/actionlint/issues/531), thanks [@&#8203;muzimuzhi](https://github.com/muzimuzhi))
- Support `job.check_run_id` property. ([#&#8203;576](https://github.com/rhysd/actionlint/issues/576), thanks [@&#8203;muzimuzhi](https://github.com/muzimuzhi) for fixing the type at [#&#8203;577](https://github.com/rhysd/actionlint/issues/577))
- Support `node24` runtime at `using` section in action metadata. ([#&#8203;561](https://github.com/rhysd/actionlint/issues/561), thanks [@&#8203;salmanmkc](https://github.com/salmanmkc))
- Add support for the following runner labels
  - [`macos-26` and `macos-26-large`](https://github.blog/changelog/2025-09-11-actions-macos-26-image-now-in-public-preview/) ([#&#8203;572](https://github.com/rhysd/actionlint/issues/572), thanks [@&#8203;muzimuzhi](https://github.com/muzimuzhi))
  - [`macos-15`](https://github.blog/changelog/2025-09-19-github-actions-macos-13-runner-image-is-closing-down/#what-you-need-to-do) ([#&#8203;572](https://github.com/rhysd/actionlint/issues/572), thanks [@&#8203;muzimuzhi](https://github.com/muzimuzhi))
- Drop support for the following runner labels.
  - [`ubuntu-20.04`](https://github.com/actions/runner-images/issues/11101) ([#&#8203;534](https://github.com/rhysd/actionlint/issues/534), thanks [@&#8203;shogo82148](https://github.com/shogo82148))
  - [`windows-2019`](https://github.blog/changelog/2025-04-15-upcoming-breaking-changes-and-releases-for-github-actions/#windows-server-2019-is-closing-down) ([#&#8203;572](https://github.com/rhysd/actionlint/issues/572), thanks [@&#8203;muzimuzhi](https://github.com/muzimuzhi))
- Support [`deprecationMessage`](https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputsinput_iddeprecationmessage) in action inputs. ([#&#8203;540](https://github.com/rhysd/actionlint/issues/540), thanks [@&#8203;saansh45](https://github.com/saansh45))
- Support [`windows-11-arm` runner](https://github.blog/changelog/2025-04-14-windows-arm64-hosted-runners-now-available-in-public-preview/). ([#&#8203;542](https://github.com/rhysd/actionlint/issues/542), thanks [@&#8203;trim21](https://github.com/trim21))
- Handle `ubuntu-latest` runner label as `ubuntu-24.04` and `macos-latest` runner label as `macos-15`.
- Report mixing Intel Mac labels and Arm Mac labels as error.
- Add new types to `issues` and `pull_request_target` webhooks.
- Update the popular actions data set to the latest and add more actions to it (thanks [@&#8203;sethvargo](https://github.com/sethvargo) for fixing the `go generate` scripts)
  - `actions/create-github-app-token`
  - `actions/attest-sbom`
  - `actions/ai-inference`
  - `peter-evans/create-or-update-comment`
  - `release-drafter/release-drafter`
  - `SamKirkland/FTP-Deploy-Action`
- Fix the version value in `actionlint -version` can be empty.
- Fix outdated URL links in some error messages and documents.
- [Homebrew formula in this repository](https://github.com/rhysd/actionlint/blob/main/HomebrewFormula/actionlint.rb) is deprecated and [Homebrew cask](https://github.com/rhysd/actionlint/blob/main/Casks/actionlint.rb) is newly added instead because [GoReleaser no longer supports Homebrew formula update](https://goreleaser.com/deprecations/#brews). Note that Homebrew's official `actionlint` formula is still maintained. Please read the [documentation](https://github.com/rhysd/actionlint/blob/main/docs/install.md#homebrew) for more details.
- Drop support for Go 1.23 and earlier because they are no longer maintained officially. Go 1.24 and later are supported to build actionlint.
- Replace [`go-yaml/yaml@v3`](https://github.com/go-yaml/yaml) package with [`yaml/go-yaml@v4`](https://github.com/yaml/go-yaml) package. `go-yaml/yaml` was used for parsing workflow files however it was unmaintained. `yaml/go-yaml` is a successor of the library officially maintained by YAML organization. ([#&#8203;575](https://github.com/rhysd/actionlint/issues/575))
- Improve error messages on parsing workflow and action metadata files.

\[Changes]\[v1.7.8]

<a id="v1.7.7"></a>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1084
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-12 01:47:52 +00:00
Andrew Cassidy
c80a40023c
feat: disambiguate cloud emoji (#1076)
Many emoji technically have two forms, the colorful form and the monochrome text form. For some reason, on macOS, ☁️ defaults to the latter, which is also really tiny for some reason?. Adding the invisible emoji variant selector (U+FE0F) causes it to always render as the colorful full-width graphic

Before:

![Screenshot 2025-10-08 at 22.53.36](/attachments/beaeea4a-d355-4db6-9cca-2425a62b6ea9)

After:

![Screenshot 2025-10-08 at 22.53.14](/attachments/dd670d38-fed6-41dc-a0c2-421846bc26bd)

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1076): <!--number 1076 --><!--line 0 --><!--description ZGlzYW1iaWd1YXRlIGNsb3VkIGVtb2pp-->disambiguate cloud emoji<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1076
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Andrew Cassidy <drewcassidy@me.com>
Co-committed-by: Andrew Cassidy <drewcassidy@me.com>
2025-10-11 09:23:28 +00:00
Renovate Bot
21d451085f
Update module code.forgejo.org/forgejo/actions-proto to v0.5.3 (#1082)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [code.forgejo.org/forgejo/actions-proto](https://code.forgejo.org/forgejo/actions-proto) | `v0.5.2` -> `v0.5.3` | [![age](https://developer.mend.io/api/mc/badges/age/go/code.forgejo.org%2fforgejo%2factions-proto/v0.5.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/code.forgejo.org%2fforgejo%2factions-proto/v0.5.2/v0.5.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>forgejo/actions-proto (code.forgejo.org/forgejo/actions-proto)</summary>

### [`v0.5.3`](https://code.forgejo.org/forgejo/actions-proto/compare/v0.5.2...v0.5.3)

[Compare Source](https://code.forgejo.org/forgejo/actions-proto/compare/v0.5.2...v0.5.3)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1082
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-11 09:02:22 +00:00
Mathieu Fenniak
02247b852a fix: allow mapping into env variable INPUT_N from ${{ inputs.n }} (#1080)
When using a reusable workflow such as:
```yaml
name: "use-inputs-impl"

on:
  workflow_call:
    inputs:
      image:
        description: "Image to be used in job"
        type: string
        required: false
        default: "docker.io/alpine:3.22"
      condition:
        description: "Only run a job if this is true"
        type: string
        required: false
        default: false

jobs:
  works:
    runs-on: docker
    container:
      image: alpine:3.22
    env:
      INPUT_IMAGE: ${{ inputs.image }}
      INPUT_CONDITION: ${{ inputs.condition }}
    steps:
      - run: echo "Hello world from Alpine"
      - run: cat /etc/alpine-release
      - run: echo "INPUT_IMAGE=$INPUT_IMAGE"
      - run: echo "INPUT_CONDITION=$INPUT_CONDITION"
```

The runner will currently output un-evaluated expressions:
```
INPUT_IMAGE=${{ inputs.image }}
INPUT_CONDITION=${{ inputs.condition }}
```

Internally, the workflow is using `INPUT_...` environment variables to transfer data into local reusable workflows, and the order of evaluation in `getEvaluatorInputs` was preferring to use the un-evaluated value, over the evaluated value.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1080): <!--number 1080 --><!--line 0 --><!--description Zml4OiBhbGxvdyBtYXBwaW5nIGludG8gZW52IHZhcmlhYmxlIElOUFVUX04gZnJvbSAke3sgaW5wdXRzLm4gfX0=-->fix: allow mapping into env variable INPUT_N from ${{ inputs.n }}<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1080
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-10-10 21:55:08 +00:00
Earl Warren
66a7e82c43
feat: allow --memory in workflow container options (#1079)
First hand experience to implement this feature can be found at https://codeberg.org/forgejo/forgejo/issues/9406. In a nutshell it is a service container in the CI that randomly uses massive amounts of memory (>50GB RSS) but normally less than 100MB.

---

See also the [matching documentation pull request](https://codeberg.org/forgejo/docs/pulls/1539).

---

It is already possible to limit the memory used by all containers in the config file:

```yaml
container:
  options: --memory 200M
```

This limit can be further reduced (but not increased) by the same option in a job:

```yaml
jobs:
  job:
    runs-on: docker
    container:
      image: code.forgejo.org/oci/node:20-bookworm
      options: --memory 200M
    steps:
      - run: echo OK
```

or a service container:

```yaml
job:
  my-job:
    runs-on: docker
    services:
      pgsql:
        image: postgres:15
        options: --memory 1G
```

Refs https://docs.docker.com/engine/containers/resource_constraints/#limit-a-containers-access-to-memory

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1079): <!--number 1079 --><!--line 0 --><!--description ZmVhdDogYWxsb3cgLS1tZW1vcnkgaW4gd29ya2Zsb3cgY29udGFpbmVyIG9wdGlvbnM=-->feat: allow --memory in workflow container options<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1079
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-10 14:33:07 +00:00
Renovate Bot
44b8b91540
Update module connectrpc.com/connect to v1.19.1 (#1078)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [connectrpc.com/connect](https://github.com/connectrpc/connect-go) | `v1.18.1` -> `v1.19.1` | [![age](https://developer.mend.io/api/mc/badges/age/go/connectrpc.com%2fconnect/v1.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/connectrpc.com%2fconnect/v1.18.1/v1.19.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>connectrpc/connect-go (connectrpc.com/connect)</summary>

### [`v1.19.1`](https://github.com/connectrpc/connect-go/releases/tag/v1.19.1)

[Compare Source](https://github.com/connectrpc/connect-go/compare/v1.19.0...v1.19.1)

<!-- Release notes generated using configuration in .github/release.yml at main -->

#### What's Changed

##### Bugfixes

- Fix bounds check on envelope for 32-bit archs by [@&#8203;emcfarlane](https://github.com/emcfarlane) in [#&#8203;887](https://github.com/connectrpc/connect-go/issues/887)
- Fix CallInfo header/trailer propagation on error responses by [@&#8203;emcfarlane](https://github.com/emcfarlane) in [#&#8203;892](https://github.com/connectrpc/connect-go/issues/892)

**Full Changelog**: <https://github.com/connectrpc/connect-go/compare/v1.19.0...v1.19.1>

### [`v1.19.0`](https://github.com/connectrpc/connect-go/releases/tag/v1.19.0)

[Compare Source](https://github.com/connectrpc/connect-go/compare/v1.18.1...v1.19.0)

This release introduces the highly requested "simple" flag for code generation, making Connect significantly more ergonomic for everyday RPC development.

The new simple flag in protoc-gen-connect-go generates cleaner, more intuitive client and handler interfaces that eliminate request/response wrappers for most use cases. This addresses community feedback about verbosity and provides a more straightforward API. When enabled, metadata (headers/trailers) can be passed through context instead of explicit wrapper objects, optimizing for the common case where developers don't need direct access to HTTP headers.

#### What's Changed

##### Enhancements

- Add simple flag for more ergonomic generated code by [@&#8203;bufdev](https://github.com/bufdev) and [@&#8203;smaye81](https://github.com/smaye81) in [#&#8203;851](https://github.com/connectrpc/connect-go/pull/851)
- Update Go to v1.24 and document http.Protocol use removing the dependency on `golang.org/x/net/http2` by [@&#8203;maxbrunet](https://github.com/maxbrunet) in [#&#8203;873](https://github.com/connectrpc/connect-go/pull/873), [#&#8203;877](https://github.com/connectrpc/connect-go/pull/877)
- Add support for Edition 2024 by [@&#8203;emcfarlane](https://github.com/emcfarlane) in [#&#8203;878](https://github.com/connectrpc/connect-go/pull/878)

##### Bugfixes

- Include valid spec and headers when calling recover handler for streaming RPCs by [@&#8203;jhump](https://github.com/jhump) in [#&#8203;817](https://github.com/connectrpc/connect-go/pull/817)

##### Other changes

- Go version support updated to latest two instead of three by [@&#8203;jhump](https://github.com/jhump) in [#&#8203;837](https://github.com/connectrpc/connect-go/pull/837)
- CI testing improvements by [@&#8203;pkwarren](https://github.com/pkwarren) and [@&#8203;jhump](https://github.com/jhump) in [#&#8203;838](https://github.com/connectrpc/connect-go/pull/838), [#&#8203;839](https://github.com/connectrpc/connect-go/pull/839)
- Code quality improvements by [@&#8203;mattrobenolt](https://github.com/mattrobenolt) and [@&#8203;bufdev](https://github.com/bufdev) in [#&#8203;841](https://github.com/connectrpc/connect-go/pull/841), [#&#8203;867](https://github.com/connectrpc/connect-go/pull/867)
- Documentation improvements by [@&#8203;adlion](https://github.com/adlion) and [@&#8203;stefanvanburen](https://github.com/stefanvanburen) in [#&#8203;821](https://github.com/connectrpc/connect-go/pull/821),
  [#&#8203;880](https://github.com/connectrpc/connect-go/pull/880)

#### New Contributors

- [@&#8203;adlion](https://github.com/adlion) made their first contribution in [#&#8203;821](https://github.com/connectrpc/connect-go/pull/821)
- [@&#8203;maxbrunet](https://github.com/maxbrunet) made their first contribution in [#&#8203;873](https://github.com/connectrpc/connect-go/pull/873)
- [@&#8203;stefanvanburen](https://github.com/stefanvanburen) made their first contribution in [#&#8203;880](https://github.com/connectrpc/connect-go/pull/880)

**Full Changelog**: <https://github.com/connectrpc/connect-go/compare/v1.18.1...v1.19.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1078
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-10 13:39:56 +00:00
Renovate Bot
bda2295f71
Update module github.com/docker/cli to v28.5.1+incompatible (#1072)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/docker/cli](https://github.com/docker/cli) | `v28.5.0+incompatible` -> `v28.5.1+incompatible` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdocker%2fcli/v28.5.1+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdocker%2fcli/v28.5.0+incompatible/v28.5.1+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>docker/cli (github.com/docker/cli)</summary>

### [`v28.5.1+incompatible`](https://github.com/docker/cli/compare/v28.5.0...v28.5.1)

[Compare Source](https://github.com/docker/cli/compare/v28.5.0...v28.5.1)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1072
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-09 08:55:16 +00:00
Renovate Bot
b17b1f00b3
Update dependency go to v1.24.8 (#1069)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [go](https://go.dev/) ([source](https://github.com/golang/go)) | toolchain | patch | `1.24.7` -> `1.24.8` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1069
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-08 09:42:15 +00:00
Mathieu Fenniak
3f52c56d1e feat: improve readability of error messages from ParseRawOn (#1063)
With https://codeberg.org/forgejo/forgejo/pulls/9530, the error messages from `ParseRawOn` are user-facing and need a pass to improve their meaning.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1063): <!--number 1063 --><!--line 0 --><!--description ZmVhdDogaW1wcm92ZSByZWFkYWJpbGl0eSBvZiBlcnJvciBtZXNzYWdlcyBmcm9tIFBhcnNlUmF3T24=-->feat: improve readability of error messages from ParseRawOn<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1063
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-10-07 14:41:55 +00:00
Renovate Bot
041524d663
Update module github.com/docker/cli to v28.5.0+incompatible (#1066)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/docker/cli](https://github.com/docker/cli) | `v28.4.0+incompatible` -> `v28.5.0+incompatible` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdocker%2fcli/v28.5.0+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdocker%2fcli/v28.4.0+incompatible/v28.5.0+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>docker/cli (github.com/docker/cli)</summary>

### [`v28.5.0+incompatible`](https://github.com/docker/cli/compare/v28.4.0...v28.5.0)

[Compare Source](https://github.com/docker/cli/compare/v28.4.0...v28.5.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzUuNSIsInVwZGF0ZWRJblZlciI6IjQxLjEzNS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1066
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-07 08:13:23 +00:00
Mathieu Fenniak
a3d46d7597
chore: add additional logging to cacheproxy (#1065)
In support of diagnosing #1064, I hope.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1065): <!--number 1065 --><!--line 0 --><!--description Y2hvcmU6IGFkZCBhZGRpdGlvbmFsIGxvZ2dpbmcgdG8gY2FjaGVwcm94eQ==-->chore: add additional logging to cacheproxy<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1065
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-10-07 08:12:16 +00:00
Mathieu Fenniak
0a0b25d886
fix: don't panic on cacheproxy startup failure (#1067)
In #1064 I theorized that a failure to start up the cache proxy server might cause it to still be registered as `ACTIONS_CACHE_URL`.  It turns out to not be the case as it will just panic, since `cacheProxy` is `nil`.  But regardless, it seems better to not panic and crash if the intent here is "cache will be disabled" as documented in the log message.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1067): <!--number 1067 --><!--line 0 --><!--description Zml4OiBkb24ndCBwYW5pYyBvbiBjYWNoZXByb3h5IHN0YXJ0dXAgZmFpbHVyZQ==-->fix: don't panic on cacheproxy startup failure<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1067
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-10-07 08:09:14 +00:00
Renovate Bot
a22c5a2e65
Update module github.com/go-git/go-git/v5 to v5.16.3 (#1062)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) | `v5.16.2` -> `v5.16.3` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgo-git%2fgo-git%2fv5/v5.16.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgo-git%2fgo-git%2fv5/v5.16.2/v5.16.3?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>go-git/go-git (github.com/go-git/go-git/v5)</summary>

### [`v5.16.3`](https://github.com/go-git/go-git/releases/tag/v5.16.3)

[Compare Source](https://github.com/go-git/go-git/compare/v5.16.2...v5.16.3)

#### What's Changed

- internal: Expand regex to fix build \[5.x] by [@&#8203;baloo](https://github.com/baloo) in [#&#8203;1644](https://github.com/go-git/go-git/pull/1644)
- build: raise timeouts for windows CI tests and disable CIFuzz \[5.x] by [@&#8203;baloo](https://github.com/baloo) in [#&#8203;1646](https://github.com/go-git/go-git/pull/1646)
- plumbing: support commits extra headers, support jujutsu signed commit \[5.x] by [@&#8203;baloo](https://github.com/baloo) in [#&#8203;1633](https://github.com/go-git/go-git/pull/1633)

**Full Changelog**: <https://github.com/go-git/go-git/compare/v5.16.2...v5.16.3>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzEuOSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1062
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-06 04:22:26 +00:00
Andrew Cassidy
e68940619c
chore(docs): clarify the behavior of [container].docker_host (#1059)
The description of `container.docker_host` was misleading (and IMO the setting itself does too many things, see forgejo/forgejo-actions-feature-requests#58). I clarified the comments in the example config to clearly explain that it will mount the specified socket inside the job container, and give some example values

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1059): <!--number 1059 --><!--line 0 --><!--description Q2xhcmlmeSB0aGUgYmVoYXZpb3Igb2YgYGNvbnRhaW5lci5kb2NrZXJfaG9zdGA=-->Clarify the behavior of `container.docker_host`<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1059
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Andrew Cassidy <drewcassidy@me.com>
Co-committed-by: Andrew Cassidy <drewcassidy@me.com>
2025-10-06 03:51:19 +00:00
Mathieu Fenniak
ba1beb08f4
fix: log error for why cache couldn't be started (#1057)
Example, `cache.port` set to `22`:
```
time="2025-10-04T09:27:42-06:00" level=error msg="Could not start the cache server, cache will be disabled: listen tcp :22: bind: permission denied" func="[setupCache]" file="[runner.go:126]"
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1057): <!--number 1057 --><!--line 0 --><!--description Zml4OiBsb2cgZXJyb3IgZm9yIHdoeSBjYWNoZSBjb3VsZG4ndCBiZSBzdGFydGVk-->fix: log error for why cache couldn't be started<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1057
Reviewed-by: limiting-factor <limiting-factor@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-10-05 07:40:06 +00:00
Renovate Bot
4010e61165
Update module google.golang.org/protobuf to v1.36.10 (#1058)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) | `v1.36.9` -> `v1.36.10` | [![age](https://developer.mend.io/api/mc/badges/age/go/google.golang.org%2fprotobuf/v1.36.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/google.golang.org%2fprotobuf/v1.36.9/v1.36.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>protocolbuffers/protobuf-go (google.golang.org/protobuf)</summary>

### [`v1.36.10`](https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.36.10)

[Compare Source](https://github.com/protocolbuffers/protobuf-go/compare/v1.36.9...v1.36.10)

**Full Changelog**: <https://github.com/protocolbuffers/protobuf-go/compare/v1.36.9...v1.36.10>

Bug fixes:
[CL/704415](https://go-review.googlesource.com/c/protobuf/+/704415): reflect/protodesc: edition-2024-specific properties should not be lost when converting FileDescriptorProto to protoreflect.FileDescriptor

Maintenance:
[CL/708555](https://go-review.googlesource.com/c/protobuf/+/708555): internal/race\_test: add missing impl.LazyEnabled() t.Skip
[CL/703295](https://go-review.googlesource.com/c/protobuf/+/703295): proto: add more invalid group encoding test cases
[CL/703276](https://go-review.googlesource.com/c/protobuf/+/703276): internal/impl: verify lazy unmarshal on Deterministic encoding
[CL/703275](https://go-review.googlesource.com/c/protobuf/+/703275): internal/impl: stop using deprecated .Field in lazy\_test.go
[CL/702795](https://go-review.googlesource.com/c/protobuf/+/702795): all: update to latest github.com/google/go-cmp

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzEuOSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1058
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-05 07:39:29 +00:00
Earl Warren
5f3ff3d2e2
chore: teach renovate about example-lxc-systemd.yml (#1053)
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1053
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-04 11:16:16 +00:00
Renovate Bot
2bccbec3ae
Update forgejo-runner to v11.1.2 (#1055)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [code.forgejo.org/forgejo/runner](https://forgejo.org) ([source](https://code.forgejo.org/forgejo/runner)) | patch | `11.1.1` -> `11.1.2` |
| [forgejo/runner](https://code.forgejo.org/forgejo/runner) | patch | `11.1.1` -> `11.1.2` |

---

### Release Notes

<details>
<summary>forgejo/runner (code.forgejo.org/forgejo/runner)</summary>

### [`v11.1.2`](https://code.forgejo.org/forgejo/runner/releases/tag/v11.1.2)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v11.1.1...v11.1.2)

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1026): <!--number 1026 --><!--line 0 --><!--description ZmVhdDogc3VwcG9ydCBldmFsdWF0aW5nIHdvcmtmbG93LWxldmVsIGNvbmN1cnJlbmN5IGJsb2NrcyBpbiBqb2JwYXJzZXI=-->feat: support evaluating workflow-level concurrency blocks in jobparser<!--description-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1051): <!--number 1051 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogYSBtdWx0aWxpbmUgc2VjcmV0IG1heSBiZSBmb3VuZCBpbiBhIHNpbmdsZSBsb2cgZW50cnk=-->fix(security): a multiline secret may be found in a single log entry<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1048): <!--number 1048 --><!--line 0 --><!--description Zml4OiBpbXByb3ZlIGxvZ2dpbmcgdG8gZGlhZ25vc2UgbXlzdGVyeSBqb2IgdGVybWluYXRpb25z-->fix: improve logging to diagnose mystery job terminations<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1043): <!--number 1043 --><!--line 0 --><!--description Zml4OiBtb2RpZnlpbmcgYSBjYWNoZSBzZWNyZXQgZG9lcyBub3QgaW52YWxpZGF0ZSBjYWNoZWQgZW50cmllcw==-->fix: modifying a cache secret does not invalidate cached entries<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1040): <!--number 1040 --><!--line 0 --><!--description Zml4OiBhbGxvdyBHQyAmIGNhY2hlIG9wZXJhdGlvbnMgdG8gb3BlcmF0ZSBjb25jdXJyZW50bHk=-->fix: allow GC & cache operations to operate concurrently<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1037): <!--number 1037 --><!--line 0 --><!--description Zml4OiBkbyBub3QgYXR0ZW1wdCB0byBydW4gdGhlIExYQyBzdG9wIHNjcmlwdCB3aXRoIHNlbGYtaG9zdGVk-->fix: do not attempt to run the LXC stop script with self-hosted<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1031): <!--number 1031 --><!--line 0 --><!--description Zml4OiBldmVudC5wdWxsX3JlcXVlc3QuYWN0aW9uID09IGNsb3NlZCBjYW4gdXNlIHRoZSBjYWNoZSBvZiB0aGUgYmFzZSByZXBvc2l0b3J5-->fix: event.pull\_request.action == closed can use the cache of the base repository<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1027): <!--number 1027 --><!--line 0 --><!--description Zml4OiBDb3JyZWN0bHkgb3ZlcnJpZGUgdGhlIHZhbHVlIG9mIGBGb3JnZWpvLUNhY2hlLUhvc3RgIHdoZW4gQUNUSU9OU19DQUNIRV9VUkwgaXMgb3ZlcnJpZGRlbi4=-->fix: Correctly override the value of `Forgejo-Cache-Host` when ACTIONS\_CACHE\_URL is overridden.<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1019): <!--number 1019 --><!--line 0 --><!--description Zml4OiBhIGNvbXBvc2l0ZSBhY3Rpb24gbXVzdCBub3QgY2hhbmdlIHRoZSByZXN1bHQgb2YgdGhlIGNhbGxpbmcgc3RlcCBiZWZvcmUgaXQgY29tcGxldGVz-->fix: a composite action must not change the result of the calling step before it completes<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1033): <!--number 1033 --><!--line 0 --><!--description Y2hvcmU6IHRlc3Q6IGV4ZXJjaXNlIGNvbnRleHRzIGluIG1hdHJpeCB3aGVuIHZhbGlkYXRpbmcgd29ya2Zsb3dz-->chore: test: exercise contexts in matrix when validating workflows<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1029): <!--number 1029 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBjb25uZWN0cnBjLmNvbS9jb25uZWN0IHRvIHYxLjE5LjA=-->Update module connectrpc.com/connect to v1.19.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1025): <!--number 1025 --><!--line 0 --><!--description Y2hvcmU6IGZpeCB0eXBvIGluIHRoZSBkb2N1bWVudGF0aW9u-->chore: fix typo in the documentation<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1023): <!--number 1023 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL2dvbGFuZ2NpL2dvbGFuZ2NpLWxpbnQvdjIvY21kL2dvbGFuZ2NpLWxpbnQgdG8gdjIuNS4w-->Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.5.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1022): <!--number 1022 --><!--line 0 --><!--description VXBkYXRlIGNvZGUuZm9yZ2Vqby5vcmcvZm9yZ2Vqby9mb3JnZWpvIERvY2tlciB0YWcgdG8gdjExLjAuNg==-->Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.6<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1020): <!--number 1020 --><!--line 0 --><!--description Y2hvcmU6IHVwZ3JhZGUgTFhDIGV4YW1wbGUgdG8gRGViaWFuIEdOVS9MaW51eCB0cml4aWU=-->chore: upgrade LXC example to Debian GNU/Linux trixie<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1021): <!--number 1021 --><!--line 0 --><!--description VXBkYXRlIGh0dHBzOi8vZGF0YS5mb3JnZWpvLm9yZy9hY3Rpb25zL3NldHVwLWZvcmdlam8gYWN0aW9uIHRvIHYzLjAuNA==-->Update <https://data.forgejo.org/actions/setup-forgejo> action to v3.0.4<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1018): <!--number 1018 --><!--line 0 --><!--description VXBkYXRlIGZvcmdlam8tcnVubmVyIHRvIHYxMS4xLjE=-->Update forgejo-runner to v11.1.1<!--description-->

<!--end release-notes-assistant-->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzEuOSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1055
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-04 11:15:31 +00:00
limiting-factor
996ac343ee
chore(cleanup): lxc-helpers does not need a global lock (#1047)
- https://code.forgejo.org/forgejo/lxc-helpers/src/tag/v1.1.1 has  locking and atomicity
- this lock was only good for when two release templates are  populated simultaneously and not when it was interrupted

Refs forgejo/lxc-helpers#8

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1047): <!--number 1047 --><!--line 0 --><!--description V0lQOiBjaG9yZShjbGVhbnVwKTogbHhjLWhlbHBlcnMgZG9lcyBub3QgbmVlZCBhIGdsb2JhbCBsb2Nr-->WIP: chore(cleanup): lxc-helpers does not need a global lock<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1047
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: limiting-factor <limiting-factor@posteo.com>
Co-committed-by: limiting-factor <limiting-factor@posteo.com>
2025-10-03 16:15:43 +00:00
Earl Warren
413a52605d
fix: remove LXC backend leftovers when the job completes (#1054)
- remove the root of the LXC container after destroying it, with sudo as it may contain files owned by root while the runner id is not root
- os.RemoveAll only for native host runs, it is no longer needed for the LXC backend
- remove the CleanUp function that is an indirection with no use

Resolves forgejo/runner#442

When running the test from a non-root user and without this fix, it fails as follow:

```
go test -v -count=1 -run='TestRunnerLXC' ./internal/app/run
=== RUN   TestRunnerLXC
...
time="2025-10-03T15:05:12+02:00" level=debug msg=stopHostEnvironment
time="2025-10-03T15:05:13+02:00" level=debug msg="HostEnvironment.Remove /tmp/TestRunnerLXC1841090130/001/d29c1256e2912892/hostexecutor"
time="2025-10-03T15:05:13+02:00" level=error msg="Error while stop job container FORGEJO-ACTIONS-TASK-0_WORKFLOW-3ede81fbc69d42e6db70bef5820490fc3e7dc4d9dcbfb64981f2d00f08a30d6e_JOB-job: unlinkat /tmp/TestRunnerLXC1841090130/001/d29c1256e2912892/hostexecutor/some/directory/owned/by/root: permission denied"
=== NAME  TestRunnerLXC
    runner_test.go:469:
        	Error Trace:	/home/earl-warren/software/runner/internal/app/run/runner_test.go:469
        	            				/home/earl-warren/software/runner/internal/app/run/runner_test.go:496
        	Error:      	Received unexpected error:
        	            	Error occurred running finally: unlinkat /tmp/TestRunnerLXC1841090130/001/d29c1256e2912892/hostexecutor/some/directory/owned/by/root: permission denied (original error: <nil>)
        	Test:       	TestRunnerLXC
        	Messages:   	OK
=== NAME  TestRunnerLXC/OK
    testing.go:1679: test executed panic(nil) or runtime.Goexit: subtest may have called FailNow on a parent test
=== NAME  TestRunnerLXC
    testing.go:1267: TempDir RemoveAll cleanup: unlinkat /tmp/TestRunnerLXC1841090130/001/d29c1256e2912892/hostexecutor/some/directory/owned/by/root: permission denied
--- FAIL: TestRunnerLXC (6.84s)
    --- FAIL: TestRunnerLXC/OK (6.84s)
FAIL
FAIL	code.forgejo.org/forgejo/runner/v11/internal/app/run	6.847s
FAIL
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1054): <!--number 1054 --><!--line 0 --><!--description Zml4OiByZW1vdmUgTFhDIGJhY2tlbmQgbGVmdG92ZXJzIHdoZW4gdGhlIGpvYiBjb21wbGV0ZXM=-->fix: remove LXC backend leftovers when the job completes<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1054
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-03 16:14:08 +00:00
cascading-pr
a980acd936
fix: make the creation of LXC templates atomic so they cannot be interrupted while building (#1049)
cascading-pr from https://code.forgejo.org/forgejo/lxc-helpers/pulls/49

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1049): <!--number 1049 --><!--line 0 --><!--description Y2FzY2FkaW5nLXByIGZyb20gaHR0cHM6Ly9jb2RlLmZvcmdlam8ub3JnL2Zvcmdlam8vbHhjLWhlbHBlcnMgcmVmcy9wdWxsLzQ5L2hlYWQgdG8gZm9yZ2Vqby9seGMtaGVscGVycy00OQ==-->cascading-pr from https://code.forgejo.org/forgejo/lxc-helpers refs/pull/49/head to forgejo/lxc-helpers-49<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: cascading-pr <cascading-pr@example.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1049
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
Co-committed-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
2025-10-03 09:09:29 +00:00
Renovate Bot
1fa156c7e4
Update dependency forgejo/lxc-helpers to v1.1.1 (#1050)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [forgejo/lxc-helpers](https://code.forgejo.org/forgejo/lxc-helpers) | patch | `1.1.0` -> `1.1.1` |

---

### Release Notes

<details>
<summary>forgejo/lxc-helpers (forgejo/lxc-helpers)</summary>

### [`v1.1.1`](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.1.0...v1.1.1)

[Compare Source](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.1.0...v1.1.1)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzEuOSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1050
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-10-03 09:03:32 +00:00
Earl Warren
b772be7131
fix(security): a multiline secret may be found in a single log entry (#1051)
With secrets.MULTILINE set to

```
ABC
DEF
GHI
```

the following is logged in debug mode:

```
2025-09-18T10:54:04.4656189Z expression '${{ secrets.MULTILINE }}' rewritten to 'format('{0}', secrets.MULTILINE)'
2025-09-18T10:54:04.4656426Z evaluating expression 'format('{0}', secrets.MULTILINE)'
2025-09-18T10:54:04.4656797Z expression 'format('{0}', secrets.MULTILINE)' evaluated to '%!t(string=ABC\nDEF\nGHI)'
```

Although it is displayed with \ followed by n, it is a single line entry displayed with the secret verbatim and must also be redacted.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1051): <!--number 1051 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogYSBtdWx0aWxpbmUgc2VjcmV0IG1heSBiZSBmb3VuZCBpbiBhIHNpbmdsZSBsb2cgZW50cnk=-->fix(security): a multiline secret may be found in a single log entry<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1051
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-03 08:22:06 +00:00
Mathieu Fenniak
63351343ba
fix: improve logging to diagnose mystery job terminations (#1048)
Additional logging to support #1044.

Manual testing only.  Cases tested:

Cancel a job from Forgejo UI; this seems like the most likely missing piece in #1044 as two jobs were simultaneously marked as "Failed".  There are codepaths in Forgejo that can set this state to both cancelled and failed, but the runner didn't provide log output indicating that's why a job was stopping:
```
time="2025-10-02T13:22:53-06:00" level=info msg="UpdateTask returned task result RESULT_CANCELLED for a task that was in local state RESULT_UNSPECIFIED - beginning local task termination" func="[ReportState]" file="[reporter.go:410]"
```

Host-based executor hits step timeout in exec, or, is cancelled.  This occurred but only logged the `err` from `exec`, not the context error indicating whether it was a timeout or a cancellation:
```
[Test Action/job1] this step has been cancelled: ctx: context deadline exceeded, exec: RUN signal: killed
[Test Action/job1] this step has been cancelled: ctx: context canceled, exec: RUN signal: killed
```

Unable to `ReportState` due to Forgejo inaccessible.  If the runner isn't able to update state to Forgejo a job could be considered a zombie; this would trigger one of the codepaths where the job would be marked as failed.  If connectivity was later restored, then the runner could identify it was marked as failed and cancel the job context.  (This combination doesn't seem likely, but, I think it's reasonable to consider these failures as warnings because there may be unexpected errors here that we're not aware of).
```
time="2025-10-02T13:27:19-06:00" level=warning msg="ReportState error: unavailable: 502 Bad Gateway" func="[RunDaemon]" file="[reporter.go:207]"
```

Runner shutdown logging; just changed up to `Info` level:
```
time="2025-10-02T13:31:36-06:00" level=info msg="forcing the jobs to shutdown" func="[Shutdown]" file="[poller.go:93]"
[Test Action/job1]     Failure - Main sleep 120
[Test Action/job1] this step has been cancelled: ctx: context canceled, exec: RUN signal: killed
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1048): <!--number 1048 --><!--line 0 --><!--description Zml4OiBpbXByb3ZlIGxvZ2dpbmcgdG8gZGlhZ25vc2UgbXlzdGVyeSBqb2IgdGVybWluYXRpb25z-->fix: improve logging to diagnose mystery job terminations<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1048
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-10-02 22:43:50 +00:00
Earl Warren
01766ff4e2
fix: modifying a cache secret does not invalidate cached entries (#1043)
Resolves forgejo/runner#1041

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1043): <!--number 1043 --><!--line 0 --><!--description Zml4OiBtb2RpZnlpbmcgYSBjYWNoZSBzZWNyZXQgZG9lcyBub3QgaW52YWxpZGF0ZSBjYWNoZWQgZW50cmllcw==-->fix: modifying a cache secret does not invalidate cached entries<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1043
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-01 16:38:38 +00:00
Mathieu Fenniak
d79d043696
fix: allow GC & cache operations to operate concurrently (#1040)
Fixes #1039.

Rather than opening and closing the Bolt DB instance constantly, the cache now maintains one open `*bolthold.Store` for its lifetime, allowing GC, cache read, and cache write operations to occur concurrently.

The major risk is this change is, "is it safe to use one Bolt instance across goroutines concurrently?"  [Bolt does document its concurrency requirements](https://github.com/boltdb/bolt?tab=readme-ov-file#transactions), and an analysis of our DB interactions looks to me like it introduces very little risk.

Most of the cache operations perform multiple touches to the database; for example `useCache` performs a read to fetch a cache object, and then an update to set its `UsedAt` timestamp.  If we wanted to ensure consistency in these operations, they should use a Bolt ReadWrite transaction -- but concurrent access would just be setting the field to the same value anyway.

The `gcCache` is the complex operation where a transaction might be warranted -- but doing so would also cause the same bug that #1039 indicates.  I believe it is safe to run without a transaction because it is protected by an application-level mutex (to prevent multiple concurrent GCs), it is the only code that performs deletes from the database -- these should guarantee that all its delete attempts are successful.  In the event of unexpected failure to do the DB write, `gcCache` deletes from the storage before deleting from the DB, so it should just attempt to cleanup again next run.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1040): <!--number 1040 --><!--line 0 --><!--description Zml4OiBhbGxvdyBHQyAmIGNhY2hlIG9wZXJhdGlvbnMgdG8gb3BlcmF0ZSBjb25jdXJyZW50bHk=-->fix: allow GC & cache operations to operate concurrently<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1040
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-09-30 19:12:45 +00:00
Earl Warren
7f90c8acb2
fix: do not attempt to run the LXC stop script with self-hosted (#1037)
The test is covered by TestRunnerLXC which verifies the script actually runs on LXC.

Resolves forgejo/runner#1035

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1037): <!--number 1037 --><!--line 0 --><!--description Zml4OiBkbyBub3QgYXR0ZW1wdCB0byBydW4gdGhlIExYQyBzdG9wIHNjcmlwdCB3aXRoIHNlbGYtaG9zdGVk-->fix: do not attempt to run the LXC stop script with self-hosted<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1037
Reviewed-by: fnetX <fnetx@noreply.code.forgejo.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-28 14:49:45 +00:00
2franix
ea824bde1c
chore: test: exercise contexts in matrix when validating workflows (#1033)
After realizing my mistake on my proposed fixes in #1028, I figured I could at least propose another test covering the use of contexts in `jobs.<job-id>.strategy.matrix`.

The specification for available contexts is [here](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#context-availability):

| Workflow key | Context |
| -------------------- | ----------- |
| `jobs.<job_id>.strategy` | `github`, `needs`, `vars`, `inputs` |

In Forgejo, the `forge` and `forgejo` contexts are supported in addition to `github`.

The new test covers a matrix with [`include`](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstrategymatrixinclude), [`exclude`](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstrategymatrixexclude) and custom properties. Both available and unavailable contexts are tested.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1033): <!--number 1033 --><!--line 0 --><!--description Y2hvcmU6IHRlc3Q6IGV4ZXJjaXNlIGNvbnRleHRzIGluIG1hdHJpeCB3aGVuIHZhbGlkYXRpbmcgd29ya2Zsb3dz-->chore: test: exercise contexts in matrix when validating workflows<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: 2franix <code@c.defx.fr>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1033
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: 2franix <2franix@noreply.code.forgejo.org>
Co-committed-by: 2franix <2franix@noreply.code.forgejo.org>
2025-09-28 07:15:51 +00:00
Earl Warren
46a955d1ff
Revert "Update module connectrpc.com/connect to v1.19.0 (#1029)"
This reverts commit 9c09ca3f56.
2025-09-27 07:55:28 +02:00
Mathieu Fenniak
56ef60060b
feat: support evaluating workflow-level concurrency blocks in jobparser (#1026)
- Changes `EvaluateConcurrency` to `EvaluateWorkflowConcurrency`, which has no job-related arguments
- Changes gitContext to be sent as an object rather than a map
- Allows `nil` to be returned for `cancelInProgress`, which indicates that the value wasn't specified in the input yaml -- required for distinguishing the `cancel-in-progress: false` case from not being specified at all.

ReadWorkflowRawConcurrency & EvaluateWorkflowConcurrency were never used in forgejo yet, so this shouldn't break the forgejo build.

Prerequisite for https://codeberg.org/forgejo/forgejo/pulls/9434.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1026): <!--number 1026 --><!--line 0 --><!--description ZmVhdDogc3VwcG9ydCBldmFsdWF0aW5nIHdvcmtmbG93LWxldmVsIGNvbmN1cnJlbmN5IGJsb2NrcyBpbiBqb2JwYXJzZXI=-->feat: support evaluating workflow-level concurrency blocks in jobparser<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1026
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-09-27 04:37:36 +00:00
Earl Warren
014b4ba5f6
fix: event.pull_request.action == closed can use the cache of the base repository (#1031)
It was tested locally with https://code.forgejo.org/forgejo/end-to-end/pulls/1062/files.

## Before

![image](/attachments/26890572-08ba-4904-b6a5-f01762141a51)

## After

![image](/attachments/56352930-99a3-4011-b921-b12217c5fa54)

---

When the "closed" action of a pull request event was triggered by a merge, it effectively runs in the context of the base repository. It was merged by a user with write access to the base repository. It is authorized to write the base repository cache.

Resolves forgejo/runner#1030

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1031): <!--number 1031 --><!--line 0 --><!--description Zml4OiBldmVudC5wdWxsX3JlcXVlc3QuYWN0aW9uID09IGNsb3NlZCBjYW4gdXNlIHRoZSBjYWNoZSBvZiB0aGUgYmFzZSByZXBvc2l0b3J5-->fix: event.pull_request.action == closed can use the cache of the base repository<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1031
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-26 20:01:46 +00:00
Renovate Bot
9c09ca3f56
Update module connectrpc.com/connect to v1.19.0 (#1029)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [connectrpc.com/connect](https://github.com/connectrpc/connect-go) | `v1.18.1` -> `v1.19.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/connectrpc.com%2fconnect/v1.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/connectrpc.com%2fconnect/v1.18.1/v1.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>connectrpc/connect-go (connectrpc.com/connect)</summary>

### [`v1.19.0`](https://github.com/connectrpc/connect-go/releases/tag/v1.19.0)

[Compare Source](https://github.com/connectrpc/connect-go/compare/v1.18.1...v1.19.0)

This release introduces the highly requested "simple" flag for code generation, making Connect significantly more ergonomic for everyday RPC development.

The new simple flag in protoc-gen-connect-go generates cleaner, more intuitive client and handler interfaces that eliminate request/response wrappers for most use cases. This addresses community feedback about verbosity and provides a more straightforward API. When enabled, metadata (headers/trailers) can be passed through context instead of explicit wrapper objects, optimizing for the common case where developers don't need direct access to HTTP headers.

#### What's Changed

##### Enhancements

- Add simple flag for more ergonomic generated code by [@&#8203;bufdev](https://github.com/bufdev) and [@&#8203;smaye81](https://github.com/smaye81) in [#&#8203;851](https://github.com/connectrpc/connect-go/pull/851)
- Update Go to v1.24 and document http.Protocol use removing the dependency on `golang.org/x/net/http2` by [@&#8203;maxbrunet](https://github.com/maxbrunet) in [#&#8203;873](https://github.com/connectrpc/connect-go/pull/873), [#&#8203;877](https://github.com/connectrpc/connect-go/pull/877)
- Add support for Edition 2024 by [@&#8203;emcfarlane](https://github.com/emcfarlane) in [#&#8203;878](https://github.com/connectrpc/connect-go/pull/878)

##### Bugfixes

- Include valid spec and headers when calling recover handler for streaming RPCs by [@&#8203;jhump](https://github.com/jhump) in [#&#8203;817](https://github.com/connectrpc/connect-go/pull/817)

##### Other changes

- Go version support updated to latest two instead of three by [@&#8203;jhump](https://github.com/jhump) in [#&#8203;837](https://github.com/connectrpc/connect-go/pull/837)
- CI testing improvements by [@&#8203;pkwarren](https://github.com/pkwarren) and [@&#8203;jhump](https://github.com/jhump) in [#&#8203;838](https://github.com/connectrpc/connect-go/pull/838), [#&#8203;839](https://github.com/connectrpc/connect-go/pull/839)
- Code quality improvements by [@&#8203;mattrobenolt](https://github.com/mattrobenolt) and [@&#8203;bufdev](https://github.com/bufdev) in [#&#8203;841](https://github.com/connectrpc/connect-go/pull/841), [#&#8203;867](https://github.com/connectrpc/connect-go/pull/867)
- Documentation improvements by [@&#8203;adlion](https://github.com/adlion) and [@&#8203;stefanvanburen](https://github.com/stefanvanburen) in [#&#8203;821](https://github.com/connectrpc/connect-go/pull/821),
  [#&#8203;880](https://github.com/connectrpc/connect-go/pull/880)

#### New Contributors

- [@&#8203;adlion](https://github.com/adlion) made their first contribution in [#&#8203;821](https://github.com/connectrpc/connect-go/pull/821)
- [@&#8203;maxbrunet](https://github.com/maxbrunet) made their first contribution in [#&#8203;873](https://github.com/connectrpc/connect-go/pull/873)
- [@&#8203;stefanvanburen](https://github.com/stefanvanburen) made their first contribution in [#&#8203;880](https://github.com/connectrpc/connect-go/pull/880)

**Full Changelog**: <https://github.com/connectrpc/connect-go/compare/v1.18.1...v1.19.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMjIuMyIsInVwZGF0ZWRJblZlciI6IjQxLjEyMi4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1029
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-26 07:10:58 +00:00
Kwonunn
6bdb7ed9c7
fix: Correctly override the value of Forgejo-Cache-Host when ACTIONS_CACHE_URL is overridden. (#1027)
This fixes a bug currently preventing use of an external cache server in the Codeberg runner setup.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1027): <!--number 1027 --><!--line 0 --><!--description Zml4OiBDb3JyZWN0bHkgb3ZlcnJpZGUgdGhlIHZhbHVlIG9mIGBGb3JnZWpvLUNhY2hlLUhvc3RgIHdoZW4gQUNUSU9OU19DQUNIRV9VUkwgaXMgb3ZlcnJpZGRlbi4=-->fix: Correctly override the value of `Forgejo-Cache-Host` when ACTIONS_CACHE_URL is overridden.<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Vivian <me@vivstuff.gay>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1027
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Kwonunn <kwonunn@noreply.code.forgejo.org>
Co-committed-by: Kwonunn <kwonunn@noreply.code.forgejo.org>
2025-09-26 07:02:45 +00:00
Gusted
8debbe699e
chore: fix typo in the documentation (#1025)
Ref: forgejo/docs#1506

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1025): <!--number 1025 --><!--line 0 --><!--description Rml4IHR5cG8=-->Fix typo<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1025
Reviewed-by: Beowulf <beowulf@noreply.code.forgejo.org>
Co-authored-by: Gusted <gusted@noreply.code.forgejo.org>
Co-committed-by: Gusted <gusted@noreply.code.forgejo.org>
2025-09-23 06:41:07 +00:00
Renovate Bot
fb1a38b840
Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.5.0 (#1023)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/golangci/golangci-lint/v2/cmd/golangci-lint](https://github.com/golangci/golangci-lint) | `v2.4.0` -> `v2.5.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgolangci%2fgolangci-lint%2fv2%2fcmd%2fgolangci-lint/v2.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgolangci%2fgolangci-lint%2fv2%2fcmd%2fgolangci-lint/v2.4.0/v2.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>golangci/golangci-lint (github.com/golangci/golangci-lint/v2/cmd/golangci-lint)</summary>

### [`v2.5.0`](https://github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v250)

[Compare Source](https://github.com/golangci/golangci-lint/compare/v2.4.0...v2.5.0)

1. New linters
   - Add `godoclint` linter <https://github.com/godoc-lint/godoc-lint>
   - Add `unqueryvet` linter <https://github.com/MirrexOne/unqueryvet>
   - Add `iotamixing` linter <https://github.com/AdminBenni/iota-mixing>
2. Linters new features or changes
   - `embeddedstructfieldcheck`: from 0.3.0 to 0.4.0 (new option: `empty-line`)
   - `err113`: from [`aea10b5`](aea10b59be) to 0.1.1 (skip internals of `Is` methods for `error` type)
   - `ginkgolinter`: from 0.20.0 to 0.21.0 (new option: `force-tonot`)
   - `gofumpt`: from 0.8.0 to 0.9.1 (new rule is to "clothe" naked returns for the sake of clarity)
   - `ineffassign`: from 0.1.0 to 0.2.0 (new option: `check-escaping-errors`)
   - `musttag`: from 0.13.1 to 0.14.0 (support interface methods)
   - `revive`: from 1.11.0 to 1.12.0 (new options: `identical-ifelseif-branches`, `identical-ifelseif-conditions`, `identical-switch-branches`, `identical-switch-conditions`, `package-directory-mismatch`, `unsecure-url-scheme`, `use-waitgroup-go`, `useless-fallthrough`)
   - `thelper`: from 0.6.3 to 0.7.1 (skip `t.Helper` in functions passed to `synctest.Test`)
   - `wsl`: from 5.1.1 to 5.2.0 (improvements related to subexpressions)
3. Linters bug fixes
   - `asciicheck`: from 0.4.1 to 0.5.0
   - `errname`: from 1.1.0 to 1.1.1
   - `fatcontext`: from 0.8.0 to 0.8.1
   - `go-printf-func-name`: from 0.1.0 to 0.1.1
   - `godot`: from 1.5.1 to 1.5.4
   - `gosec`: from 2.22.7 to 2.22.8
   - `nilerr`: from 0.1.1 to a temporary fork
   - `nilnil`: from 1.1.0 to 1.1.1
   - `protogetter`: from 0.3.15 to 0.3.16
   - `tagliatelle`: from 0.7.1 to 0.7.2
   - `testifylint`: from 1.6.1 to 1.6.4
4. Misc.
   - fix: "no export data" errors are now handled as a standard typecheck error
5. Documentation
   - Improve nolint section about syntax

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMTMuMyIsInVwZGF0ZWRJblZlciI6IjQxLjExMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1023
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-22 10:10:07 +00:00
Renovate Bot
225a05e1a5
Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.6 (#1022)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [code.forgejo.org/forgejo/forgejo](https://forgejo.org) ([source](https://codeberg.org/forgejo/forgejo)) | patch | `11.0.5` -> `11.0.6` |

---

### Release Notes

<details>
<summary>forgejo/forgejo (code.forgejo.org/forgejo/forgejo)</summary>

### [`v11.0.6`](https://codeberg.org/forgejo/forgejo/releases/tag/v11.0.6)

[Compare Source](https://codeberg.org/forgejo/forgejo/compare/v11.0.5...v11.0.6)

See <https://codeberg.org/forgejo/forgejo/src/branch/forgejo/release-notes-published/11.0.6.md>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMTMuMyIsInVwZGF0ZWRJblZlciI6IjQxLjExMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1022
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-21 06:51:38 +00:00
Earl Warren
8512d76ce7
chore: upgrade LXC example to Debian GNU/Linux trixie (#1020)
<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1020): <!--number 1020 --><!--line 0 --><!--description Y2hvcmU6IHVwZ3JhZGUgTFhDIGV4YW1wbGUgdG8gRGViaWFuIEdOVS9MaW51eCB0cml4aWU=-->chore: upgrade LXC example to Debian GNU/Linux trixie<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1020
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-20 20:57:17 +00:00
Earl Warren
ed7dcb0081
fix: a composite action must not change the result of the calling step before it completes (#1019)
Resolves forgejo/runner#1014

---

Manual testing can also be done using the [reproducer from the issue](https://code.forgejo.org/forgejo/runner/issues/1014#issuecomment-60694).

## Before

The first step of the local composite action sets the step result of the job to success which confuses Forgejo display.

![image](/attachments/4f5c9477-47b8-4450-a858-c86312ced946)

## After

Forgejo displays the progress of the composite action in the step calling it.

![image](/attachments/eed08b5d-b590-472f-9140-eced739dd47b)

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1019): <!--number 1019 --><!--line 0 --><!--description Zml4OiBhIGNvbXBvc2l0ZSBhY3Rpb24gbXVzdCBub3QgY2hhbmdlIHRoZSByZXN1bHQgb2YgdGhlIGNhbGxpbmcgc3RlcCBiZWZvcmUgaXQgY29tcGxldGVz-->fix: a composite action must not change the result of the calling step before it completes<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1019
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-20 16:30:19 +00:00
Renovate Bot
71bd44f9a0
Update https://data.forgejo.org/actions/setup-forgejo action to v3.0.4 (#1021)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://data.forgejo.org/actions/setup-forgejo](https://code.forgejo.org/actions/setup-forgejo) | action | patch | `v3.0.3` -> `v3.0.4` |

---

### Release Notes

<details>
<summary>actions/setup-forgejo (https://data.forgejo.org/actions/setup-forgejo)</summary>

### [`v3.0.4`](https://code.forgejo.org/actions/setup-forgejo/compare/v3.0.3...v3.0.4)

[Compare Source](https://code.forgejo.org/actions/setup-forgejo/compare/v3.0.3...v3.0.4)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMTMuMyIsInVwZGF0ZWRJblZlciI6IjQxLjExMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1021
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-20 16:26:21 +00:00
Renovate Bot
aed4dd8766
Update forgejo-runner to v11.1.1 (#1018)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [code.forgejo.org/forgejo/runner](https://forgejo.org) ([source](https://code.forgejo.org/forgejo/runner)) | minor | `11.0.0` -> `11.1.1` |
| [forgejo/runner](https://code.forgejo.org/forgejo/runner) | minor | `11.0.0` -> `11.1.1` |

---

### Release Notes

<details>
<summary>forgejo/runner (code.forgejo.org/forgejo/runner)</summary>

### [`v11.1.1`](https://code.forgejo.org/forgejo/runner/releases/tag/v11.1.1)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v11.1.0...v11.1.1)

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1017): <!--number 1017 --><!--line 0 --><!--description Zml4OiBvdXRwdXRzIGFyZSBvbmx5IHNldCB3aGVuIHRoZSBqb2IgaXMgc3VjY2Vzc2Z1bA==-->fix: outputs are only set when the job is successful<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1015): <!--number 1015 --><!--line 0 --><!--description Zml4KHByZS1jb21taXQpOiBkb27igJl0IGRlZmF1bHQgYHZlcmJvc2VgIHRvIG9u-->fix(pre-commit): don’t default `verbose` to on<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1013): <!--number 1013 --><!--line 0 --><!--description Y2hvcmU6IGRvY3VtZW50IHRoYXQgRE9DS0VSX0hPU1Qgc2hvdWxkIGJlIHVzZWQgaW5zdGVhZCBvZiAtLWNvbnRhaW5lci1kYWVtb24tc29ja2V0-->chore: document that DOCKER\_HOST should be used instead of --container-daemon-socket<!--description-->

<!--end release-notes-assistant-->

### [`v11.1.0`](https://code.forgejo.org/forgejo/runner/releases/tag/v11.1.0)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v11.0.0...v11.1.0)

> **Warning** Upgrade to v11.1.1 instead. A [regression was found](https://code.forgejo.org/forgejo/runner/issues/1016) that crashed the runner on skipped or failed jobs.

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1002): <!--number 1002 --><!--line 0 --><!--description ZmVhdDogYWRkIHByZS1jb21taXQgaG9vayBmb3IgdmFsaWRhdG9y-->feat: add pre-commit hook for validator<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1008): <!--number 1008 --><!--line 0 --><!--description ZmVhdDogdmFsaWRhdGUgLS1kaXJlY3RvcnkgYWx0ZXJuYXRpdmUgdG8gLS1yZXBvc2l0b3J5IHRvIG5vdCBjbG9uZQ==-->feat: validate --directory alternative to --repository to not clone<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/999): <!--number 999 --><!--line 0 --><!--description ZmVhdDogdGhlIGZvcmdlam8gY29udGV4dCBpcyBlcXVpdmFsZW50IHRvIHRoZSBnaXRodWIgY29udGV4dA==-->feat: the forgejo context is equivalent to the github context<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/997): <!--number 997 --><!--line 0 --><!--description ZmVhdDogYWRkIHN1cHBvcnQgZm9yIGEgRGViaWFuIEdOVS9MaW51eCBMWEMgYmFja2VuZCBiYXNlZCBvbiB0cml4aWUgKGUuZy4gdHJpeGllLWx4YzpseGM6Ly9kZWJpYW46dHJpeGllKQ==-->feat: add support for a Debian GNU/Linux LXC backend based on trixie (e.g. trixie-lxc:lxc://debian:trixie)<!--description-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1012): <!--number 1012 --><!--line 0 --><!--description Zml4OiBzY2hlbWEgdmFsaWRhdGlvbiBtdXN0IGFjY2VwdCBhbGlhc2VzIGFuZCBtZXJnZXM=-->fix: schema validation must accept aliases and merges<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1009): <!--number 1009 --><!--line 0 --><!--description Zml4OiBmb3JnZWpvLXJ1bm5lciB2YWxpZGF0ZSBleGl0IHdpdGggZXJyb3Igd2hlbiB2YWxpZGF0aW9uIGZhaWxz-->fix: forgejo-runner validate exit with error when validation fails<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1006): <!--number 1006 --><!--line 0 --><!--description Zml4OiBkbyBub3Qgc2F2ZSAucnVubmVyIHVubGVzcyBpdCBpcyBtb2RpZmllZA==-->fix: do not save .runner unless it is modified<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1003): <!--number 1003 --><!--line 0 --><!--description Zml4OiByZW1vdmUgTFhDIHdvcmtpbmcgZGlyZWN0b3J5IHdoZW4gaXQgY29tcGxldGVz-->fix: remove LXC working directory when it completes<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/995): <!--number 995 --><!--line 0 --><!--description Zml4OiBzZW5kIGpvYiBvdXRwdXRzICYgam9iIHJlc3VsdCB0byBGb3JnZWpvIGluIHN5bmMgd2l0aCBlYWNoIG90aGVy-->fix: send job outputs & job result to Forgejo in sync with each other<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/986): <!--number 986 --><!--line 0 --><!--description Zml4OiBpZiB0aGUgRm9yZ2VqbyBpbnN0YW5jZSBmYWlsZWQgYSBqb2IsIGNhbmNlbCBpdA==-->fix: if the Forgejo instance failed a job, cancel it<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/982): <!--number 982 --><!--line 0 --><!--description Zml4OiBlbmZvcmNlIGpvYi48am9iLWlkPi50aW1lb3V0LW1pbnV0ZXM=-->fix: enforce job.<job-id>.timeout-minutes<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/972): <!--number 972 --><!--line 0 --><!--description Zml4OiB1c2UgYSBmaXhlZCBydW5uZXIgbmFtZSBmb3Igb2xkICg8PSB2MS4yMCkgRm9yZ2VqbyBpbnN0YW5jZXM=-->fix: use a fixed runner name for old (<= v1.20) Forgejo instances<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/965): <!--number 965 --><!--line 0 --><!--description Zml4OiBkb2NrZXItY29tcG9zZSBleGFtcGxlOiBhbGxvdyB0aGUgcnVubmVyIHRvIGtlZXAgaXRzIGxhYmVscw==-->fix: docker-compose example: allow the runner to keep its labels<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1001): <!--number 1001 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9seGMtaGVscGVycyB0byB2MS4xLjA=-->Update dependency forgejo/lxc-helpers to v1.1.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1000): <!--number 1000 --><!--line 0 --><!--description Y2hvcmU6IG1pbmltYWwgaW50ZWdyYXRpb24gdGVzdCBmb3IgdGhlIExYQyBiYWNrZW5k-->chore: minimal integration test for the LXC backend<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/993): <!--number 993 --><!--line 0 --><!--description Y2hvcmU6IHVuaWZ5IGFjdGlvbnMgVVJMcyBpbiAuZm9yZ2Vqby93b3JrZmxvd3M=-->chore: unify actions URLs in .forgejo/workflows<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/992): <!--number 992 --><!--line 0 --><!--description VXBkYXRlIGh0dHBzOi8vZGF0YS5mb3JnZWpvLm9yZy9hY3Rpb25zL2Nhc2NhZGluZy1wciBhY3Rpb24gdG8gdjIuMy4w-->Update <https://data.forgejo.org/actions/cascading-pr> action to v2.3.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/990): <!--number 990 --><!--line 0 --><!--description Y2hvcmU6IGRhdGEuZm9yZ2Vqby5vcmcvYWN0aW9ucy9jYXNjYWRpbmctcHIgaXMgdGhlIGNhbm9uaWNhbCBsb2NhdGlvbg==-->chore: data.forgejo.org/actions/cascading-pr is the canonical location<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/989): <!--number 989 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9yZWxlYXNlLW5vdGVzLWFzc2lzdGFudCB0byB2MS40LjE=-->Update dependency forgejo/release-notes-assistant to v1.4.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/988): <!--number 988 --><!--line 0 --><!--description Y2hvcmU6IHdhaXQgNCB0aW1lcyBsb25nZXIgZm9yIHRoZSBmb3JnZWpvIGNhc2NhZGUgcHVsbCByZXF1ZXN0IHRvIGNvbXBsZXRl-->chore: wait 4 times longer for the forgejo cascade pull request to complete<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/985): <!--number 985 --><!--line 0 --><!--description UmVtb3ZlIHdpbmRvd3MgYnVpbGQvdGVzdCBwaXBlbGluZSBmb3IgR2l0SHVi-->Remove windows build/test pipeline for GitHub<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/981): <!--number 981 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBjb2RlLmZvcmdlam8ub3JnL2Zvcmdlam8vYWN0aW9ucy1wcm90byB0byB2MC41LjI=-->Update module code.forgejo.org/forgejo/actions-proto to v0.5.2<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/969): <!--number 969 --><!--line 0 --><!--description VXBkYXRlIGh0dHBzOi8vZGF0YS5mb3JnZWpvLm9yZy9hY3Rpb25zL3NldHVwLWZvcmdlam8gYWN0aW9uIHRvIHYzLjAuMw==-->Update <https://data.forgejo.org/actions/setup-forgejo> action to v3.0.3<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/975): <!--number 975 --><!--line 0 --><!--description VXBkYXRlIGZvcmdlam8tcnVubmVyIHRvIHYxMSAobWFqb3Ip-->Update forgejo-runner to v11 (major)<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/973): <!--number 973 --><!--line 0 --><!--description Y2k6IHVwZGF0ZSBmb3JnZWpvIHZlcnNpb24gZm9yIHJlbGVhc2UgaW50ZWdyYXRpb24=-->ci: update forgejo version for release integration<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/970): <!--number 970 --><!--line 0 --><!--description Y2hvcmU6IGx4Yy1zeXN0ZW1kIG1heSBuZWVkIG1vcmUgdGltZSB0byBzdGFydCBvbiBzbG93IG1hY2hpbmVz-->chore: lxc-systemd may need more time to start on slow machines<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/966): <!--number 966 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnb2xhbmcub3JnL3gvdGVybSB0byB2MC4zNS4w-->Update module golang.org/x/term to v0.35.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/964): <!--number 964 --><!--line 0 --><!--description Y2hvcmU6IGNhbGwgdGhlIHJlbGVhc2Ugbm90ZXMgYXNzaXN0YW50IHdoZW4gb3BlbmluZyBhIG5ldyBwdWxsIHJlcXVlc3Q=-->chore: call the release notes assistant when opening a new pull request<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/954): <!--number 954 --><!--line 0 --><!--description Y2hvcmU6IHNraXAgcmVsZWFzZS1ub3Rlcy1hc3Npc3RhbnQgZm9yIGRlcGVuZGVuY3kgdXBkYXRlcw==-->chore: skip release-notes-assistant for dependency updates<!--description-->

<!--end release-notes-assistant-->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMTMuMyIsInVwZGF0ZWRJblZlciI6IjQxLjExMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1018
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-19 04:31:14 +00:00
Earl Warren
331979b887
fix: outputs are only set when the job is successful (#1017)
Resolves forgejo/runner#1016

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1017): <!--number 1017 --><!--line 0 --><!--description Zml4OiBvdXRwdXRzIGFyZSBvbmx5IHNldCB3aGVuIHRoZSBqb2IgaXMgc3VjY2Vzc2Z1bA==-->fix: outputs are only set when the job is successful<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1017
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-18 16:17:56 +00:00
Freso
c25bd51857
fix(pre-commit): don’t default verbose to on (#1015)
`verbose` was only set here as a work-around to make sure users saw the output of `validate` since there was no fail signal from the executable.

As of https://code.forgejo.org/forgejo/runner/pulls/1009 there now is a signal that the validation failed which pre-commit can pick up on, so we no longer need to default `verbose` to be on.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1015): <!--number 1015 --><!--line 0 --><!--description Zml4KHByZS1jb21taXQpOiBkb27igJl0IGRlZmF1bHQgYHZlcmJvc2VgIHRvIG9u-->fix(pre-commit): don’t default `verbose` to on<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1015
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Freso <freso@noreply.code.forgejo.org>
Co-committed-by: Freso <freso@noreply.code.forgejo.org>
2025-09-18 12:02:07 +00:00
Earl Warren
ae283ef0f5
chore: document that DOCKER_HOST should be used instead of --container-daemon-socket (#1013)
Resolves forgejo/runner#577

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1013): <!--number 1013 --><!--line 0 --><!--description Y2hvcmU6IGRvY3VtZW50IHRoYXQgRE9DS0VSX0hPU1Qgc2hvdWxkIGJlIHVzZWQgaW5zdGVhZCBvZiAtLWNvbnRhaW5lci1kYWVtb24tc29ja2V0-->chore: document that DOCKER_HOST should be used instead of --container-daemon-socket<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1013
Reviewed-by: sclu1034 <sclu1034@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-18 11:51:33 +00:00
Freso
f4eb8e57fb
feat: add pre-commit hook for validator (#1002)
This will allow users to validate their Forgejo Actions files (both actions and workflows) prior to committing them to their repositories, using a `pre-commit` configuration similar to
```yaml
  - repo: https://code.forgejo.org/forgejo/runner
    rev: v11.1.0
    hooks:
      - id: forgejo-runner-validate
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1002): <!--number 1002 --><!--line 0 --><!--description ZmVhdDogYWRkIHByZS1jb21taXQgaG9vayBmb3IgdmFsaWRhdG9y-->feat: add pre-commit hook for validator<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1002
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Freso <freso@noreply.code.forgejo.org>
Co-committed-by: Freso <freso@noreply.code.forgejo.org>
2025-09-18 08:08:57 +00:00
Earl Warren
b8ab05e367
fix: schema validation must accept aliases and merges (#1012)
- aliases are an indirection to follow
  https://yaml.org/spec/1.2.1/#id2785586
- merges cannot be conveniently validated and are skipped
  https://yaml.org/type/merge.html

Resolves forgejo/runner#1011

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1012): <!--number 1012 --><!--line 0 --><!--description Zml4OiBzY2hlbWEgdmFsaWRhdGlvbiBtdXN0IGFjY2VwdCBhbGlhc2VzIGFuZCBtZXJnZXM=-->fix: schema validation must accept aliases and merges<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1012
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-18 07:19:44 +00:00
earl-warren
797e0cd250
fix: forgejo-runner validate exit with error when validation fails (#1009)
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1009
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-09-18 06:52:19 +00:00
Earl Warren
8c6c089a65
fix: forgejo-runner validate exit with error when validation fails
Refs forgejo/runner#1002
2025-09-18 08:40:41 +02:00
Earl Warren
bcf2bfbf20
fix: find action.y*ml at the root of the directory
The lookup of action.y*ml files failed at the root of the directory
when specified with . because it does not start with a / when walking
the directory.
2025-09-18 08:36:33 +02:00
Earl Warren
89f37985bd
feat: validate --directory alternative to --repository to not clone (#1008)
Resolves forgejo/forgejo-actions-feature-requests#51

---

Note to reviewers: while working on fixing the exit status of the validate command, a border case was discovered when using `--clonedir . --repository .` by which it will not find an `action.yml` file at the root of the directory. It will be easier to fix and test using a `--directory` option designed to use a pre-existing directory instead because it is not a border case but the most common case really.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1008): <!--number 1008 --><!--line 0 --><!--description ZmVhdDogdmFsaWRhdGUgLS1kaXJlY3RvcnkgYWx0ZXJuYXRpdmUgdG8gLS1yZXBvc2l0b3J5IHRvIG5vdCBjbG9uZQ==-->feat: validate --directory alternative to --repository to not clone<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1008
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-17 16:40:31 +00:00
Earl Warren
aaf9dea44a
fix: do not save .runner unless it is modified (#1006)
Resolves forgejo/runner#548

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1006): <!--number 1006 --><!--line 0 --><!--description Zml4OiBkbyBub3Qgc2F2ZSAucnVubmVyIHVubGVzcyBpdCBpcyBtb2RpZmllZA==-->fix: do not save .runner unless it is modified<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1006
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-17 12:48:52 +00:00
Earl Warren
e1e7d0e85a
fix: remove LXC working directory when it completes (#1003)
The working directory was not cleaned up upon completion of a LXC job because rc.stopJobContainer() -> rc.cleanUpJobContainer() -> rc.JobContainer.Remove() was never called for LXC containers.

- stopContainer() and closeContainer() must not call
  rc.stopHostEnvironment(ctx) for LXC containers because
  - it will needlessly be called twice
  - it intercepts the call to
    - rc.stopJobContainer()
    - rc.JobContainer.Close()
- rc.stopHostEnvironment(ctx) must be called in rc.cleanUpJobContainer which is indirectly called by rc.stopJobContainer()
- since rc.JobContainer.Close() is a noop, not calling it for LXC containers had no consequence

Resolves forgejo/runner#442

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1003): <!--number 1003 --><!--line 0 --><!--description Zml4OiByZW1vdmUgTFhDIHdvcmtpbmcgZGlyZWN0b3J5IHdoZW4gaXQgY29tcGxldGVz-->fix: remove LXC working directory when it completes<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1003
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-16 19:42:04 +00:00
Renovate Bot
d98522a2b6
Update dependency forgejo/lxc-helpers to v1.1.0 (#1001)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [forgejo/lxc-helpers](https://code.forgejo.org/forgejo/lxc-helpers) | minor | `1.0.3` -> `1.1.0` |

---

### Release Notes

<details>
<summary>forgejo/lxc-helpers (forgejo/lxc-helpers)</summary>

### [`v1.1.0`](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.0.3...v1.1.0)

[Compare Source](https://code.forgejo.org/forgejo/lxc-helpers/compare/v1.0.3...v1.1.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMTMuMyIsInVwZGF0ZWRJblZlciI6IjQxLjExMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY3lVcGRhdGUiLCJydW4tZW5kLXRvLWVuZC10ZXN0cyJdfQ==-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1001
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-16 13:20:43 +00:00
earl-warren
6576754256
chore: minimal integration test for the LXC backend (#1000)
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1000
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2025-09-15 15:46:46 +00:00
Earl Warren
69df253e41
fix: ptyWriter.AutoStop is used by multiple goroutines
```
WARNING: DATA RACE
Write at 0x00c0008541d8 by goroutine 9324:
  code.forgejo.org/forgejo/runner/v11/act/container.(*HostEnvironment).exec()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/container/host_environment.go:368 +0x12dd
  code.forgejo.org/forgejo/runner/v11/act/runner.(*stepRun).main.func1.(*HostEnvironment).ExecWithCmdLine.1()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/container/host_environment.go:388
      +0x354

Previous read at 0x00c0008541d8 by goroutine 9328:
  code.forgejo.org/forgejo/runner/v11/act/container.(*ptyWriter).Write()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/container/host_environment.go:199 +0x57
  io.copyBuffer()
      /home/debian/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.7.linux-amd64/src/io/io.go:431
      +0x2ce

Goroutine 9324 (running) created at:
  code.forgejo.org/forgejo/runner/v11/act/runner.(*runnerImpl).NewPlanExecutor.func1.NewParallelExecutor.2()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/common/executor.go:105 +0x144
  code.forgejo.org/forgejo/runner/v11/act/runner.(*runnerImpl).NewPlanExecutor.func1.NewParallelExecutor.3.1()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/common/executor.go:107 +0x61
  code.forgejo.org/forgejo/runner/v11/act/runner.(*runnerImpl).NewPlanExecutor.func1.NewParallelExecutor.3.gowrap1()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/common/executor.go:109 +0x4f
Goroutine 9328 (running) created at:
  code.forgejo.org/forgejo/runner/v11/act/container.(*HostEnvironment).exec()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/container/host_environment.go:356 +0x112a
  code.forgejo.org/forgejo/runner/v11/act/runner.(*stepRun).main.func1.(*HostEnvironment).ExecWithCmdLine.1()
      /home/debian/.cache/act/37b13738279f9342/hostexecutor/act/container/host_environment.go:388 +0x354
  code.forgejo.org/forgejo/runner/v11/act/runner.(*stepRun).main.func1()
```
2025-09-15 17:17:44 +02:00
Earl Warren
6877142ba4
chore: minimal integration test for the LXC backend 2025-09-15 16:14:11 +02:00
Earl Warren
b3c603644a
chore: set log level to trace for runner tests 2025-09-15 15:53:21 +02:00
Earl Warren
5c93da6fc7
feat: the forgejo context is equivalent to the github context (#999)
Resolves forgejo/runner#729

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/999): <!--number 999 --><!--line 0 --><!--description ZmVhdDogdGhlIGZvcmdlam8gY29udGV4dCBpcyBlcXVpdmFsZW50IHRvIHRoZSBnaXRodWIgY29udGV4dA==-->feat: the forgejo context is equivalent to the github context<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/999
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-15 09:14:11 +00:00
cascading-pr
543f3fd495
feat: add support for a trixie based Debian GNU/Linux backend (e.g. trixie-lxc:lxc://debian:trixie) (#997)
cascading-pr from https://code.forgejo.org/forgejo/lxc-helpers/pulls/35

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/997): <!--number 997 --><!--line 0 --><!--description ZmVhdDogYWRkIHN1cHBvcnQgZm9yIGEgdHJpeGllIGJhc2VkIERlYmlhbiBHTlUvTGludXggYmFja2VuZCAoZS5nLiB0cml4aWUtbHhjOmx4YzovL2RlYmlhbjp0cml4aWUp-->feat: add support for a trixie based Debian GNU/Linux backend (e.g. trixie-lxc:lxc://debian:trixie)<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: cascading-pr <cascading-pr@example.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/997
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
Co-committed-by: cascading-pr <cascading-pr@noreply.code.forgejo.org>
2025-09-15 07:26:56 +00:00
Mathieu Fenniak
2573ccaf19
fix: send job outputs & job result to Forgejo in sync with each other (#995)
Fixes #994.

First commit ensures that the interpolateResults method is invoked before data is sent to the reporter.  Second commit changes how data is sent to the reporter to include both the result and the job outputs.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/995): <!--number 995 --><!--line 0 --><!--description Zml4OiBzZW5kIGpvYiBvdXRwdXRzICYgam9iIHJlc3VsdCB0byBGb3JnZWpvIGluIHN5bmMgd2l0aCBlYWNoIG90aGVy-->fix: send job outputs & job result to Forgejo in sync with each other<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/995
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-09-14 20:02:43 +00:00
Earl Warren
3585d67743
chore: unify actions URLs in .forgejo/workflows (#993)
- make them all absolute
- use data.forgejo.org instead of code.forgejo.org

This allows renovate to propose more consistent updates.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/993): <!--number 993 --><!--line 0 --><!--description Y2hvcmU6IHVuaWZ5IGFjdGlvbnMgVVJMcyBpbiAuZm9yZ2Vqby93b3JrZmxvd3M=-->chore: unify actions URLs in .forgejo/workflows<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/993
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-13 17:35:56 +00:00
Renovate Bot
458dae9827
Update https://data.forgejo.org/actions/cascading-pr action to v2.3.0 (#992)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://data.forgejo.org/actions/cascading-pr](https://code.forgejo.org/actions/cascading-pr) | action | minor | `v2.2.1` -> `v2.3.0` |

---

### Release Notes

<details>
<summary>actions/cascading-pr (https://data.forgejo.org/actions/cascading-pr)</summary>

### [`v2.3.0`](https://code.forgejo.org/actions/cascading-pr/compare/v2.2.1...v2.3.0)

[Compare Source](https://code.forgejo.org/actions/cascading-pr/compare/v2.2.1...v2.3.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45OS44IiwidXBkYXRlZEluVmVyIjoiNDEuOTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmN5VXBkYXRlIiwicnVuLWVuZC10by1lbmQtdGVzdHMiXX0=-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/992
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-12 11:04:10 +00:00
Earl Warren
19f4dbeb4b
chore: data.forgejo.org/actions/cascading-pr is the canonical location (#990)
![image](/attachments/28a98026-29ec-41c2-b3c6-c539098e8df6)

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/990): <!--number 990 --><!--line 0 --><!--description Y2hvcmU6IGRhdGEuZm9yZ2Vqby5vcmcvYWN0aW9ucy9jYXNjYWRpbmctcHIgaXMgdGhlIGNhbm9uaWNhbCBsb2NhdGlvbg==-->chore: data.forgejo.org/actions/cascading-pr is the canonical location<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/990
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-12 06:49:16 +00:00
Renovate Bot
b6c9da470e
Update dependency forgejo/release-notes-assistant to v1.4.1 (#989)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [forgejo/release-notes-assistant](https://code.forgejo.org/forgejo/release-notes-assistant) | patch | `v1.4.0` -> `v1.4.1` |

---

### Release Notes

<details>
<summary>forgejo/release-notes-assistant (forgejo/release-notes-assistant)</summary>

### [`v1.4.1`](https://code.forgejo.org/forgejo/release-notes-assistant/releases/tag/v1.4.1)

[Compare Source](https://code.forgejo.org/forgejo/release-notes-assistant/compare/v1.4.0...v1.4.1)

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/release-notes-assistant-->

- other
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/115): <!--number 115 --><!--line 0 --><!--description VXBkYXRlIGh0dHBzOi8vZGF0YS5mb3JnZWpvLm9yZy9hY3Rpb25zL2Zvcmdlam8tcmVsZWFzZSBhY3Rpb24gdG8gdjIuNy4z-->Update <https://data.forgejo.org/actions/forgejo-release> action to v2.7.3<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/114): <!--number 114 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBtdmRhbi5jYy9nb2Z1bXB0IHRvIHYwLjkuMQ==-->Update module mvdan.cc/gofumpt to v0.9.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/113): <!--number 113 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZ28gdG8gdjEuMjQuNw==-->Update dependency go to v1.24.7<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/112): <!--number 112 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBtdmRhbi5jYy9nb2Z1bXB0IHRvIHYwLjkuMA==-->Update module mvdan.cc/gofumpt to v0.9.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/110): <!--number 110 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3N0cmV0Y2hyL3Rlc3RpZnkgdG8gdjEuMTEuMA==-->Update module github.com/stretchr/testify to v1.11.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/109): <!--number 109 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL2dvbGFuZ2NpL2dvbGFuZ2NpLWxpbnQvdjIvY21kL2dvbGFuZ2NpLWxpbnQgdG8gdjIuNC4w-->Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.4.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/108): <!--number 108 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnb2xhbmcub3JnL3gvdG9vbHMvY21kL2RlYWRjb2RlIHRvIHYwLjM2LjA=-->Update module golang.org/x/tools/cmd/deadcode to v0.36.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/107): <!--number 107 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZ28gdG8gdjEuMjQuNg==-->Update dependency go to v1.24.6<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/106): <!--number 106 --><!--line 0 --><!--description VXBkYXRlIGh0dHBzOi8vZGF0YS5mb3JnZWpvLm9yZy9hY3Rpb25zL2Zvcmdlam8tcmVsZWFzZSBhY3Rpb24gdG8gdjIuNy4y-->Update <https://data.forgejo.org/actions/forgejo-release> action to v2.7.2<!--description-->
  - [PR](https://code.forgejo.org/forgejo/release-notes-assistant/pulls/105): <!--number 105 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL2dvbGFuZ2NpL2dvbGFuZ2NpLWxpbnQvdjIvY21kL2dvbGFuZ2NpLWxpbnQgdG8gdjIuMy4x-->Update module github.com/golangci/golangci-lint/v2/cmd/golangci-lint to v2.3.1<!--description-->

<!--end release-notes-assistant-->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45OS44IiwidXBkYXRlZEluVmVyIjoiNDEuOTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmN5VXBkYXRlIiwicnVuLWVuZC10by1lbmQtdGVzdHMiXX0=-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/989
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-12 05:31:59 +00:00
Earl Warren
f728f8a923
fix: if the Forgejo instance failed a job, cancel it (#986)
- when the Forgejo instance stops a job because it runs for too long, it will be reported back as failed and it must be stopped, exactly as if it was canceled from the web UI by the user.
- add test coverage for Reporter.ReportState
- extract Reporter.Outputs output of Reporter.ReportState

Resolves https://code.forgejo.org/forgejo/runner/issues/980

---

Manual testing with a locally built Forgejo instance built to check every minute instead of every 30 minutes, with

```ini
[actions]
ENABLED = true
ENDLESS_TASK_TIMEOUT = 1m
```

and the following workflow:

```yaml
on: [push]
jobs:
  test:
    runs-on: docker
    steps:
      - run: sleep 60
      - run: sleep 61
      - run: sleep 62
```

waiting in front of the screen and watching the logs of the runner, I see it stops before `sleep 62` is complete.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/986): <!--number 986 --><!--line 0 --><!--description Zml4OiBpZiB0aGUgRm9yZ2VqbyBpbnN0YW5jZSBmYWlsZWQgYSBqb2IsIGNhbmNlbCBpdA==-->fix: if the Forgejo instance failed a job, cancel it<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/986
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-11 20:03:17 +00:00
Earl Warren
6f212fbb5a
chore: wait 4 times longer for the forgejo cascade pull request to complete (#988)
If the CI is busy, it may take more than one hour, for instance because the workflow is waiting while others are running.

---

Note to reviewers: this input is not yet implemented, the next version of the cascading-pr action will have it (see [the pr](https://code.forgejo.org/actions/cascading-pr/pulls/40)). In the meantime it will be ignored.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/988): <!--number 988 --><!--line 0 --><!--description Y2hvcmU6IHdhaXQgNCB0aW1lcyBsb25nZXIgZm9yIHRoZSBmb3JnZWpvIGNhc2NhZGUgcHVsbCByZXF1ZXN0IHRvIGNvbXBsZXRl-->chore: wait 4 times longer for the forgejo cascade pull request to complete<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/988
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-11 17:11:06 +00:00
Earl Warren
02a51c0a21
fix: enforce job.<job-id>.timeout-minutes (#982)
- enforce timeout-minutes timeout for jobs in a way similar  to how it is done for steps
- minimal refactor of evaluateStepTimeout evaluateTimeout so it  can be used by jobs as well, with additional debug information  and error logging if parsing fails
- add integration tests for both step and job timeout-minutes,  verifying expressions are allowed and evaluated

Resolves forgejo/runner#979

---

Manually verified to work as expected https://v13.next.forgejo.org/earl-warren/testtimeout-minutes/actions/runs/3/jobs/0/attempt/1

```yaml
on: [push]
jobs:
  test:
    runs-on: docker
    timeout-minutes: 1
    steps:
      - run: |
          set -x
          while : ; do
            sleep 30
          done
```

![image](/attachments/047ddd15-7109-4931-a6ed-43073e4d31f9)

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/982): <!--number 982 --><!--line 0 --><!--description Zml4OiBlbmZvcmNlIGpvYi48am9iLWlkPi50aW1lb3V0LW1pbnV0ZXM=-->fix: enforce job.<job-id>.timeout-minutes<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/982
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-11 14:43:26 +00:00
Crown0815
933667bdf1
Remove windows build/test pipeline for GitHub (#985)
Windows builds have move to an [independent repository](https://github.com/Crown0815/Forgejo-runner-windows-builder).

Same changes as in #983

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/985): <!--number 985 --><!--line 0 --><!--description UmVtb3ZlIHdpbmRvd3MgYnVpbGQvdGVzdCBwaXBlbGluZSBmb3IgR2l0SHVi-->Remove windows build/test pipeline for GitHub<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Felix Kröner <felix.kroener@bruker.com>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/985
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Crown0815 <crown0815@noreply.code.forgejo.org>
Co-committed-by: Crown0815 <crown0815@noreply.code.forgejo.org>
2025-09-11 11:25:52 +00:00
Renovate Bot
3dd167d770
Update module code.forgejo.org/forgejo/actions-proto to v0.5.2 (#981)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| code.forgejo.org/forgejo/actions-proto | `v0.5.1` -> `v0.5.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/code.forgejo.org%2fforgejo%2factions-proto/v0.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/code.forgejo.org%2fforgejo%2factions-proto/v0.5.1/v0.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45Ny45IiwidXBkYXRlZEluVmVyIjoiNDEuOTcuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmN5VXBkYXRlIiwicnVuLWVuZC10by1lbmQtdGVzdHMiXX0=-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/981
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-11 04:50:00 +00:00
Earl Warren
16276cc0d6
fix: use a fixed runner name for old (<= v1.20) Forgejo instances (#972)
The bug was already there before the recent refactor. Only it
manifested itself when shutting down the runner because
`resp.Msg.GetRunner().GetName()` was only called then. It was
correctly refactored in the createRunner function and therefore
surfaced because `resp.Msg.GetRunner().GetName()` was called
during initialization instead of during shutdown.

```
time="2025-09-10T05:41:10Z" level=info msg="log level changed to debug" func="[func2]" file="[daemon.go:130]"
time="2025-09-10T05:41:10Z" level=info msg="Starting runner daemon" func="[runDaemon]" file="[daemon.go:51]"
time="2025-09-10T05:41:10Z" level=warning msg="Because the Forgejo instance is an old version, skipping declaring the labels and version." func="[func6]" file="[daemon.go:208]"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xcc1a23]
goroutine 1 [running]:
code.forgejo.org/forgejo/runner/v11/internal/app/cmd.init.func6({0x111f428, 0xc0000e8ab0}, 0xc0003b4000, 0xc0003b8230, {0x1125eb8?, 0xc000424040?}, {0xc000032840, 0x6, 0x8})
	/srv/internal/app/cmd/daemon.go:222 +0x4a3
code.forgejo.org/forgejo/runner/v11/internal/app/cmd.runDaemon({0x111f578, 0xc00025fa00}, 0xc0000380b0)
	/srv/internal/app/cmd/daemon.go:68 +0x23f
code.forgejo.org/forgejo/runner/v11/internal/app/cmd.Execute.getRunDaemonCommandProcessor.func6(0xc000044d00?, {0xc0000c4360?, 0x4?, 0xf63e10?})
	/srv/internal/app/cmd/daemon.go:33 +0x1f
github.com/spf13/cobra.(*Command).execute(0xc0000fe908, {0xc0000c4340, 0x2, 0x2})
	/go/pkg/mod/github.com/spf13/cobra@v1.10.1/command.go:1015 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000fe008)
	/go/pkg/mod/github.com/spf13/cobra@v1.10.1/command.go:1148 +0x46f
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.10.1/command.go:1071
code.forgejo.org/forgejo/runner/v11/internal/app/cmd.Execute({0x111f578, 0xc00025fa00})
	/srv/internal/app/cmd/cmd.go:89 +0xa05
main.main()
	/srv/main.go:18 +0x7b
20250910 05:41:10 daemon: client (pid 4264) exited with 2 status, exiting
```

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/972): <!--number 972 --><!--line 0 --><!--description Zml4OiB1c2UgYSBmaXhlZCBydW5uZXIgbmFtZSBmb3Igb2xkICg8PSB2MS4yMCkgRm9yZ2VqbyBpbnN0YW5jZXM=-->fix: use a fixed runner name for old (<= v1.20) Forgejo instances<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/972
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-10 16:06:48 +00:00
Renovate Bot
4d98bda282
Update https://data.forgejo.org/actions/setup-forgejo action to v3.0.3 (#969)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://data.forgejo.org/actions/setup-forgejo](https://code.forgejo.org/actions/setup-forgejo) | action | patch | `v3.0.2` -> `v3.0.3` |

---

### Release Notes

<details>
<summary>actions/setup-forgejo (https://data.forgejo.org/actions/setup-forgejo)</summary>

### [`v3.0.3`](https://code.forgejo.org/actions/setup-forgejo/compare/v3.0.2...v3.0.3)

[Compare Source](https://code.forgejo.org/actions/setup-forgejo/compare/v3.0.2...v3.0.3)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45Ny45IiwidXBkYXRlZEluVmVyIjoiNDEuOTcuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmN5VXBkYXRlIiwicnVuLWVuZC10by1lbmQtdGVzdHMiXX0=-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/969
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-10 09:18:53 +00:00
Renovate Bot
7f75f52aaf
Update forgejo-runner to v11 (major) (#975)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [code.forgejo.org/forgejo/runner](https://forgejo.org) ([source](https://code.forgejo.org/forgejo/runner)) | major | `9.1.1` -> `11.0.0` |
| [forgejo/runner](https://code.forgejo.org/forgejo/runner) | major | `10.0.1` -> `11.0.0` |

---

### Release Notes

<details>
<summary>forgejo/runner (code.forgejo.org/forgejo/runner)</summary>

### [`v11.0.0`](https://code.forgejo.org/forgejo/runner/releases/tag/v11.0.0)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v10.0.1...v11.0.0)

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

The breaking change in this release is not technical, it is the change of the license which is now GPLv3-or-later.

- [PR](https://code.forgejo.org/forgejo/runner/pulls/773): <!--number 773 --><!--line 0 --><!--description Y2hvcmU6IGNoYW5nZSB0aGUgbGljZW5zZSB0byBHUEx2My1vci1sYXRlcg==-->chore: change the license to GPLv3-or-later<!--description-->

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/935): <!--number 935 --><!--line 0 --><!--description Zml4OiBzaHV0ZG93biB0aGUgcnVubmVyIHdoZW4gIHRoZSBjYWNoZSBmYWlscyB3aXRoIGEgbm9uIHJlY292ZXJhYmxlIGVycm9y-->fix: shutdown the runner when  the cache fails with a non recoverable error<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/948): <!--number 948 --><!--line 0 --><!--description Zml4OiBhbHNvIGNhc2NhZGUgaWYgcnVuLSotdGVzdCBpcyBzZXQgd2hlbiB0aGUgUFIgaXMgb3Blbg==-->fix: also cascade if run-\*-test is set when the PR is open<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/946): <!--number 946 --><!--line 0 --><!--description Zml4OiBncmFjZWZ1bCBzaHV0ZG93biBvZiB0YXNrcyBiZWluZyBpbnRlcnJ1cHRlZCBieSBzaWduYWw=-->fix: graceful shutdown of tasks being interrupted by signal<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/943): <!--number 943 --><!--line 0 --><!--description Zml4OiBseGMtc3lzdGVtZCBleGFtcGxlOiBleHBvcnQgSU5QVVRTX1NFUklBTA==-->fix: lxc-systemd example: export INPUTS\_SERIAL<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/941): <!--number 941 --><!--line 0 --><!--description Zml4OiBhbGxvdyBpbnB1dHMgY29udGV4dCBpbiBhY3Rpb24gZGVmYXVsdHM=-->fix: allow inputs context in action defaults<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/931): <!--number 931 --><!--line 0 --><!--description Zml4OiBhbiBleHByZXNzaW9uIGluIHdpdGg6IGZvciBhIHJldXNhYmxlIHdvcmtmbG93IGNhbGwgY2FuIHVzZSBlbnY=-->fix: an expression in with: for a reusable workflow call can use env<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/951): <!--number 951 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnb2xhbmcub3JnL3gvdGltZSB0byB2MC4xMy4w-->Update module golang.org/x/time to v0.13.0<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/950): <!--number 950 --><!--line 0 --><!--description UmV2ZXJ0ICJmaXg6IGFsc28gY2FzY2FkZSBpZiBydW4tKi10ZXN0IGlzIHNldCB3aGVuIHRoZSBQUiBpcyBvcGVuICgjOTQ4KSI=-->Revert "fix: also cascade if run-\*-test is set when the PR is open ([#&#8203;948](https://github.com/forgejo/runner/issues/948))"<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/945): <!--number 945 --><!--line 0 --><!--description VXBkYXRlIGNvZGUuZm9yZ2Vqby5vcmcvZm9yZ2Vqby9mb3JnZWpvIERvY2tlciB0YWcgdG8gdjExLjAuNQ==-->Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.5<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/942): <!--number 942 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL2RvY2tlci9kb2NrZXIgdG8gdjI4LjQuMCtpbmNvbXBhdGlibGU=-->Update module github.com/docker/docker to v28.4.0+incompatible<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/773): <!--number 773 --><!--line 0 --><!--description Y2hvcmU6IGNoYW5nZSB0aGUgbGljZW5zZSB0byBHUEx2My1vci1sYXRlcg==-->chore: change the license to GPLv3-or-later<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/940): <!--number 940 --><!--line 0 --><!--description Y2hvcmU6IGJ1bXAgdmVyc2lvbiB0byB2MTE=-->chore: bump version to v11<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/936): <!--number 936 --><!--line 0 --><!--description cmVmYWN0b3I6IHJlbW92ZSBkdXBsaWNhdGUgY29tcHV0ZU1hYyBmdW5jdGlvbg==-->refactor: remove duplicate computeMac function<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/938): <!--number 938 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL2RvY2tlci9jbGkgdG8gdjI4LjQuMCtpbmNvbXBhdGlibGU=-->Update module github.com/docker/cli to v28.4.0+incompatible<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/934): <!--number 934 --><!--line 0 --><!--description Y2hvcmU6IHJlZmFjdG9yIGFjdC9hcnRpZmFjdGNhY2hlIEhhbmRsZXIgdG8gYW4gaW50ZXJmYWNl-->chore: refactor act/artifactcache Handler to an interface<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/933): <!--number 933 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZ28gdG8gdjEuMjQuNw==-->Update dependency go to v1.24.7<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/932): <!--number 932 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3NwZjEzL3BmbGFnIHRvIHYxLjAuMTA=-->Update module github.com/spf13/pflag to v1.0.10<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/930): <!--number 930 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3NwZjEzL2NvYnJhIHRvIHYxLjEwLjE=-->Update module github.com/spf13/cobra to v1.10.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/928): <!--number 928 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9ydW5uZXIgdG8gdjEw-->Update dependency forgejo/runner to v10<!--description-->

<!--end release-notes-assistant-->

### [`v10.0.1`](https://code.forgejo.org/forgejo/runner/releases/tag/v10.0.1)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v10.0.0...v10.0.1)

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/927): <!--number 927 --><!--line 0 --><!--description Zml4OiBwdWxsX3JlcXVlc3RfdGFyZ2V0IGV2ZW50cyBjYW4gc2hhcmUgdGhlIGNhY2hlIG9mIHRoZSByZXBvc2l0b3J5-->fix: pull\_request\_target events can share the cache of the repository<!--description-->

<!--end release-notes-assistant-->

### [`v10.0.0`](https://code.forgejo.org/forgejo/runner/releases/tag/v10.0.0)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v9.1.1...v10.0.0)

> **Warning** Upgrade to v10.0.1 instead. A regression was found on `pull_request_target` events and is fixed in the [v10.0.1 release](https://code.forgejo.org/forgejo/runner/releases/tag/v10.0.1).

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

- [PR](https://code.forgejo.org/forgejo/runner/pulls/925): <!--number 925 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogcHJldmVudCBvbjogcHVsbF9yZXF1ZXN0IGFjdGlvbnMgZnJvbSBtdXRhdGluZyBjYWNoZXMgb2Ygb3RoZXIgd29ya2Zsb3cgZXZlbnRz-->fix(security): prevent on: pull\_request actions from mutating caches of other workflow events<!--description-->
  forgej-runner currently creates a safer execution environment for workflows triggered by pull requests by denying those workflows access to the repository's secrets, preventing pull requests from compromising the confidentiality of the secrets.

  Workflows do have access to write to the action cache, which is shared with future workflow executions, including executions that may have access to repository secrets.  This was assumed safe as the cache is a "write-once" operation based upon the cache key; if an execution writes to that cache, it will be read by other workflows only if a matching key parameter is provided, and it can not be modified again.  These assumptions were identified as weak security practices with known workarounds.

  It is possible for a malicious pull request to mutate the shared cache and embed untrusted artifacts, which may later be executed in workflow executions with access to secrets, risking the confidentiality of those secrets.

  In order to eliminate this risk, workflows executing with the `pull_request` and `pull_request_target` events have their write operations to the cache isolated to future workflow executions from the same pull request.  They can continue to read from the shared cache if applicable.

  If using an external cache server configuration, both the cache server and other instances of the runner must be running the same software version.  The recommended upgrade procedure in this configuration is to bring all runners offline, upgrade the cache server to the latest release and bring it online, and then bring all other runners online.
- [PR](https://code.forgejo.org/forgejo/runner/pulls/924): <!--number 924 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogZW5zdXJlIHVuaXF1ZSBuYW1lcyBmb3IgY29udGFpbmVyIGltYWdlcyBjcmVhdGVkIGJ5IGFjdGlvbnM=-->fix(security): ensure unique names for container images created by actions<!--description-->
  Without this fix, when a workflow ran a local [docker action](https://forgejo.org/docs/next/user/actions/actions/#docker-actions) (e.g. the [example in the end-to-end tests](8f920b4b7a/actions/example-force-rebuild/.forgejo/workflows/test.yml)), it used an image tag that could collide with other workflows that happen to use the same name. The workaround for older runner versions is to set [`[container].force_rebuild: true`](https://forgejo.org/docs/next/admin/actions/runner-installation/#configuration) in the runner configuration file.

***

<!--start release-notes-assistant-->

<!--URL:https://code.forgejo.org/forgejo/runner-->

- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/925): <!--number 925 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogcHJldmVudCBvbjogcHVsbF9yZXF1ZXN0IGFjdGlvbnMgZnJvbSBtdXRhdGluZyBjYWNoZXMgb2Ygb3RoZXIgd29ya2Zsb3cgZXZlbnRz-->fix(security): prevent on: pull\_request actions from mutating caches of other workflow events<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/924): <!--number 924 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogZW5zdXJlIHVuaXF1ZSBuYW1lcyBmb3IgY29udGFpbmVyIGltYWdlcyBjcmVhdGVkIGJ5IGFjdGlvbnM=-->fix(security): ensure unique names for container images created by actions<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/921): <!--number 921 --><!--line 0 --><!--description VXBkYXRlIGNvZGUuZm9yZ2Vqby5vcmcvZm9yZ2Vqby9mb3JnZWpvIERvY2tlciB0YWcgdG8gdjExLjAuNA==-->Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.4<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/922): <!--number 922 --><!--line 0 --><!--description Y2hvcmU6IGV4cGxhaW4gdGhlIGRpZmZlcmVuY2UgYmV0d2VlbiBgam9iX2xldmVsYCBhbmQgYGxldmVsYA==-->chore: explain the difference between `job_level` and `level`<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/917): <!--number 917 --><!--line 0 --><!--description Y2hvcmU6IGFkZCByZW1pbmRlciBvZiBob3cgdG8gcnVuIGEgbG9jYWwgdGVzdA==-->chore: add reminder of how to run a local test<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/919): <!--number 919 --><!--line 0 --><!--description Y2hvcmU6IHVuaWZ5IGNhc2NhZGUtc2V0dXAtZm9yZ2VqbyB3aXRoIGNhc2NhZGUtZm9yZ2Vqbw==-->chore: unify cascade-setup-forgejo with cascade-forgejo<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/873): <!--number 873 --><!--line 0 --><!--description Y2hvcmU6IHJlbW92ZSBgZ2l0aHViLmNvbS9wa2cvZXJyb3JzYA==-->chore: remove `github.com/pkg/errors`<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/915): <!--number 915 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3N0cmV0Y2hyL3Rlc3RpZnkgdG8gdjEuMTEuMQ==-->Update module github.com/stretchr/testify to v1.11.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/914): <!--number 914 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1ZiB0byB2MS4zNi44-->Update module google.golang.org/protobuf to v1.36.8<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/907): <!--number 907 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnby5ldGNkLmlvL2Jib2x0IHRvIHYxLjQuMw==-->Update module go.etcd.io/bbolt to v1.4.3<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/906): <!--number 906 --><!--line 0 --><!--description dGVzdDogcmVtb3ZlIGludGVybmFsIHRpbWVvdXQgaW4gVGVzdFJ1bm5lckNhY2hlQ29uZmlndXJhdGlvbg==-->test: remove internal timeout in TestRunnerCacheConfiguration<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/902): <!--number 902 --><!--line 0 --><!--description Y2hvcmU6IHNraXAgdGVzdHMgdGhhdCByZXF1aXJlIEZvcmdlam8gaWYgaXQgaXMgbm90IGF2YWlsYWJsZQ==-->chore: skip tests that require Forgejo if it is not available<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/903): <!--number 903 --><!--line 0 --><!--description Y2hvcmU6IHJld29yayB0aGUgUkVBRE1F-->chore: rework the README<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/904): <!--number 904 --><!--line 0 --><!--description VXBkYXRlIGdpdGh1Yi5jb20vZ28tdmlwZXIvbWFwc3RydWN0dXJlL3YyIChpbmRpcmVjdCkgdG8gdjIuNC4wIFtTRUNVUklUWV0=-->Update github.com/go-viper/mapstructure/v2 (indirect) to v2.4.0 \[SECURITY]<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/900): <!--number 900 --><!--line 0 --><!--description Y2hvcmU6IHJlbW92ZSBUZXN0UnVuQ29udGV4dF9HZXRHaXRIdWJDb250ZXh0-->chore: remove TestRunContext\_GetGitHubContext<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/899): <!--number 899 --><!--line 0 --><!--description Y2hvcmU6IGRvIG5vdCBmb3JjZSBHT1BST1hZ-->chore: do not force GOPROXY<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/890): <!--number 890 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3Zla3RyYS9tb2NrZXJ5L3YyIHRvIHYyLjUzLjU=-->Update module github.com/vektra/mockery/v2 to v2.53.5<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/893): <!--number 893 --><!--line 0 --><!--description Y2hvcmU6IGZpeCAuUEhPTlkgbGludCB0YXJnZXRz-->chore: fix .PHONY lint targets<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/898): <!--number 898 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9ydW5uZXIgdG8gdjkuMS4x-->Update dependency forgejo/runner to v9.1.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/897): <!--number 897 --><!--line 0 --><!--description VXBkYXRlIGNvZGUuZm9yZ2Vqby5vcmcvZm9yZ2Vqby9ydW5uZXIgRG9ja2VyIHRhZyB0byB2OS4xLjE=-->Update code.forgejo.org/forgejo/runner Docker tag to v9.1.1<!--description-->

<!--end release-notes-assistant-->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45Ny45IiwidXBkYXRlZEluVmVyIjoiNDEuOTcuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmN5VXBkYXRlIiwicnVuLWVuZC10by1lbmQtdGVzdHMiXX0=-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/975
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-10 09:18:50 +00:00
Michael Kriese
106c50a51d
chore(renovate): group runner updates 2025-09-10 09:51:22 +02:00
Michael Kriese
86653c237d
ci: update forgejo version for release integration (#973)
<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/973): <!--number 973 --><!--line 0 --><!--description Y2k6IHVwZGF0ZSBmb3JnZWpvIHZlcnNpb24gZm9yIHJlbGVhc2UgaW50ZWdyYXRpb24=-->ci: update forgejo version for release integration<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/973
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
2025-09-10 07:22:16 +00:00
Earl Warren
9a62046607
chore: lxc-systemd may need more time to start on slow machines (#970)
This false negative happened in the past 24h at

https://code.forgejo.org/forgejo/runner/actions/runs/9581/jobs/0

and was resolved by just running it again.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/970): <!--number 970 --><!--line 0 --><!--description Y2hvcmU6IGx4Yy1zeXN0ZW1kIG1heSBuZWVkIG1vcmUgdGltZSB0byBzdGFydCBvbiBzbG93IG1hY2hpbmVz-->chore: lxc-systemd may need more time to start on slow machines<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/970
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-10 07:18:40 +00:00
Renovate Bot
6a6a41bf05
Update module golang.org/x/term to v0.35.0 (#966)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [golang.org/x/term](https://pkg.go.dev/golang.org/x/term) | [`v0.34.0` -> `v0.35.0`](https://cs.opensource.google/go/x/term/+/refs/tags/v0.34.0...refs/tags/v0.35.0) | [![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fterm/v0.35.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fterm/v0.34.0/v0.35.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45Ny45IiwidXBkYXRlZEluVmVyIjoiNDEuOTcuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmN5VXBkYXRlIiwicnVuLWVuZC10by1lbmQtdGVzdHMiXX0=-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/966
Reviewed-by: Gusted <gusted@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-09 08:52:15 +00:00
Earl Warren
151c90b2a9
chore: call the release notes assistant when opening a new pull request (#964)
When a new pull request is opened and has no labels, the release notes
assistant will not be called and it will look like the event was
missed.

Most of the time the label will be set when the pull request is open
and that will fire two runs. However, the release notes assistant is
idempotent and that will just make one extra run in the CI that is a
noop.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/964): <!--number 964 --><!--line 0 --><!--description Y2hvcmU6IGNhbGwgdGhlIHJlbGVhc2Ugbm90ZXMgYXNzaXN0YW50IHdoZW4gb3BlbmluZyBhIG5ldyBwdWxsIHJlcXVlc3Q=-->chore: call the release notes assistant when opening a new pull request<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/964
Reviewed-by: Gusted <gusted@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-09 05:23:55 +00:00
jankatins
02df78a9ec
fix: Allow the runner to keep it's labels (#965)
I had the case that an already registered runner was losing it's labels due to a race condition (I think): the compose file was restarted, the runner came up but 10 seconds later, the labels were reset:

>If the command is run without --labels, they will be reset, and the runner won’t set them back until it is restarted. The --keep-labels option can be used to preserve the existing labels.

I always started all services in the compose file at once, so I never got the idea to restart the runner alone and the runner logs actually always said that the labels where there:

> ... with labels: [docker-cli node-bookworm], declared successfully

Signed-off-by: jankatins <jankatins@noreply.code.forgejo.org>

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/965): <!--number 965 --><!--line 0 --><!--description Zml4OiBBbGxvdyB0aGUgcnVubmVyIHRvIGtlZXAgaXQncyBsYWJlbHM=-->fix: Allow the runner to keep it's labels<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/965
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: jankatins <jankatins@noreply.code.forgejo.org>
Co-committed-by: jankatins <jankatins@noreply.code.forgejo.org>
2025-09-08 21:27:43 +00:00
Earl Warren
864fce89d2
chore: debug release-notes-assistant workflow 2025-09-08 11:14:42 +02:00
Earl Warren
149a9e3cf5
chore: skip release-notes-assistant for dependency updates (#954)
Resolves forgejo/runner#953

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/954): <!--number 954 --><!--line 0 --><!--description Y2hvcmU6IHNraXAgcmVsZWFzZS1ub3Rlcy1hc3Npc3RhbnQgZm9yIGRlcGVuZGVuY3kgdXBkYXRlcw==-->chore: skip release-notes-assistant for dependency updates<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/954
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-08 08:41:21 +00:00
Renovate Bot
a2622dbe3d
Update module golang.org/x/time to v0.13.0 (#951)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [golang.org/x/time](https://pkg.go.dev/golang.org/x/time) | [`v0.12.0` -> `v0.13.0`](https://cs.opensource.google/go/x/time/+/refs/tags/v0.12.0...refs/tags/v0.13.0) | [![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2ftime/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2ftime/v0.12.0/v0.13.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTcuOSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/951): <!--number 951 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnb2xhbmcub3JnL3gvdGltZSB0byB2MC4xMy4w-->Update module golang.org/x/time to v0.13.0<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/951
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-08 05:00:28 +00:00
Earl Warren
ad90bb4b68
Revert "fix: also cascade if run-*-test is set when the PR is open (#948)" (#950)
This reverts commit 1178cf6d24.

This was an incorrect fix to a different problem. The `labeled` event is run when a pull request is opened. Adding an `opened` event will just needlessly duplicate the runs.

The actual problem was me assuming too quickly that a short runtime (15s) indicated that the cascade was not run.

This is what happened at https://code.forgejo.org/forgejo/runner/pulls/935

- the cascade is run https://code.forgejo.org/forgejo/runner/pulls/935#issuecomment-57986
- the duration is very short because the commit status is set [by the last event (closed)](https://code.forgejo.org/forgejo/runner/actions/runs/9344/jobs/0#jobstep-1-12)
  ![image](/attachments/2aecc2f6-8fc0-4778-91c3-de689808a30e)

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/950): <!--number 950 --><!--line 0 --><!--description UmV2ZXJ0ICJmaXg6IGFsc28gY2FzY2FkZSBpZiBydW4tKi10ZXN0IGlzIHNldCB3aGVuIHRoZSBQUiBpcyBvcGVuICgjOTQ4KSI=-->Revert "fix: also cascade if run-*-test is set when the PR is open (#948)"<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/950
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-08 00:14:44 +00:00
earl-warren
16cb2d5b75
fix: graceful shutdown of tasks being interrupted by signal (#946)
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/946
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
2025-09-07 22:45:15 +00:00
Earl Warren
1178cf6d24
fix: also cascade if run-*-test is set when the PR is open (#948)
Testing

- after merge
- open a pull request with the tags run-end-to-end-test and run-forgejo-test set
- verify both workflow run instead of being skipped

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/948): <!--number 948 --><!--line 0 --><!--description Zml4OiBhbHNvIGNhc2NhZGUgaWYgcnVuLSotdGVzdCBpcyBzZXQgd2hlbiB0aGUgUFIgaXMgb3Blbg==-->fix: also cascade if run-*-test is set when the PR is open<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/948
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-07 21:25:13 +00:00
Mathieu Fenniak
458ca52101 test: add TestRunDaemonGracefulShutdown 2025-09-07 14:00:55 -06:00
Mathieu Fenniak
bfa86327ce test: add mocks for RunnerInterface & Poller 2025-09-07 13:52:47 -06:00
Mathieu Fenniak
82cbe791dc refactor: split runDaemon into testable lambdas 2025-09-07 13:51:58 -06:00
earl-warren
09adcc47d2
fix: shutdown the runner when the cache fails with a non recoverable error (#935)
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/935
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2025-09-07 16:03:31 +00:00
Renovate Bot
441f142089
Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.5 (#945)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [code.forgejo.org/forgejo/forgejo](https://forgejo.org) ([source](https://codeberg.org/forgejo/forgejo)) | patch | `11.0.4` -> `11.0.5` |

---

### Release Notes

<details>
<summary>forgejo/forgejo (code.forgejo.org/forgejo/forgejo)</summary>

### [`v11.0.5`](https://codeberg.org/forgejo/forgejo/releases/tag/v11.0.5)

[Compare Source](https://codeberg.org/forgejo/forgejo/compare/v11.0.4...v11.0.5)

See <https://codeberg.org/forgejo/forgejo/src/branch/forgejo/release-notes-published/11.0.5.md>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/945): <!--number 945 --><!--line 0 --><!--description VXBkYXRlIGNvZGUuZm9yZ2Vqby5vcmcvZm9yZ2Vqby9mb3JnZWpvIERvY2tlciB0YWcgdG8gdjExLjAuNQ==-->Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.5<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/945
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-07 07:48:49 +00:00
Mathieu Fenniak
b2865e5a2d fix: graceful shutdown of tasks being interrupted by signal 2025-09-06 19:09:25 -06:00
Earl Warren
e6a61d940d
fix: lxc-systemd example: export INPUTS_SERIAL (#943)
otherwise it will not be set when copy/pasting the following commands

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/943): <!--number 943 --><!--line 0 --><!--description Zml4OiBseGMtc3lzdGVtZCBleGFtcGxlOiBleHBvcnQgSU5QVVRTX1NFUklBTA==-->fix: lxc-systemd example: export INPUTS_SERIAL<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/943
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-06 17:19:13 +00:00
Renovate Bot
26fda6e084
Update module github.com/docker/docker to v28.4.0+incompatible (#942)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/docker/docker](https://github.com/docker/docker) | `v28.3.3+incompatible` -> `v28.4.0+incompatible` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdocker%2fdocker/v28.4.0+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdocker%2fdocker/v28.3.3+incompatible/v28.4.0+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>docker/docker (github.com/docker/docker)</summary>

### [`v28.4.0+incompatible`](https://github.com/docker/docker/compare/v28.3.3...v28.4.0)

[Compare Source](https://github.com/docker/docker/compare/v28.3.3...v28.4.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/942): <!--number 942 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL2RvY2tlci9kb2NrZXIgdG8gdjI4LjQuMCtpbmNvbXBhdGlibGU=-->Update module github.com/docker/docker to v28.4.0+incompatible<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/942
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-06 05:52:41 +00:00
Earl Warren
4beb514232
fix: allow inputs context in action defaults (#941)
Resolves forgejo/runner#939

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/941): <!--number 941 --><!--line 0 --><!--description Zml4OiBhbGxvdyBpbnB1dHMgY29udGV4dCBpbiBhY3Rpb24gZGVmYXVsdHM=-->fix: allow inputs context in action defaults<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/941
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-05 22:14:52 +00:00
Earl Warren
c7e2db2559
chore: cache: handler: test coverage for fatal errors 2025-09-05 17:30:08 +02:00
Earl Warren
5f0b036e34
chore: cache: move findCacheWithIsolationKeyFallback out of handler.find 2025-09-05 17:30:08 +02:00
Earl Warren
c48accfb51
chore: cache: generate mocks for act/artifactcache/caches.go 2025-09-05 17:30:08 +02:00
Earl Warren
c28a98082b
chore: cache: move repo != cache.Repo in readCache
- it only is used after calling readCache
- add unit test

it reduces the number of testcase to be considered in handler
2025-09-05 17:30:08 +02:00
Earl Warren
6c4e705f97
chore: cache: split caches implementation out of handler
- create the caches interface and matching cachesImpl
- move the cache logic out of handler
  - openDB
  - readCache
  - useCache
  - gcCache
  - access to the storage struct
    - serve
    - commit
    - exist
    - write
- add getCaches / setCaches to the handler interface so it can be
  used by tests. The caches test should be implemented independently
  in the future but this is a different kind of cleanup.
- no functional change, minimal refactor
2025-09-05 17:30:08 +02:00
Earl Warren
37f634fd31
fix: cache: call fatal() on errors that are not recoverable
- responseFatalJSON(w, r, err) replaces responseJSON(w, r, 500, err)
  and calls fatal() when the following fail because they are
  not recoverable. There may be other non-recoverable errors but
  it is difficult to be 100% sure they cannot be engineered by the
  caller of the API for DoS purposes.
  - openDB
  - findCache
  - cache.Repo != repo
- wrap errors in
  - openDB() - it was missing
  - readCache() - it was missing
  - useCache() - it was missing
  - findCache() - some had identical messages
- in gc
  - replace logger.Warnf with h.fatal
  - differentiate errors that have identical messages
  - call fatal if openDB fails instead of returning
2025-09-05 17:29:04 +02:00
Earl Warren
36ca627f2e
feat: cache: fatal() helper to gracefully terminate the runner
in case of an error that is not recoverable (e.g. failing to open the
bolthold database), the cache can call fatal() to log the error and
send a TERM signal that will gracefully shutdown the daemon.
2025-09-05 17:26:12 +02:00
Earl Warren
98552f9b99
feat: cache-server: shutdown on TERM
in the same way the daemon can be shutdown by either INT or TERM
the cache server could only be shutdown with INT
2025-09-05 17:25:51 +02:00
Earl Warren
39dd708768
chore: cosmetic fixes 2025-09-05 13:22:59 +02:00
Earl Warren
8a7f760d3c
chore: bump version to v11 (#940)
the license change from MIT to GPLv3+ is a breaking change

Refs forgejo/runner#773

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/940): <!--number 940 --><!--line 0 --><!--description Y2hvcmU6IGJ1bXAgdmVyc2lvbiB0byB2MTE=-->chore: bump version to v11<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/940
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-05 07:29:38 +00:00
Mathieu Fenniak
a3aedba3f1
refactor: remove duplicate computeMac function (#936)
It was raised during embargo review of #925 that there are two implementations of `computeMac`; this PR fixes that.

As all the tests for `computeMac` were in the `artifactcache` package, it made more sense to keep the method there.  That required reversing the dependency `artifactcache->cacheproxy` package dependency -- it makes more sense to me for the proxy to depend on the cache, rather than vice-versa.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/936): <!--number 936 --><!--line 0 --><!--description cmVmYWN0b3I6IHJlbW92ZSBkdXBsaWNhdGUgY29tcHV0ZU1hYyBmdW5jdGlvbg==-->refactor: remove duplicate computeMac function<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/936
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-09-05 06:01:49 +00:00
Renovate Bot
35f93b6b11
Update module github.com/docker/cli to v28.4.0+incompatible (#938)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/docker/cli](https://github.com/docker/cli) | `v28.3.3+incompatible` -> `v28.4.0+incompatible` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fdocker%2fcli/v28.4.0+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fdocker%2fcli/v28.3.3+incompatible/v28.4.0+incompatible?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>docker/cli (github.com/docker/cli)</summary>

### [`v28.4.0+incompatible`](https://github.com/docker/cli/compare/v28.3.3...v28.4.0)

[Compare Source](https://github.com/docker/cli/compare/v28.3.3...v28.4.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/938): <!--number 938 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL2RvY2tlci9jbGkgdG8gdjI4LjQuMCtpbmNvbXBhdGlibGU=-->Update module github.com/docker/cli to v28.4.0+incompatible<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/938
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-05 05:09:07 +00:00
Earl Warren
69c6c70845
chore: refactor act/artifactcache Handler to an interface (#934)
- the Handler struct becomes handler (lowercase)
- the Handler interface is defined to be the existing methods
- isClosed() is added and used only in tests
- setgcAt() is added and used only in tests

---

This is to allow mocking the Handler interface for testing.

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/934): <!--number 934 --><!--line 0 --><!--description Y2hvcmU6IHJlZmFjdG9yIGFjdC9hcnRpZmFjdGNhY2hlIEhhbmRsZXIgdG8gYW4gaW50ZXJmYWNl-->chore: refactor act/artifactcache Handler to an interface<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/934
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-04 14:38:50 +00:00
Earl Warren
bfc5516467
chore: change the license to GPLv3-or-later (#773)
The Forgejo runner is part of the Forgejo project. The licensing
agreement in the governance repository reads like this:

> Forgejo accepts contributions compatible with the GPLv3-or-later license.
> The license under which Forgejo is distributed will be changed upon the acceptance of such contributions.

The first step is to update the LICENSE file to reflect that
decision. The individual copyright notice of each source file will be
updated when and if relevant. If a change is made that is eligible for
copyright, the author may decide change the copyright notice from MIT
or Apache 2 to GPLv3-or-later.

Refs licensing agreement 6eb522282f/AGREEMENTS.md (licensing)
Refs blog post about the licensing agreement https://forgejo.org/2024-08-gpl/

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/773): <!--number 773 --><!--line 0 --><!--description Y2hvcmU6IGNoYW5nZSB0aGUgbGljZW5zZSB0byBHUEx2My1vci1sYXRlcg==-->chore: change the license to GPLv3-or-later<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/773
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Gusted <gusted@noreply.code.forgejo.org>
Reviewed-by: Beowulf <beowulf@noreply.code.forgejo.org>
Reviewed-by: pat-s <pat-s@noreply.code.forgejo.org>
Reviewed-by: fnetX <fnetx@noreply.code.forgejo.org>
Reviewed-by: 0ko <0ko@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-04 09:26:12 +00:00
Renovate Bot
54591f946a
Update dependency go to v1.24.7 (#933)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [go](https://go.dev/) ([source](https://github.com/golang/go)) | toolchain | patch | `1.24.6` -> `1.24.7` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/933): <!--number 933 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZ28gdG8gdjEuMjQuNw==-->Update dependency go to v1.24.7<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/933
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-04 06:16:31 +00:00
Renovate Bot
d09e688738
Update module github.com/spf13/pflag to v1.0.10 (#932)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/spf13/pflag](https://github.com/spf13/pflag) | `v1.0.9` -> `v1.0.10` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fspf13%2fpflag/v1.0.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fspf13%2fpflag/v1.0.9/v1.0.10?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>spf13/pflag (github.com/spf13/pflag)</summary>

### [`v1.0.10`](https://github.com/spf13/pflag/releases/tag/v1.0.10)

[Compare Source](https://github.com/spf13/pflag/compare/v1.0.9...v1.0.10)

#### What's Changed

- fix deprecation comment for (FlagSet.)ParseErrorsWhitelist by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;447](https://github.com/spf13/pflag/pull/447)
- remove uses of errors.Is, which requires go1.13, move go1.16/go1.21 tests to separate file by [@&#8203;thaJeztah](https://github.com/thaJeztah) in [#&#8203;448](https://github.com/spf13/pflag/pull/448)

#### New Contributors

- [@&#8203;thaJeztah](https://github.com/thaJeztah) made their first contribution in [#&#8203;447](https://github.com/spf13/pflag/pull/447)

**Full Changelog**: <https://github.com/spf13/pflag/compare/v1.0.9...v1.0.10>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/932): <!--number 932 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3NwZjEzL3BmbGFnIHRvIHYxLjAuMTA=-->Update module github.com/spf13/pflag to v1.0.10<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/932
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-03 05:52:27 +00:00
Earl Warren
aa428e375c
fix: an expression in with: for a reusable workflow call can use env (#931)
Resolves forgejo/runner#929

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/931): <!--number 931 --><!--line 0 --><!--description Zml4OiBhbiBleHByZXNzaW9uIGluIHdpdGg6IGZvciBhIHJldXNhYmxlIHdvcmtmbG93IGNhbGwgY2FuIHVzZSBlbnY=-->fix: an expression in with: for a reusable workflow call can use env<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/931
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-09-01 22:09:43 +00:00
Renovate Bot
323554256c
Update module github.com/spf13/cobra to v1.10.1 (#930)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/spf13/cobra](https://github.com/spf13/cobra) | `v1.9.1` -> `v1.10.1` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fspf13%2fcobra/v1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fspf13%2fcobra/v1.9.1/v1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>spf13/cobra (github.com/spf13/cobra)</summary>

### [`v1.10.1`](https://github.com/spf13/cobra/releases/tag/v1.10.1)

[Compare Source](https://github.com/spf13/cobra/compare/v1.10.0...v1.10.1)

##### 🐛 Fix

- chore: upgrade pflags v1.0.9 by [@&#8203;jpmcb](https://github.com/jpmcb) in [#&#8203;2305](https://github.com/spf13/cobra/pull/2305)

v1.0.9 of pflags brought back `ParseErrorsWhitelist` and marked it as deprecated

**Full Changelog**: <https://github.com/spf13/cobra/compare/v1.10.0...v1.10.1>

### [`v1.10.0`](https://github.com/spf13/cobra/releases/tag/v1.10.0)

[Compare Source](https://github.com/spf13/cobra/compare/v1.9.1...v1.10.0)

#### What's Changed

##### 🚨 Attention!

- Bump pflag to 1.0.8 by [@&#8203;tomasaschan](https://github.com/tomasaschan) in [#&#8203;2303](https://github.com/spf13/cobra/pull/2303)

This version of `pflag` carried a breaking change: it renamed `ParseErrorsWhitelist` to `ParseErrorsAllowlist` which can break builds if both `pflag` and `cobra` are dependencies in your project.

- If you use both `pflag and `cobra`, upgrade `pflag`to 1.0.8 and`cobra`to`1.10.0\`
- ***or*** use the newer, fixed version of `pflag` v1.0.9 which keeps the deprecated `ParseErrorsWhitelist`

More details can be found here: [#&#8203;2303 (comment)](https://github.com/spf13/cobra/pull/2303#issuecomment-3242333515)

#####  Features

- Flow context to command in SetHelpFunc by [@&#8203;Frassle](https://github.com/Frassle) in [#&#8203;2241](https://github.com/spf13/cobra/pull/2241)
- The default ShellCompDirective can be customized for a command and its subcommands by [@&#8203;albers](https://github.com/albers) in [#&#8203;2238](https://github.com/spf13/cobra/pull/2238)

##### 🐛 Fix

- Upgrade golangci-lint to v2, address findings by [@&#8203;scop](https://github.com/scop) in [#&#8203;2279](https://github.com/spf13/cobra/pull/2279)

##### 🪠 Testing

- Test with Go 1.24 by [@&#8203;harryzcy](https://github.com/harryzcy) in [#&#8203;2236](https://github.com/spf13/cobra/pull/2236)
- chore: Rm GitHub Action PR size labeler by [@&#8203;jpmcb](https://github.com/jpmcb) in [#&#8203;2256](https://github.com/spf13/cobra/pull/2256)

##### 📝 Docs

- Remove traling curlybrace by [@&#8203;yedayak](https://github.com/yedayak) in [#&#8203;2237](https://github.com/spf13/cobra/pull/2237)
- Update command.go by [@&#8203;styee](https://github.com/styee) in [#&#8203;2248](https://github.com/spf13/cobra/pull/2248)
- feat: Add security policy by [@&#8203;jpmcb](https://github.com/jpmcb) in [#&#8203;2253](https://github.com/spf13/cobra/pull/2253)
- Update Readme (Warp) by [@&#8203;ericdachen](https://github.com/ericdachen) in [#&#8203;2267](https://github.com/spf13/cobra/pull/2267)
- Add Periscope to the list of projects using Cobra by [@&#8203;anishathalye](https://github.com/anishathalye) in [#&#8203;2299](https://github.com/spf13/cobra/pull/2299)

#### New Contributors

- [@&#8203;harryzcy](https://github.com/harryzcy) made their first contribution in [#&#8203;2236](https://github.com/spf13/cobra/pull/2236)
- [@&#8203;yedayak](https://github.com/yedayak) made their first contribution in [#&#8203;2237](https://github.com/spf13/cobra/pull/2237)
- [@&#8203;Frassle](https://github.com/Frassle) made their first contribution in [#&#8203;2241](https://github.com/spf13/cobra/pull/2241)
- [@&#8203;styee](https://github.com/styee) made their first contribution in [#&#8203;2248](https://github.com/spf13/cobra/pull/2248)
- [@&#8203;ericdachen](https://github.com/ericdachen) made their first contribution in [#&#8203;2267](https://github.com/spf13/cobra/pull/2267)
- [@&#8203;albers](https://github.com/albers) made their first contribution in [#&#8203;2238](https://github.com/spf13/cobra/pull/2238)
- [@&#8203;anishathalye](https://github.com/anishathalye) made their first contribution in [#&#8203;2299](https://github.com/spf13/cobra/pull/2299)
- [@&#8203;tomasaschan](https://github.com/tomasaschan) made their first contribution in [#&#8203;2303](https://github.com/spf13/cobra/pull/2303)

**Full Changelog**: <https://github.com/spf13/cobra/compare/v1.9.1...v1.9.2>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/930): <!--number 930 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3NwZjEzL2NvYnJhIHRvIHYxLjEwLjE=-->Update module github.com/spf13/cobra to v1.10.1<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/930
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-01 19:42:17 +00:00
Renovate Bot
877749a730
Update dependency forgejo/runner to v10 (#928)
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [forgejo/runner](https://code.forgejo.org/forgejo/runner) | major | `9.1.1` -> `10.0.1` |

---

### Release Notes

<details>
<summary>forgejo/runner (forgejo/runner)</summary>

### [`v10.0.1`](https://code.forgejo.org/forgejo/runner/releases/tag/v10.0.1)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v10.0.0...v10.0.1)

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

***

### [`v10.0.0`](https://code.forgejo.org/forgejo/runner/releases/tag/v10.0.0)

[Compare Source](https://code.forgejo.org/forgejo/runner/compare/v9.1.1...v10.0.0)

> **Warning** Upgrade to v10.0.1 instead. A regression was found on `pull_request_target` events and is fixed in the [v10.0.1 release](https://code.forgejo.org/forgejo/runner/releases/tag/v10.0.1).

- [User guide](https://forgejo.org/docs/next/user/actions/overview/)
- [Administrator guide](https://forgejo.org/docs/next/admin/actions/)
- [Container images](https://code.forgejo.org/forgejo/-/packages/container/runner/versions)

Release Notes

- [PR](https://code.forgejo.org/forgejo/runner/pulls/925): <!--number 925 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogcHJldmVudCBvbjogcHVsbF9yZXF1ZXN0IGFjdGlvbnMgZnJvbSBtdXRhdGluZyBjYWNoZXMgb2Ygb3RoZXIgd29ya2Zsb3cgZXZlbnRz-->fix(security): prevent on: pull\_request actions from mutating caches of other workflow events<!--description-->
  forgej-runner currently creates a safer execution environment for workflows triggered by pull requests by denying those workflows access to the repository's secrets, preventing pull requests from compromising the confidentiality of the secrets.

  Workflows do have access to write to the action cache, which is shared with future workflow executions, including executions that may have access to repository secrets.  This was assumed safe as the cache is a "write-once" operation based upon the cache key; if an execution writes to that cache, it will be read by other workflows only if a matching key parameter is provided, and it can not be modified again.  These assumptions were identified as weak security practices with known workarounds.

  It is possible for a malicious pull request to mutate the shared cache and embed untrusted artifacts, which may later be executed in workflow executions with access to secrets, risking the confidentiality of those secrets.

  In order to eliminate this risk, workflows executing with the `pull_request` and `pull_request_target` events have their write operations to the cache isolated to future workflow executions from the same pull request.  They can continue to read from the shared cache if applicable.

  If using an external cache server configuration, both the cache server and other instances of the runner must be running the same software version.  The recommended upgrade procedure in this configuration is to bring all runners offline, upgrade the cache server to the latest release and bring it online, and then bring all other runners online.
- [PR](https://code.forgejo.org/forgejo/runner/pulls/924): <!--number 924 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogZW5zdXJlIHVuaXF1ZSBuYW1lcyBmb3IgY29udGFpbmVyIGltYWdlcyBjcmVhdGVkIGJ5IGFjdGlvbnM=-->fix(security): ensure unique names for container images created by actions<!--description-->
  Without this fix, when a workflow ran a local [docker action](https://forgejo.org/docs/next/user/actions/actions/#docker-actions) (e.g. the [example in the end-to-end tests](8f920b4b7a/actions/example-force-rebuild/.forgejo/workflows/test.yml)), it used an image tag that could collide with other workflows that happen to use the same name. The workaround for older runner versions is to set [`[container].force_rebuild: true`](https://forgejo.org/docs/next/admin/actions/runner-installation/#configuration) in the runner configuration file.

***

<!--URL:https://code.forgejo.org/forgejo/runner-->

- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/925): <!--number 925 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogcHJldmVudCBvbjogcHVsbF9yZXF1ZXN0IGFjdGlvbnMgZnJvbSBtdXRhdGluZyBjYWNoZXMgb2Ygb3RoZXIgd29ya2Zsb3cgZXZlbnRz-->fix(security): prevent on: pull\_request actions from mutating caches of other workflow events<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/924): <!--number 924 --><!--line 0 --><!--description Zml4KHNlY3VyaXR5KTogZW5zdXJlIHVuaXF1ZSBuYW1lcyBmb3IgY29udGFpbmVyIGltYWdlcyBjcmVhdGVkIGJ5IGFjdGlvbnM=-->fix(security): ensure unique names for container images created by actions<!--description-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/921): <!--number 921 --><!--line 0 --><!--description VXBkYXRlIGNvZGUuZm9yZ2Vqby5vcmcvZm9yZ2Vqby9mb3JnZWpvIERvY2tlciB0YWcgdG8gdjExLjAuNA==-->Update code.forgejo.org/forgejo/forgejo Docker tag to v11.0.4<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/922): <!--number 922 --><!--line 0 --><!--description Y2hvcmU6IGV4cGxhaW4gdGhlIGRpZmZlcmVuY2UgYmV0d2VlbiBgam9iX2xldmVsYCBhbmQgYGxldmVsYA==-->chore: explain the difference between `job_level` and `level`<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/917): <!--number 917 --><!--line 0 --><!--description Y2hvcmU6IGFkZCByZW1pbmRlciBvZiBob3cgdG8gcnVuIGEgbG9jYWwgdGVzdA==-->chore: add reminder of how to run a local test<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/919): <!--number 919 --><!--line 0 --><!--description Y2hvcmU6IHVuaWZ5IGNhc2NhZGUtc2V0dXAtZm9yZ2VqbyB3aXRoIGNhc2NhZGUtZm9yZ2Vqbw==-->chore: unify cascade-setup-forgejo with cascade-forgejo<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/873): <!--number 873 --><!--line 0 --><!--description Y2hvcmU6IHJlbW92ZSBgZ2l0aHViLmNvbS9wa2cvZXJyb3JzYA==-->chore: remove `github.com/pkg/errors`<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/915): <!--number 915 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3N0cmV0Y2hyL3Rlc3RpZnkgdG8gdjEuMTEuMQ==-->Update module github.com/stretchr/testify to v1.11.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/914): <!--number 914 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1ZiB0byB2MS4zNi44-->Update module google.golang.org/protobuf to v1.36.8<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/907): <!--number 907 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnby5ldGNkLmlvL2Jib2x0IHRvIHYxLjQuMw==-->Update module go.etcd.io/bbolt to v1.4.3<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/906): <!--number 906 --><!--line 0 --><!--description dGVzdDogcmVtb3ZlIGludGVybmFsIHRpbWVvdXQgaW4gVGVzdFJ1bm5lckNhY2hlQ29uZmlndXJhdGlvbg==-->test: remove internal timeout in TestRunnerCacheConfiguration<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/902): <!--number 902 --><!--line 0 --><!--description Y2hvcmU6IHNraXAgdGVzdHMgdGhhdCByZXF1aXJlIEZvcmdlam8gaWYgaXQgaXMgbm90IGF2YWlsYWJsZQ==-->chore: skip tests that require Forgejo if it is not available<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/903): <!--number 903 --><!--line 0 --><!--description Y2hvcmU6IHJld29yayB0aGUgUkVBRE1F-->chore: rework the README<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/904): <!--number 904 --><!--line 0 --><!--description VXBkYXRlIGdpdGh1Yi5jb20vZ28tdmlwZXIvbWFwc3RydWN0dXJlL3YyIChpbmRpcmVjdCkgdG8gdjIuNC4wIFtTRUNVUklUWV0=-->Update github.com/go-viper/mapstructure/v2 (indirect) to v2.4.0 \[SECURITY]<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/900): <!--number 900 --><!--line 0 --><!--description Y2hvcmU6IHJlbW92ZSBUZXN0UnVuQ29udGV4dF9HZXRHaXRIdWJDb250ZXh0-->chore: remove TestRunContext\_GetGitHubContext<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/899): <!--number 899 --><!--line 0 --><!--description Y2hvcmU6IGRvIG5vdCBmb3JjZSBHT1BST1hZ-->chore: do not force GOPROXY<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/890): <!--number 890 --><!--line 0 --><!--description VXBkYXRlIG1vZHVsZSBnaXRodWIuY29tL3Zla3RyYS9tb2NrZXJ5L3YyIHRvIHYyLjUzLjU=-->Update module github.com/vektra/mockery/v2 to v2.53.5<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/893): <!--number 893 --><!--line 0 --><!--description Y2hvcmU6IGZpeCAuUEhPTlkgbGludCB0YXJnZXRz-->chore: fix .PHONY lint targets<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/898): <!--number 898 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9ydW5uZXIgdG8gdjkuMS4x-->Update dependency forgejo/runner to v9.1.1<!--description-->
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/897): <!--number 897 --><!--line 0 --><!--description VXBkYXRlIGNvZGUuZm9yZ2Vqby5vcmcvZm9yZ2Vqby9ydW5uZXIgRG9ja2VyIHRhZyB0byB2OS4xLjE=-->Update code.forgejo.org/forgejo/runner Docker tag to v9.1.1<!--description-->

<!--end release-notes-assistant-->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9DaG9yZSIsInJ1bi1lbmQtdG8tZW5kLXRlc3RzIl19-->

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- other
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/928): <!--number 928 --><!--line 0 --><!--description VXBkYXRlIGRlcGVuZGVuY3kgZm9yZ2Vqby9ydW5uZXIgdG8gdjEw-->Update dependency forgejo/runner to v10<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/928
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-09-01 14:24:38 +00:00
148 changed files with 4991 additions and 1325 deletions

View file

@ -8,7 +8,7 @@ expectedLabels = {
"org.opencontainers.image.source": "https://code.forgejo.org/forgejo/runner",
"org.opencontainers.image.version": "1.2.3",
"org.opencontainers.image.vendor": "Forgejo",
"org.opencontainers.image.licenses": "MIT",
"org.opencontainers.image.licenses": "GPL-3.0-or-later",
"org.opencontainers.image.title": "Forgejo Runner",
"org.opencontainers.image.description": "A runner for Forgejo Actions.",
}

View file

@ -0,0 +1,27 @@
name: ci
on:
push:
tags:
- v*
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ">=1.25.1"
- name: Test code
run: make test
- name: Run GoReleaser
uses: https://github.com/goreleaser/goreleaser-action@v6
env:
GITEA_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
with:
args: release --clean

View file

@ -18,19 +18,22 @@ on:
enable-email-notifications: true
env:
FORGEJO_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
jobs:
release-simulation:
runs-on: lxc-bookworm
if: vars.ROLE == 'forgejo-coding'
steps:
- uses: actions/checkout@v4
- uses: https://data.forgejo.org/actions/checkout@v4
- id: forgejo
uses: https://data.forgejo.org/actions/setup-forgejo@v3.0.2
uses: https://data.forgejo.org/actions/setup-forgejo@v3.0.4
with:
user: root
password: admin1234
image-version: 1.20
image-version: ${{ env.FORGEJO_VERSION }}
lxc-ip-prefix: 10.0.9
- name: publish

View file

@ -23,7 +23,7 @@ jobs:
# root is used for testing, allow it
if: vars.ROLE == 'forgejo-integration' || forge.repository_owner == 'root'
steps:
- uses: actions/checkout@v4
- uses: https://data.forgejo.org/actions/checkout@v4
- name: Increase the verbosity when there are no secrets
id: verbose

View file

@ -87,10 +87,10 @@ jobs:
with:
fetch-depth: '0'
show-progress: 'false'
- uses: actions/setup-go@v5
- uses: https://data.forgejo.org/actions/setup-go@v5
with:
go-version-file: go.mod
- uses: https://data.forgejo.org/actions/cascading-pr@v2.2.1
- uses: https://data.forgejo.org/actions/cascading-pr@v2.3.0
with:
origin-url: ${{ forge.server_url }}
origin-repo: ${{ forge.repository }}
@ -106,4 +106,5 @@ jobs:
close: true
verbose: ${{ vars.VERBOSE == 'yes' }}
debug: ${{ vars.DEBUG == 'yes' }}
wait-iteration: 120
update: .forgejo/cascading-forgejo

View file

@ -81,7 +81,7 @@ jobs:
container:
image: 'code.forgejo.org/oci/node:22-bookworm'
steps:
- uses: https://code.forgejo.org/actions/cascading-pr@v2.2.1
- uses: https://data.forgejo.org/actions/cascading-pr@v2.3.0
with:
origin-url: ${{ forge.server_url }}
origin-repo: ${{ forge.repository }}

View file

@ -21,7 +21,7 @@ on:
enable-email-notifications: true
env:
FORGEJO_VERSION: 11.0.4 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
FORGEJO_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
FORGEJO_USER: root
FORGEJO_PASSWORD: admin1234
@ -34,7 +34,7 @@ jobs:
- name: install Forgejo so it can be used as a container registry
id: registry
uses: https://data.forgejo.org/actions/setup-forgejo@v3.0.2
uses: https://data.forgejo.org/actions/setup-forgejo@v3.0.4
with:
user: ${{ env.FORGEJO_USER }}
password: ${{ env.FORGEJO_PASSWORD }}

View file

@ -15,7 +15,7 @@ jobs:
if: vars.ROLE == 'forgejo-coding'
runs-on: lxc-bookworm
steps:
- uses: actions/checkout@v4
- uses: https://data.forgejo.org/actions/checkout@v4
- name: Install docker
run: |

View file

@ -14,11 +14,12 @@ env:
SERIAL: "30"
LIFETIME: "60"
SYSTEMD_OPTIONS: "--no-pager --full"
USE_VERSION: 11.0.7 # renovate: datasource=docker depName=code.forgejo.org/forgejo/forgejo
jobs:
example-lxc-systemd:
if: vars.ROLE == 'forgejo-coding'
runs-on: lxc-bookworm
runs-on: lxc-trixie
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
@ -53,11 +54,11 @@ jobs:
done
- id: forgejo
uses: https://data.forgejo.org/actions/setup-forgejo@v3.0.2
uses: https://data.forgejo.org/actions/setup-forgejo@v3.0.4
with:
user: root
password: admin1234
binary: https://code.forgejo.org/forgejo/forgejo/releases/download/v7.0.12/forgejo-7.0.12-linux-amd64
binary: https://code.forgejo.org/forgejo/forgejo/releases/download/v${{ env.USE_VERSION }}/forgejo-${{ env.USE_VERSION }}-linux-amd64
# must be the same as LXC_IPV4_PREFIX in examples/lxc-systemd/forgejo-runner-service.sh
lxc-ip-prefix: 10.105.7
@ -123,8 +124,8 @@ jobs:
started_running=/etc/forgejo-runner/$serial/started-running
killed_gracefully=/etc/forgejo-runner/$serial/killed-gracefully
stopped_gracefully=/etc/forgejo-runner/$serial/stopped-gracefully
retry --delay 5 --times 20 cp -a $started_running /tmp/first-run
retry --delay 1 --times 30 grep --quiet 'Starting runner daemon' /var/log/forgejo-runner/$serial.log
retry --delay 10 --times 20 cp -a $started_running /tmp/first-run
retry --delay 2 --times 30 grep --quiet 'Starting runner daemon' /var/log/forgejo-runner/$serial.log
systemctl stop forgejo-runner@$serial
! systemctl $all status forgejo-runner@$serial
ls -l /etc/forgejo-runner/$serial
@ -136,7 +137,7 @@ jobs:
! test -f $killed_gracefully
! test -f $stopped_gracefully
lifetime=${{ env.LIFETIME }}
# give it time to restart at least once
: give it time to restart at least once
ls -l /etc/forgejo-runner/$serial
sleep $lifetime ; sleep $lifetime
ls -l /etc/forgejo-runner/$serial

View file

@ -6,16 +6,17 @@ name: issue-labels
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- labeled
env:
RNA_VERSION: v1.4.0 # renovate: datasource=forgejo-releases depName=forgejo/release-notes-assistant registryUrl=https://code.forgejo.org
RNA_VERSION: v1.4.1 # renovate: datasource=forgejo-releases depName=forgejo/release-notes-assistant
jobs:
release-notes:
if: vars.ROLE == 'forgejo-coding'
if: vars.ROLE == 'forgejo-coding' && !contains(forge.event.pull_request.labels.*.name, 'Kind/DependencyUpdate')
runs-on: docker
container:
image: 'data.forgejo.org/oci/ci:1'

View file

@ -59,7 +59,7 @@ jobs:
- run: make build
- uses: https://code.forgejo.org/actions/upload-artifact@v3
- uses: https://data.forgejo.org/actions/upload-artifact@v3
with:
name: forgejo-runner
path: forgejo-runner
@ -79,9 +79,9 @@ jobs:
needs: [build-and-tests]
steps:
- uses: actions/checkout@v4
- uses: https://data.forgejo.org/actions/checkout@v4
- uses: https://code.forgejo.org/actions/download-artifact@v3
- uses: https://data.forgejo.org/actions/download-artifact@v3
with:
name: forgejo-runner
@ -156,9 +156,9 @@ jobs:
needs: [build-and-tests]
steps:
- uses: actions/checkout@v4
- uses: https://data.forgejo.org/actions/checkout@v4
- uses: actions/setup-go@v5
- uses: https://data.forgejo.org/actions/setup-go@v5
with:
go-version-file: go.mod
@ -185,6 +185,11 @@ jobs:
EOF
apt --quiet install --yes -qq docker.io make
- name: install LXC
run: |
act/runner/lxc-helpers.sh lxc_prepare_environment
act/runner/lxc-helpers.sh lxc_install_lxc_inside 10.39.28 fdb1
- run: apt-get -q install -qq -y gcc # required for `-race`
- run: make integration-test
@ -217,3 +222,53 @@ jobs:
git diff --color=always
exit 1
}
validate-pre-commit:
name: validate pre-commit-hooks file
if: vars.ROLE == 'forgejo-coding'
runs-on: docker
container:
image: 'code.forgejo.org/oci/ci:1'
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
- name: install pre-commit
env:
DEBIAN_FRONTEND: noninteractive
PIP_ROOT_USER_ACTION: ignore
PIP_BREAK_SYSTEM_PACKAGES: 1
PIP_PROGRESS_BAR: off
run: |
apt-get update -qq
apt-get -q install -qq -y python3-pip
python3 -m pip install 'pre-commit>=3.2.0'
- name: validate .pre-commit-hooks.yaml
run: pre-commit validate-manifest .pre-commit-hooks.yaml
# Will fail due to `act/runner/testdata/local-action-fails-schema-validation/action/action.yml`
- name: check pre-commit hook against local action files (should fail)
continue-on-error: true
run: |
pre-commit try-repo --all-files --verbose . forgejo-runner-validate
- name: check that a bad workflow file doesnt validate (should fail)
continue-on-error: true
run: |
mkdir -p test-repo
cd test-repo
git config set advice.defaultBranchName false
git init --quiet
mkdir -p .forgejo/workflows
cp ../act/runner/testdata/local-action-fails-schema-validation/action/action.yml ./
touch .forgejo/workflows/bad-workflow.yml
cat > .pre-commit-config.yaml <<EOF
repos:
- repo: ..
rev: ${{ forge.sha }}
hooks:
- id: forgejo-runner-validate
EOF
git add .
pre-commit run --all-files --verbose forgejo-runner-validate

View file

@ -1,151 +0,0 @@
# This workflow:
# - builds and uploads a binary artifact for each Windows architecture
# - tests the runner on Windows with a Forgejo server container running on Windows Subsystem for Linux (WSL)
# - releases the binary artifact (if triggered on a pushed tag)
#
# This build is currently supported on https://github.com/Crown0815/forgejo-runner-windows
name: Build Release
on:
push:
tags: ['v*']
branches: [ main ]
jobs:
build:
name: Build ${{matrix.architecture}}
runs-on: ubuntu-latest
strategy:
matrix:
architecture: ['386', amd64, arm, arm64]
steps:
- uses: actions/checkout@v4
- name: Build for ${{matrix.architecture}}
run: |
env GOOS=windows GOARCH=${{matrix.architecture}} \
go build \
-ldflags "-s -w -X code.forgejo.org/forgejo/runner/internal/pkg/ver.version=${{ github.ref_name }}" \
-o forgejo-runner-windows-${{matrix.architecture}}.exe
- uses: actions/upload-artifact@v4
with:
name: forgejo-runner-windows-${{matrix.architecture}}
path: forgejo-runner-windows-${{matrix.architecture}}.exe
test:
name: Run Tests on Windows with Linux Forgejo Server
runs-on: windows-latest
env:
FORGEJO_ROOT_URL: 'http://localhost:3000/'
FORGEJO_ADMIN_USER: 'admin_user'
FORGEJO_ADMIN_PASSWORD: 'admin_password'
FORGEJO_RUNNER_SECRET: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
MAX_WAIT_ITERATIONS: 30
steps:
- name: Windows - Checkout code
uses: actions/checkout@v4
- name: Windows - Setup Windows Subsystem for Linux (WSL)
uses: Vampire/setup-wsl@v5
with:
distribution: Alpine
wsl-shell-user: root
additional-packages: bash
- name: WSL - Install Docker
shell: wsl-bash {0}
run: |
apk --update add --no-cache docker curl
rc-update add docker default
openrc default
# Wait for Docker to be ready
i=0
until docker info > /dev/null 2>&1 || (( i == ${{ env.MAX_WAIT_ITERATIONS }} )); do
echo "Waiting for Docker to be ready... ($(( ++i ))/${{ env.MAX_WAIT_ITERATIONS }})"
sleep 1
done
[ $i -lt ${{ env.MAX_WAIT_ITERATIONS }} ] && echo "Docker is ready!" || { echo "Timed out waiting for Docker" ; exit 1; }
- name: WSL - Start Forgejo Server
shell: wsl-bash {0}
run: |
docker run -d --name forgejo \
-p 3000:3000 \
-e USER_UID=1000 \
-e USER_GID=1000 \
-e FORGEJO__security__INSTALL_LOCK=true \
-e FORGEJO__server__DOMAIN=localhost \
-e FORGEJO__server__ROOT_URL=${{ env.FORGEJO_ROOT_URL }} \
codeberg.org/forgejo/forgejo:11.0-rootless
- name: Windows - Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Windows - Install dependencies
run: go mod download
- name: WSL - Register Runner on Forgejo Server
# Starting the Forgejo server takes some time.
# That time used to install go.
shell: wsl-bash {0}
run: |
i=0
until curl -s ${{ env.FORGEJO_ROOT_URL }}/api/v1/version > /dev/null || (( i == ${{ env.MAX_WAIT_ITERATIONS }} )); do
echo "Waiting for Forgejo to be ready... ($(( ++i ))/${{ env.MAX_WAIT_ITERATIONS }})"
sleep 1
done
[ $i -lt ${{ env.MAX_WAIT_ITERATIONS }} ] && echo "Forgejo is ready!" || { echo "Timed out waiting for Forgejo" ; exit 1; }
# Create admin user and generate runner token
docker exec forgejo forgejo admin user create --admin --username ${{ env.FORGEJO_ADMIN_USER }} --password ${{ env.FORGEJO_ADMIN_PASSWORD }} --email root@example.com
docker exec forgejo forgejo forgejo-cli actions register --labels docker --name therunner --secret ${{ env.FORGEJO_RUNNER_SECRET }}
- name: Windows - Connect to Forgejo server
run: |
$configFileContent = @"
log:
level: debug
runner:
labels:
- windows:host
- docker:docker://node:20
"@
Set-Content -Path temporaryConfig.yml -Value $configFileContent
# Register the runner
go run main.go create-runner-file --config temporaryConfig.yml --instance ${{ env.FORGEJO_ROOT_URL }} --secret ${{ env.FORGEJO_RUNNER_SECRET }} --name "windows-test-runner"
- name: Windows - Run tests
run: go test -v ./...
env:
FORGEJO_URL: ${{ env.FORGEJO_ROOT_URL }}
FORGEJO_RUNNER_SECRET: ${{ env.FORGEJO_RUNNER_SECRET }}
FORGEJO_RUNNER_HEX_SECRET: ${{ env.FORGEJO_RUNNER_SECRET }}
release:
runs-on: ubuntu-latest
needs: [build, test]
if: github.event_name == 'push' && github.ref_type == 'tag'
steps:
- uses: actions/download-artifact@v4
with:
path: .
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: forgejo-runner-windows-*/forgejo-runner-windows-*.exe
draft: false
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
token: ${{ secrets.RELEASE_TOKEN }}
fail_on_unmatched_files: true
body: See [original release notes](https://code.forgejo.org/forgejo/runner/releases/tag/${{ github.ref_name }}).

60
.goreleaser.yaml Normal file
View file

@ -0,0 +1,60 @@
version: 2
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
archives:
- formats: [binary]
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
changelog:
abbrev: 10
filters:
exclude:
- "^docs:"
- "^test:"
format: "{{.SHA}}: {{.Message}}"
groups:
- title: Features
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 0
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 1
- title: "Chores"
regexp: '^.*?chore(\([[:word:]]+\))??!?:.+$'
order: 2
- title: Others
order: 999
sort: asc
release:
gitea:
owner: DevFW-CICD
name: runner
force_token: gitea
gitea_urls:
api: https://edp.buildth.ing/api/v1
download: https://edp.buildth.ing
# set to true if you use a self-signed certificate
skip_tls_verify: false

13
.pre-commit-hooks.yaml Normal file
View file

@ -0,0 +1,13 @@
- id: forgejo-runner-validate
name: Validate Forgejo Actions files
description: This hook validates Forgejo Actions action and workflow files.
language: golang
entry: runner validate
args: ['--directory', '.']
pass_filenames: false
files: (?:(?:^|/)action|^\.(?:forgejo|github|gitea)/workflows/[^/\n]+)\.ya?ml$
types: [yaml]
# 3.2.0 is when the pre-* `stages` used here were added.
# Old names (without the pre- prefix) are deprecated since 4.0.0.
minimum_pre_commit_version: '3.2.0'
stages: [pre-commit, pre-merge-commit, pre-push, manual]

View file

@ -1,6 +1,6 @@
FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/xx AS xx
FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/golang:1.24-alpine3.22 AS build-env
FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/golang:1.25-alpine3.22 AS build-env
#
# Transparently cross compile for the target platform
@ -32,7 +32,7 @@ LABEL maintainer="contact@forgejo.org" \
org.opencontainers.image.source="https://code.forgejo.org/forgejo/runner" \
org.opencontainers.image.version="${RELEASE_VERSION}" \
org.opencontainers.image.vendor="Forgejo" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.licenses="GPL-3.0-or-later" \
org.opencontainers.image.title="Forgejo Runner" \
org.opencontainers.image.description="A runner for Forgejo Actions."

688
LICENSE
View file

@ -1,20 +1,674 @@
Copyright (c) 2023-2025 The Forgejo Authors
Copyright (c) 2022 The Gitea Authors
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Preamble
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -14,7 +14,7 @@ GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*")
GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*")
MOCKERY_PACKAGE ?= github.com/vektra/mockery/v2@v2.53.5 # renovate: datasource=go
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0 # renovate: datasource=go
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0 # renovate: datasource=go
DOCKER_IMAGE ?= gitea/act_runner
DOCKER_TAG ?= nightly
@ -62,10 +62,10 @@ else
endif
endif
GO_PACKAGES_TO_VET ?= $(filter-out code.forgejo.org/forgejo/runner/v9/internal/pkg/client/mocks,$(shell $(GO) list ./...))
GO_PACKAGES_TO_VET ?= $(filter-out code.forgejo.org/forgejo/runner/v11/internal/pkg/client/mocks code.forgejo.org/forgejo/runner/v11/act/artifactcache/mock_caches.go,$(shell $(GO) list ./...))
TAGS ?=
LDFLAGS ?= -X "code.forgejo.org/forgejo/runner/v9/internal/pkg/ver.version=v$(RELEASE_VERSION)"
LDFLAGS ?= -X "code.forgejo.org/forgejo/runner/v11/internal/pkg/ver.version=v$(RELEASE_VERSION)"
all: build
@ -120,7 +120,7 @@ vet:
.PHONY: generate
generate:
$(GO) generate ./internal/...
$(GO) generate ./...
install: $(GOFILES)
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'

View file

@ -8,10 +8,7 @@ Sensitive security-related issues should be reported to [security@forgejo.org](m
## License
The Forgejo runner source code is distributed under the terms of the following licenses:
- [MIT](LICENSE) for the most part.
- [Apache 2](act/container/DOCKER_LICENSE) for parts found in the [act/container](act/container) directory.
The Forgejo runner is distributed under the terms of the [GPL version 3.0](LICENSE) or any later version.
# Architectures & OS

324
act/artifactcache/caches.go Normal file
View file

@ -0,0 +1,324 @@
package artifactcache
import (
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"regexp"
"sync/atomic"
"time"
"github.com/sirupsen/logrus"
"github.com/timshannon/bolthold"
"go.etcd.io/bbolt"
)
//go:generate mockery --inpackage --name caches
type caches interface {
getDB() *bolthold.Store
validateMac(rundata RunData) (string, error)
readCache(id uint64, repo string) (*Cache, error)
useCache(id uint64) error
setgcAt(at time.Time)
gcCache()
close()
serve(w http.ResponseWriter, r *http.Request, id uint64)
commit(id uint64, size int64) (int64, error)
exist(id uint64) (bool, error)
write(id, offset uint64, reader io.Reader) error
}
type cachesImpl struct {
dir string
storage *Storage
logger logrus.FieldLogger
secret string
db *bolthold.Store
gcing atomic.Bool
gcAt time.Time
}
func newCaches(dir, secret string, logger logrus.FieldLogger) (caches, error) {
c := &cachesImpl{
secret: secret,
}
c.logger = logger
if dir == "" {
home, err := os.UserHomeDir()
if err != nil {
return nil, err
}
dir = filepath.Join(home, ".cache", "actcache")
}
if err := os.MkdirAll(dir, 0o755); err != nil {
return nil, err
}
c.dir = dir
storage, err := NewStorage(filepath.Join(dir, "cache"))
if err != nil {
return nil, err
}
c.storage = storage
file := filepath.Join(c.dir, "bolt.db")
db, err := bolthold.Open(file, 0o644, &bolthold.Options{
Encoder: json.Marshal,
Decoder: json.Unmarshal,
Options: &bbolt.Options{
Timeout: 5 * time.Second,
NoGrowSync: bbolt.DefaultOptions.NoGrowSync,
FreelistType: bbolt.DefaultOptions.FreelistType,
},
})
if err != nil {
return nil, fmt.Errorf("Open(%s): %w", file, err)
}
c.db = db
c.gcCache()
return c, nil
}
func (c *cachesImpl) close() {
if c.db != nil {
c.db.Close()
c.db = nil
}
}
func (c *cachesImpl) getDB() *bolthold.Store {
return c.db
}
var findCacheWithIsolationKeyFallback = func(db *bolthold.Store, repo string, keys []string, version, writeIsolationKey string) (*Cache, error) {
cache, err := findCache(db, repo, keys, version, writeIsolationKey)
if err != nil {
return nil, err
}
// If read was scoped to WriteIsolationKey and didn't find anything, we can fallback to the non-isolated cache read
if cache == nil && writeIsolationKey != "" {
cache, err = findCache(db, repo, keys, version, "")
if err != nil {
return nil, err
}
}
return cache, nil
}
// if not found, return (nil, nil) instead of an error.
func findCache(db *bolthold.Store, repo string, keys []string, version, writeIsolationKey string) (*Cache, error) {
cache := &Cache{}
for _, prefix := range keys {
// if a key in the list matches exactly, don't return partial matches
if err := db.FindOne(cache,
bolthold.Where("Repo").Eq(repo).Index("Repo").
And("Key").Eq(prefix).
And("Version").Eq(version).
And("WriteIsolationKey").Eq(writeIsolationKey).
And("Complete").Eq(true).
SortBy("CreatedAt").Reverse()); err == nil || !errors.Is(err, bolthold.ErrNotFound) {
if err != nil {
return nil, fmt.Errorf("find cache entry equal to %s: %w", prefix, err)
}
return cache, nil
}
prefixPattern := fmt.Sprintf("^%s", regexp.QuoteMeta(prefix))
re, err := regexp.Compile(prefixPattern)
if err != nil {
continue
}
if err := db.FindOne(cache,
bolthold.Where("Repo").Eq(repo).Index("Repo").
And("Key").RegExp(re).
And("Version").Eq(version).
And("WriteIsolationKey").Eq(writeIsolationKey).
And("Complete").Eq(true).
SortBy("CreatedAt").Reverse()); err != nil {
if errors.Is(err, bolthold.ErrNotFound) {
continue
}
return nil, fmt.Errorf("find cache entry starting with %s: %w", prefix, err)
}
return cache, nil
}
return nil, nil
}
func insertCache(db *bolthold.Store, cache *Cache) error {
if err := db.Insert(bolthold.NextSequence(), cache); err != nil {
return fmt.Errorf("insert cache: %w", err)
}
// write back id to db
if err := db.Update(cache.ID, cache); err != nil {
return fmt.Errorf("write back id to db: %w", err)
}
return nil
}
func (c *cachesImpl) readCache(id uint64, repo string) (*Cache, error) {
db := c.getDB()
cache := &Cache{}
if err := db.Get(id, cache); err != nil {
return nil, fmt.Errorf("readCache: Get(%v): %w", id, err)
}
if cache.Repo != repo {
return nil, fmt.Errorf("readCache: Get(%v): cache.Repo %s != repo %s", id, cache.Repo, repo)
}
return cache, nil
}
func (c *cachesImpl) useCache(id uint64) error {
db := c.getDB()
cache := &Cache{}
if err := db.Get(id, cache); err != nil {
return fmt.Errorf("useCache: Get(%v): %w", id, err)
}
cache.UsedAt = time.Now().Unix()
if err := db.Update(cache.ID, cache); err != nil {
return fmt.Errorf("useCache: Update(%v): %v", cache.ID, err)
}
return nil
}
func (c *cachesImpl) serve(w http.ResponseWriter, r *http.Request, id uint64) {
c.storage.Serve(w, r, id)
}
func (c *cachesImpl) commit(id uint64, size int64) (int64, error) {
return c.storage.Commit(id, size)
}
func (c *cachesImpl) exist(id uint64) (bool, error) {
return c.storage.Exist(id)
}
func (c *cachesImpl) write(id, offset uint64, reader io.Reader) error {
return c.storage.Write(id, offset, reader)
}
const (
keepUsed = 30 * 24 * time.Hour
keepUnused = 7 * 24 * time.Hour
keepTemp = 5 * time.Minute
keepOld = 5 * time.Minute
)
func (c *cachesImpl) setgcAt(at time.Time) {
c.gcAt = at
}
func (c *cachesImpl) gcCache() {
if c.gcing.Load() {
return
}
if !c.gcing.CompareAndSwap(false, true) {
return
}
defer c.gcing.Store(false)
if time.Since(c.gcAt) < time.Hour {
c.logger.Debugf("skip gc: %v", c.gcAt.String())
return
}
c.gcAt = time.Now()
c.logger.Debugf("gc: %v", c.gcAt.String())
db := c.getDB()
// Remove the caches which are not completed for a while, they are most likely to be broken.
var caches []*Cache
if err := db.Find(&caches, bolthold.
Where("UsedAt").Lt(time.Now().Add(-keepTemp).Unix()).
And("Complete").Eq(false),
); err != nil {
fatal(c.logger, fmt.Errorf("gc caches not completed: %v", err))
} else {
for _, cache := range caches {
c.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
c.logger.Errorf("delete cache: %v", err)
continue
}
c.logger.Infof("deleted cache: %+v", cache)
}
}
// Remove the old caches which have not been used recently.
caches = caches[:0]
if err := db.Find(&caches, bolthold.
Where("UsedAt").Lt(time.Now().Add(-keepUnused).Unix()),
); err != nil {
fatal(c.logger, fmt.Errorf("gc caches old not used: %v", err))
} else {
for _, cache := range caches {
c.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
c.logger.Warnf("delete cache: %v", err)
continue
}
c.logger.Infof("deleted cache: %+v", cache)
}
}
// Remove the old caches which are too old.
caches = caches[:0]
if err := db.Find(&caches, bolthold.
Where("CreatedAt").Lt(time.Now().Add(-keepUsed).Unix()),
); err != nil {
fatal(c.logger, fmt.Errorf("gc caches too old: %v", err))
} else {
for _, cache := range caches {
c.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
c.logger.Warnf("delete cache: %v", err)
continue
}
c.logger.Infof("deleted cache: %+v", cache)
}
}
// Remove the old caches with the same key and version, keep the latest one.
// Also keep the olds which have been used recently for a while in case of the cache is still in use.
if results, err := db.FindAggregate(
&Cache{},
bolthold.Where("Complete").Eq(true),
"Key", "Version",
); err != nil {
fatal(c.logger, fmt.Errorf("gc aggregate caches: %v", err))
} else {
for _, result := range results {
if result.Count() <= 1 {
continue
}
result.Sort("CreatedAt")
caches = caches[:0]
result.Reduction(&caches)
for _, cache := range caches[:len(caches)-1] {
if time.Since(time.Unix(cache.UsedAt, 0)) < keepOld {
// Keep it since it has been used recently, even if it's old.
// Or it could break downloading in process.
continue
}
c.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
c.logger.Warnf("delete cache: %v", err)
continue
}
c.logger.Infof("deleted cache: %+v", cache)
}
}
}
}

View file

@ -0,0 +1,53 @@
package artifactcache
import (
"testing"
"time"
"github.com/sirupsen/logrus"
"github.com/timshannon/bolthold"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCacheReadWrite(t *testing.T) {
caches, err := newCaches(t.TempDir(), "secret", logrus.New())
require.NoError(t, err)
defer caches.close()
t.Run("NotFound", func(t *testing.T) {
found, err := caches.readCache(456, "repo")
assert.Nil(t, found)
assert.ErrorIs(t, err, bolthold.ErrNotFound)
})
repo := "repository"
cache := &Cache{
Repo: repo,
Key: "key",
Version: "version",
Size: 444,
}
now := time.Now().Unix()
cache.CreatedAt = now
cache.UsedAt = now
cache.Repo = repo
t.Run("Insert", func(t *testing.T) {
db := caches.getDB()
assert.NoError(t, insertCache(db, cache))
})
t.Run("Found", func(t *testing.T) {
found, err := caches.readCache(cache.ID, cache.Repo)
require.NoError(t, err)
assert.Equal(t, cache.ID, found.ID)
})
t.Run("InvalidRepo", func(t *testing.T) {
invalidRepo := "INVALID REPO"
found, err := caches.readCache(cache.ID, invalidRepo)
assert.Nil(t, found)
assert.ErrorContains(t, err, invalidRepo)
})
}

View file

@ -7,46 +7,56 @@ import (
"io"
"net"
"net/http"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync/atomic"
"time"
"github.com/julienschmidt/httprouter"
"github.com/sirupsen/logrus"
"github.com/timshannon/bolthold"
"go.etcd.io/bbolt"
"code.forgejo.org/forgejo/runner/v9/act/cacheproxy"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
const (
urlBase = "/_apis/artifactcache"
)
type Handler struct {
dir string
storage *Storage
var fatal = func(logger logrus.FieldLogger, err error) {
logger.Errorf("unrecoverable error in the cache: %v", err)
if err := suicide(); err != nil {
logger.Errorf("unrecoverable error in the cache: failed to send the TERM signal to shutdown the daemon %v", err)
}
}
type Handler interface {
ExternalURL() string
Close() error
isClosed() bool
getCaches() caches
setCaches(caches caches)
find(w http.ResponseWriter, r *http.Request, params httprouter.Params)
reserve(w http.ResponseWriter, r *http.Request, params httprouter.Params)
upload(w http.ResponseWriter, r *http.Request, params httprouter.Params)
commit(w http.ResponseWriter, r *http.Request, params httprouter.Params)
get(w http.ResponseWriter, r *http.Request, params httprouter.Params)
clean(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
middleware(handler httprouter.Handle) httprouter.Handle
responseJSON(w http.ResponseWriter, r *http.Request, code int, v ...any)
}
type handler struct {
caches caches
router *httprouter.Router
listener net.Listener
server *http.Server
logger logrus.FieldLogger
secret string
gcing atomic.Bool
gcAt time.Time
outboundIP string
}
func StartHandler(dir, outboundIP string, port uint16, secret string, logger logrus.FieldLogger) (*Handler, error) {
h := &Handler{
secret: secret,
}
func StartHandler(dir, outboundIP string, port uint16, secret string, logger logrus.FieldLogger) (Handler, error) {
h := &handler{}
if logger == nil {
discard := logrus.New()
@ -56,24 +66,11 @@ func StartHandler(dir, outboundIP string, port uint16, secret string, logger log
logger = logger.WithField("module", "artifactcache")
h.logger = logger
if dir == "" {
home, err := os.UserHomeDir()
caches, err := newCaches(dir, secret, logger)
if err != nil {
return nil, err
}
dir = filepath.Join(home, ".cache", "actcache")
}
if err := os.MkdirAll(dir, 0o755); err != nil {
return nil, err
}
h.dir = dir
storage, err := NewStorage(filepath.Join(dir, "cache"))
if err != nil {
return nil, err
}
h.storage = storage
h.caches = caches
if outboundIP != "" {
h.outboundIP = outboundIP
@ -93,8 +90,6 @@ func StartHandler(dir, outboundIP string, port uint16, secret string, logger log
h.router = router
h.gcCache()
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port)) // listen on all interfaces
if err != nil {
return nil, err
@ -114,18 +109,22 @@ func StartHandler(dir, outboundIP string, port uint16, secret string, logger log
return h, nil
}
func (h *Handler) ExternalURL() string {
func (h *handler) ExternalURL() string {
port := strconv.Itoa(h.listener.Addr().(*net.TCPAddr).Port)
// TODO: make the external url configurable if necessary
return fmt.Sprintf("http://%s", net.JoinHostPort(h.outboundIP, port))
}
func (h *Handler) Close() error {
func (h *handler) Close() error {
if h == nil {
return nil
}
var retErr error
if h.caches != nil {
h.caches.close()
h.caches = nil
}
if h.server != nil {
err := h.server.Close()
if err != nil {
@ -146,22 +145,25 @@ func (h *Handler) Close() error {
return retErr
}
func (h *Handler) openDB() (*bolthold.Store, error) {
return bolthold.Open(filepath.Join(h.dir, "bolt.db"), 0o644, &bolthold.Options{
Encoder: json.Marshal,
Decoder: json.Unmarshal,
Options: &bbolt.Options{
Timeout: 5 * time.Second,
NoGrowSync: bbolt.DefaultOptions.NoGrowSync,
FreelistType: bbolt.DefaultOptions.FreelistType,
},
})
func (h *handler) isClosed() bool {
return h.listener == nil && h.server == nil
}
func (h *handler) getCaches() caches {
return h.caches
}
func (h *handler) setCaches(caches caches) {
if h.caches != nil {
h.caches.close()
}
h.caches = caches
}
// GET /_apis/artifactcache/cache
func (h *Handler) find(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
func (h *handler) find(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
rundata := runDataFromHeaders(r)
repo, err := h.validateMac(rundata)
repo, err := h.caches.validateMac(rundata)
if err != nil {
h.responseJSON(w, r, 403, err)
return
@ -174,32 +176,19 @@ func (h *Handler) find(w http.ResponseWriter, r *http.Request, params httprouter
}
version := r.URL.Query().Get("version")
db, err := h.openDB()
if err != nil {
h.responseJSON(w, r, 500, err)
return
}
defer db.Close()
db := h.caches.getDB()
cache, err := findCache(db, repo, keys, version, rundata.WriteIsolationKey)
cache, err := findCacheWithIsolationKeyFallback(db, repo, keys, version, rundata.WriteIsolationKey)
if err != nil {
h.responseJSON(w, r, 500, err)
h.responseFatalJSON(w, r, err)
return
}
// If read was scoped to WriteIsolationKey and didn't find anything, we can fallback to the non-isolated cache read
if cache == nil && rundata.WriteIsolationKey != "" {
cache, err = findCache(db, repo, keys, version, "")
if err != nil {
h.responseJSON(w, r, 500, err)
return
}
}
if cache == nil {
h.responseJSON(w, r, 204)
return
}
if ok, err := h.storage.Exist(cache.ID); err != nil {
if ok, err := h.caches.exist(cache.ID); err != nil {
h.responseJSON(w, r, 500, err)
return
} else if !ok {
@ -216,9 +205,9 @@ func (h *Handler) find(w http.ResponseWriter, r *http.Request, params httprouter
}
// POST /_apis/artifactcache/caches
func (h *Handler) reserve(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
func (h *handler) reserve(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
rundata := runDataFromHeaders(r)
repo, err := h.validateMac(rundata)
repo, err := h.caches.validateMac(rundata)
if err != nil {
h.responseJSON(w, r, 403, err)
return
@ -233,12 +222,7 @@ func (h *Handler) reserve(w http.ResponseWriter, r *http.Request, params httprou
api.Key = strings.ToLower(api.Key)
cache := api.ToCache()
db, err := h.openDB()
if err != nil {
h.responseJSON(w, r, 500, err)
return
}
defer db.Close()
db := h.caches.getDB()
now := time.Now().Unix()
cache.CreatedAt = now
@ -255,9 +239,9 @@ func (h *Handler) reserve(w http.ResponseWriter, r *http.Request, params httprou
}
// PATCH /_apis/artifactcache/caches/:id
func (h *Handler) upload(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
func (h *handler) upload(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
rundata := runDataFromHeaders(r)
repo, err := h.validateMac(rundata)
repo, err := h.caches.validateMac(rundata)
if err != nil {
h.responseJSON(w, r, 403, err)
return
@ -269,21 +253,16 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request, params httprout
return
}
cache, err := h.readCache(id)
cache, err := h.caches.readCache(id, repo)
if err != nil {
if errors.Is(err, bolthold.ErrNotFound) {
h.responseJSON(w, r, 404, fmt.Errorf("cache %d: not reserved", id))
return
}
h.responseJSON(w, r, 500, fmt.Errorf("cache Get: %w", err))
h.responseFatalJSON(w, r, fmt.Errorf("cache Get: %w", err))
return
}
// Should not happen
if cache.Repo != repo {
h.responseJSON(w, r, 500, fmt.Errorf("cache repo is not valid"))
return
}
if cache.WriteIsolationKey != rundata.WriteIsolationKey {
h.responseJSON(w, r, 403, fmt.Errorf("cache authorized for write isolation %q, but attempting to operate on %q", rundata.WriteIsolationKey, cache.WriteIsolationKey))
return
@ -298,11 +277,11 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request, params httprout
h.responseJSON(w, r, 400, fmt.Errorf("cache parseContentRange(%s): %w", r.Header.Get("Content-Range"), err))
return
}
if err := h.storage.Write(cache.ID, start, r.Body); err != nil {
if err := h.caches.write(cache.ID, start, r.Body); err != nil {
h.responseJSON(w, r, 500, fmt.Errorf("cache storage.Write: %w", err))
return
}
if err := h.useCache(id); err != nil {
if err := h.caches.useCache(id); err != nil {
h.responseJSON(w, r, 500, fmt.Errorf("cache useCache: %w", err))
return
}
@ -310,9 +289,9 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request, params httprout
}
// POST /_apis/artifactcache/caches/:id
func (h *Handler) commit(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
func (h *handler) commit(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
rundata := runDataFromHeaders(r)
repo, err := h.validateMac(rundata)
repo, err := h.caches.validateMac(rundata)
if err != nil {
h.responseJSON(w, r, 403, err)
return
@ -324,21 +303,16 @@ func (h *Handler) commit(w http.ResponseWriter, r *http.Request, params httprout
return
}
cache, err := h.readCache(id)
cache, err := h.caches.readCache(id, repo)
if err != nil {
if errors.Is(err, bolthold.ErrNotFound) {
h.responseJSON(w, r, 404, fmt.Errorf("cache %d: not reserved", id))
return
}
h.responseJSON(w, r, 500, fmt.Errorf("cache Get: %w", err))
h.responseFatalJSON(w, r, fmt.Errorf("cache Get: %w", err))
return
}
// Should not happen
if cache.Repo != repo {
h.responseJSON(w, r, 500, fmt.Errorf("cache repo is not valid"))
return
}
if cache.WriteIsolationKey != rundata.WriteIsolationKey {
h.responseJSON(w, r, 403, fmt.Errorf("cache authorized for write isolation %q, but attempting to operate on %q", rundata.WriteIsolationKey, cache.WriteIsolationKey))
return
@ -349,20 +323,15 @@ func (h *Handler) commit(w http.ResponseWriter, r *http.Request, params httprout
return
}
size, err := h.storage.Commit(cache.ID, cache.Size)
size, err := h.caches.commit(cache.ID, cache.Size)
if err != nil {
h.responseJSON(w, r, 500, err)
h.responseJSON(w, r, 500, fmt.Errorf("commit(%v): %w", cache.ID, err))
return
}
// write real size back to cache, it may be different from the current value when the request doesn't specify it.
cache.Size = size
db, err := h.openDB()
if err != nil {
h.responseJSON(w, r, 500, err)
return
}
defer db.Close()
db := h.caches.getDB()
cache.Complete = true
if err := db.Update(cache.ID, cache); err != nil {
@ -374,9 +343,9 @@ func (h *Handler) commit(w http.ResponseWriter, r *http.Request, params httprout
}
// GET /_apis/artifactcache/artifacts/:id
func (h *Handler) get(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
func (h *handler) get(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
rundata := runDataFromHeaders(r)
repo, err := h.validateMac(rundata)
repo, err := h.caches.validateMac(rundata)
if err != nil {
h.responseJSON(w, r, 403, err)
return
@ -388,38 +357,33 @@ func (h *Handler) get(w http.ResponseWriter, r *http.Request, params httprouter.
return
}
cache, err := h.readCache(id)
cache, err := h.caches.readCache(id, repo)
if err != nil {
if errors.Is(err, bolthold.ErrNotFound) {
h.responseJSON(w, r, 404, fmt.Errorf("cache %d: not reserved", id))
return
}
h.responseJSON(w, r, 500, fmt.Errorf("cache Get: %w", err))
h.responseFatalJSON(w, r, fmt.Errorf("cache Get: %w", err))
return
}
// Should not happen
if cache.Repo != repo {
h.responseJSON(w, r, 500, fmt.Errorf("cache repo is not valid"))
return
}
// reads permitted against caches w/ the same isolation key, or no isolation key
if cache.WriteIsolationKey != rundata.WriteIsolationKey && cache.WriteIsolationKey != "" {
h.responseJSON(w, r, 403, fmt.Errorf("cache authorized for write isolation %q, but attempting to operate on %q", rundata.WriteIsolationKey, cache.WriteIsolationKey))
return
}
if err := h.useCache(id); err != nil {
if err := h.caches.useCache(id); err != nil {
h.responseJSON(w, r, 500, fmt.Errorf("cache useCache: %w", err))
return
}
h.storage.Serve(w, r, id)
h.caches.serve(w, r, id)
}
// POST /_apis/artifactcache/clean
func (h *Handler) clean(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
func (h *handler) clean(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
rundata := runDataFromHeaders(r)
_, err := h.validateMac(rundata)
_, err := h.caches.validateMac(rundata)
if err != nil {
h.responseJSON(w, r, 403, err)
return
@ -430,206 +394,20 @@ func (h *Handler) clean(w http.ResponseWriter, r *http.Request, _ httprouter.Par
h.responseJSON(w, r, 200)
}
func (h *Handler) middleware(handler httprouter.Handle) httprouter.Handle {
func (h *handler) middleware(handler httprouter.Handle) httprouter.Handle {
return func(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
h.logger.Debugf("%s %s", r.Method, r.RequestURI)
handler(w, r, params)
go h.gcCache()
go h.caches.gcCache()
}
}
// if not found, return (nil, nil) instead of an error.
func findCache(db *bolthold.Store, repo string, keys []string, version, writeIsolationKey string) (*Cache, error) {
cache := &Cache{}
for _, prefix := range keys {
// if a key in the list matches exactly, don't return partial matches
if err := db.FindOne(cache,
bolthold.Where("Repo").Eq(repo).Index("Repo").
And("Key").Eq(prefix).
And("Version").Eq(version).
And("WriteIsolationKey").Eq(writeIsolationKey).
And("Complete").Eq(true).
SortBy("CreatedAt").Reverse()); err == nil || !errors.Is(err, bolthold.ErrNotFound) {
if err != nil {
return nil, fmt.Errorf("find cache: %w", err)
}
return cache, nil
}
prefixPattern := fmt.Sprintf("^%s", regexp.QuoteMeta(prefix))
re, err := regexp.Compile(prefixPattern)
if err != nil {
continue
}
if err := db.FindOne(cache,
bolthold.Where("Repo").Eq(repo).Index("Repo").
And("Key").RegExp(re).
And("Version").Eq(version).
And("WriteIsolationKey").Eq(writeIsolationKey).
And("Complete").Eq(true).
SortBy("CreatedAt").Reverse()); err != nil {
if errors.Is(err, bolthold.ErrNotFound) {
continue
}
return nil, fmt.Errorf("find cache: %w", err)
}
return cache, nil
}
return nil, nil
func (h *handler) responseFatalJSON(w http.ResponseWriter, r *http.Request, err error) {
h.responseJSON(w, r, 500, err)
fatal(h.logger, err)
}
func insertCache(db *bolthold.Store, cache *Cache) error {
if err := db.Insert(bolthold.NextSequence(), cache); err != nil {
return fmt.Errorf("insert cache: %w", err)
}
// write back id to db
if err := db.Update(cache.ID, cache); err != nil {
return fmt.Errorf("write back id to db: %w", err)
}
return nil
}
func (h *Handler) readCache(id uint64) (*Cache, error) {
db, err := h.openDB()
if err != nil {
return nil, err
}
defer db.Close()
cache := &Cache{}
if err := db.Get(id, cache); err != nil {
return nil, err
}
return cache, nil
}
func (h *Handler) useCache(id uint64) error {
db, err := h.openDB()
if err != nil {
return err
}
defer db.Close()
cache := &Cache{}
if err := db.Get(id, cache); err != nil {
return err
}
cache.UsedAt = time.Now().Unix()
return db.Update(cache.ID, cache)
}
const (
keepUsed = 30 * 24 * time.Hour
keepUnused = 7 * 24 * time.Hour
keepTemp = 5 * time.Minute
keepOld = 5 * time.Minute
)
func (h *Handler) gcCache() {
if h.gcing.Load() {
return
}
if !h.gcing.CompareAndSwap(false, true) {
return
}
defer h.gcing.Store(false)
if time.Since(h.gcAt) < time.Hour {
h.logger.Debugf("skip gc: %v", h.gcAt.String())
return
}
h.gcAt = time.Now()
h.logger.Debugf("gc: %v", h.gcAt.String())
db, err := h.openDB()
if err != nil {
return
}
defer db.Close()
// Remove the caches which are not completed for a while, they are most likely to be broken.
var caches []*Cache
if err := db.Find(&caches, bolthold.
Where("UsedAt").Lt(time.Now().Add(-keepTemp).Unix()).
And("Complete").Eq(false),
); err != nil {
h.logger.Warnf("find caches: %v", err)
} else {
for _, cache := range caches {
h.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
h.logger.Warnf("delete cache: %v", err)
continue
}
h.logger.Infof("deleted cache: %+v", cache)
}
}
// Remove the old caches which have not been used recently.
caches = caches[:0]
if err := db.Find(&caches, bolthold.
Where("UsedAt").Lt(time.Now().Add(-keepUnused).Unix()),
); err != nil {
h.logger.Warnf("find caches: %v", err)
} else {
for _, cache := range caches {
h.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
h.logger.Warnf("delete cache: %v", err)
continue
}
h.logger.Infof("deleted cache: %+v", cache)
}
}
// Remove the old caches which are too old.
caches = caches[:0]
if err := db.Find(&caches, bolthold.
Where("CreatedAt").Lt(time.Now().Add(-keepUsed).Unix()),
); err != nil {
h.logger.Warnf("find caches: %v", err)
} else {
for _, cache := range caches {
h.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
h.logger.Warnf("delete cache: %v", err)
continue
}
h.logger.Infof("deleted cache: %+v", cache)
}
}
// Remove the old caches with the same key and version, keep the latest one.
// Also keep the olds which have been used recently for a while in case of the cache is still in use.
if results, err := db.FindAggregate(
&Cache{},
bolthold.Where("Complete").Eq(true),
"Key", "Version",
); err != nil {
h.logger.Warnf("find aggregate caches: %v", err)
} else {
for _, result := range results {
if result.Count() <= 1 {
continue
}
result.Sort("CreatedAt")
caches = caches[:0]
result.Reduction(&caches)
for _, cache := range caches[:len(caches)-1] {
if time.Since(time.Unix(cache.UsedAt, 0)) < keepOld {
// Keep it since it has been used recently, even if it's old.
// Or it could break downloading in process.
continue
}
h.storage.Remove(cache.ID)
if err := db.Delete(cache.ID, cache); err != nil {
h.logger.Warnf("delete cache: %v", err)
continue
}
h.logger.Infof("deleted cache: %+v", cache)
}
}
}
}
func (h *Handler) responseJSON(w http.ResponseWriter, r *http.Request, code int, v ...any) {
func (h *handler) responseJSON(w http.ResponseWriter, r *http.Request, code int, v ...any) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
var data []byte
if len(v) == 0 || v[0] == nil {
@ -662,8 +440,16 @@ func parseContentRange(s string) (uint64, uint64, error) {
return start, stop, nil
}
func runDataFromHeaders(r *http.Request) cacheproxy.RunData {
return cacheproxy.RunData{
type RunData struct {
RepositoryFullName string
RunNumber string
Timestamp string
RepositoryMAC string
WriteIsolationKey string
}
func runDataFromHeaders(r *http.Request) RunData {
return RunData{
RepositoryFullName: r.Header.Get("Forgejo-Cache-Repo"),
RunNumber: r.Header.Get("Forgejo-Cache-RunNumber"),
Timestamp: r.Header.Get("Forgejo-Cache-Timestamp"),

View file

@ -4,18 +4,28 @@ import (
"bytes"
"crypto/rand"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/http/httptest"
"os"
"os/signal"
"path/filepath"
"strings"
"syscall"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"code.forgejo.org/forgejo/runner/v11/testutils"
"github.com/julienschmidt/httprouter"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/mock"
"github.com/timshannon/bolthold"
"go.etcd.io/bbolt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const (
@ -55,6 +65,10 @@ var (
)
func TestHandler(t *testing.T) {
defer testutils.MockVariable(&fatal, func(_ logrus.FieldLogger, err error) {
t.Fatalf("unexpected call to fatal(%v)", err)
})()
dir := filepath.Join(t.TempDir(), "artifactcache")
handler, err := StartHandler(dir, "", 0, "secret", nil)
require.NoError(t, err)
@ -63,10 +77,8 @@ func TestHandler(t *testing.T) {
base := fmt.Sprintf("%s%s", handler.ExternalURL(), urlBase)
defer func() {
t.Run("inpect db", func(t *testing.T) {
db, err := handler.openDB()
require.NoError(t, err)
defer db.Close()
t.Run("inspect db", func(t *testing.T) {
db := handler.getCaches().getDB()
require.NoError(t, db.Bolt().View(func(tx *bbolt.Tx) error {
return tx.Bucket([]byte("Cache")).ForEach(func(k, v []byte) error {
t.Logf("%s: %s", k, v)
@ -76,8 +88,7 @@ func TestHandler(t *testing.T) {
})
t.Run("close", func(t *testing.T) {
require.NoError(t, handler.Close())
assert.Nil(t, handler.server)
assert.Nil(t, handler.listener)
assert.True(t, handler.isClosed())
_, err := httpClient.Post(fmt.Sprintf("%s/caches/%d", base, 1), "", nil)
assert.Error(t, err)
})
@ -822,7 +833,7 @@ func overrideWriteIsolationKey(writeIsolationKey string) func() {
originalMac := httpClientTransport.OverrideDefaultMac
httpClientTransport.WriteIsolationKey = writeIsolationKey
httpClientTransport.OverrideDefaultMac = computeMac("secret", cacheRepo, cacheRunnum, cacheTimestamp, httpClientTransport.WriteIsolationKey)
httpClientTransport.OverrideDefaultMac = ComputeMac("secret", cacheRepo, cacheRunnum, cacheTimestamp, httpClientTransport.WriteIsolationKey)
return func() {
httpClientTransport.WriteIsolationKey = originalWriteIsolationKey
@ -893,6 +904,130 @@ func uploadCacheNormally(t *testing.T, base, key, version, writeIsolationKey str
}
}
func TestHandlerAPIFatalErrors(t *testing.T) {
for _, testCase := range []struct {
name string
prepare func(message string) func()
caches func(t *testing.T, message string) caches
call func(t *testing.T, handler Handler, w http.ResponseWriter)
}{
{
name: "find",
prepare: func(message string) func() {
return testutils.MockVariable(&findCacheWithIsolationKeyFallback, func(db *bolthold.Store, repo string, keys []string, version, writeIsolationKey string) (*Cache, error) {
return nil, errors.New(message)
})
},
caches: func(t *testing.T, message string) caches {
caches, err := newCaches(t.TempDir(), "secret", logrus.New())
require.NoError(t, err)
return caches
},
call: func(t *testing.T, handler Handler, w http.ResponseWriter) {
keyOne := "ONE"
req, err := http.NewRequest("GET", fmt.Sprintf("http://example.com/cache?keys=%s", keyOne), nil)
require.NoError(t, err)
req.Header.Set("Forgejo-Cache-Repo", cacheRepo)
req.Header.Set("Forgejo-Cache-RunNumber", cacheRunnum)
req.Header.Set("Forgejo-Cache-Timestamp", cacheTimestamp)
req.Header.Set("Forgejo-Cache-MAC", cacheMac)
req.Header.Set("Forgejo-Cache-Host", "http://example.com")
handler.find(w, req, nil)
},
},
{
name: "upload",
caches: func(t *testing.T, message string) caches {
caches := newMockCaches(t)
caches.On("close").Return()
caches.On("validateMac", RunData{}).Return(cacheRepo, nil)
caches.On("readCache", mock.Anything, mock.Anything).Return(nil, errors.New(message))
return caches
},
call: func(t *testing.T, handler Handler, w http.ResponseWriter) {
id := 1234
req, err := http.NewRequest("PATCH", fmt.Sprintf("http://example.com/caches/%d", id), nil)
require.NoError(t, err)
handler.upload(w, req, httprouter.Params{
httprouter.Param{Key: "id", Value: fmt.Sprintf("%d", id)},
})
},
},
{
name: "commit",
caches: func(t *testing.T, message string) caches {
caches := newMockCaches(t)
caches.On("close").Return()
caches.On("validateMac", RunData{}).Return(cacheRepo, nil)
caches.On("readCache", mock.Anything, mock.Anything).Return(nil, errors.New(message))
return caches
},
call: func(t *testing.T, handler Handler, w http.ResponseWriter) {
id := 1234
req, err := http.NewRequest("POST", fmt.Sprintf("http://example.com/caches/%d", id), nil)
require.NoError(t, err)
handler.commit(w, req, httprouter.Params{
httprouter.Param{Key: "id", Value: fmt.Sprintf("%d", id)},
})
},
},
{
name: "get",
caches: func(t *testing.T, message string) caches {
caches := newMockCaches(t)
caches.On("close").Return()
caches.On("validateMac", RunData{}).Return(cacheRepo, nil)
caches.On("readCache", mock.Anything, mock.Anything).Return(nil, errors.New(message))
return caches
},
call: func(t *testing.T, handler Handler, w http.ResponseWriter) {
id := 1234
req, err := http.NewRequest("GET", fmt.Sprintf("http://example.com/artifacts/%d", id), nil)
require.NoError(t, err)
handler.get(w, req, httprouter.Params{
httprouter.Param{Key: "id", Value: fmt.Sprintf("%d", id)},
})
},
},
// it currently is a noop
//{
//name: "clean",
//}
} {
t.Run(testCase.name, func(t *testing.T) {
message := "ERROR MESSAGE"
if testCase.prepare != nil {
defer testCase.prepare(message)()
}
fatalMessage := "<unset>"
defer testutils.MockVariable(&fatal, func(_ logrus.FieldLogger, err error) {
fatalMessage = err.Error()
})()
assertFatalMessage := func(t *testing.T, expected string) {
t.Helper()
assert.Contains(t, fatalMessage, expected)
}
dir := filepath.Join(t.TempDir(), "artifactcache")
handler, err := StartHandler(dir, "", 0, "secret", nil)
require.NoError(t, err)
defer handler.Close()
fatalMessage = "<unset>"
caches := testCase.caches(t, message) // doesn't need to be closed because it will be given to handler
handler.setCaches(caches)
w := httptest.NewRecorder()
testCase.call(t, handler, w)
require.Equal(t, 500, w.Code)
assertFatalMessage(t, message)
})
}
}
func TestHandler_gcCache(t *testing.T) {
dir := filepath.Join(t.TempDir(), "artifactcache")
handler, err := StartHandler(dir, "", 0, "", nil)
@ -976,18 +1111,15 @@ func TestHandler_gcCache(t *testing.T) {
},
}
db, err := handler.openDB()
require.NoError(t, err)
db := handler.getCaches().getDB()
for _, c := range cases {
require.NoError(t, insertCache(db, c.Cache))
}
require.NoError(t, db.Close())
handler.gcAt = time.Time{} // ensure gcCache will not skip
handler.gcCache()
handler.getCaches().setgcAt(time.Time{}) // ensure gcCache will not skip
handler.getCaches().gcCache()
db, err = handler.openDB()
require.NoError(t, err)
db = handler.getCaches().getDB()
for i, v := range cases {
t.Run(fmt.Sprintf("%d_%s", i, v.Cache.Key), func(t *testing.T) {
cache := &Cache{}
@ -999,7 +1131,6 @@ func TestHandler_gcCache(t *testing.T) {
}
})
}
require.NoError(t, db.Close())
}
func TestHandler_ExternalURL(t *testing.T) {
@ -1010,8 +1141,7 @@ func TestHandler_ExternalURL(t *testing.T) {
assert.Equal(t, handler.ExternalURL(), "http://127.0.0.1:34567")
require.NoError(t, handler.Close())
assert.Nil(t, handler.server)
assert.Nil(t, handler.listener)
assert.True(t, handler.isClosed())
})
t.Run("reports correct URL on IPv6 zero host", func(t *testing.T) {
@ -1021,8 +1151,7 @@ func TestHandler_ExternalURL(t *testing.T) {
assert.Equal(t, handler.ExternalURL(), "http://[2001:db8::]:34567")
require.NoError(t, handler.Close())
assert.Nil(t, handler.server)
assert.Nil(t, handler.listener)
assert.True(t, handler.isClosed())
})
t.Run("reports correct URL on IPv6", func(t *testing.T) {
@ -1032,7 +1161,45 @@ func TestHandler_ExternalURL(t *testing.T) {
assert.Equal(t, handler.ExternalURL(), "http://[2001:db8::1:2:3:4]:34567")
require.NoError(t, handler.Close())
assert.Nil(t, handler.server)
assert.Nil(t, handler.listener)
assert.True(t, handler.isClosed())
})
}
var (
settleTime = 100 * time.Millisecond
fatalWaitingTime = 30 * time.Second
)
func waitSig(t *testing.T, c <-chan os.Signal, sig os.Signal) {
t.Helper()
// Sleep multiple times to give the kernel more tries to
// deliver the signal.
start := time.Now()
timer := time.NewTimer(settleTime / 10)
defer timer.Stop()
for time.Since(start) < fatalWaitingTime {
select {
case s := <-c:
if s == sig {
return
}
t.Fatalf("signal was %v, want %v", s, sig)
case <-timer.C:
timer.Reset(settleTime / 10)
}
}
t.Fatalf("timeout after %v waiting for %v", fatalWaitingTime, sig)
}
func TestHandler_fatal(t *testing.T) {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM)
defer signal.Stop(c)
discard := logrus.New()
discard.Out = io.Discard
fatal(discard, errors.New("fatal error"))
waitSig(t, c, syscall.SIGTERM)
}

View file

@ -10,19 +10,17 @@ import (
"errors"
"strconv"
"time"
"code.forgejo.org/forgejo/runner/v9/act/cacheproxy"
)
var ErrValidation = errors.New("validation error")
func (h *Handler) validateMac(rundata cacheproxy.RunData) (string, error) {
func (c *cachesImpl) validateMac(rundata RunData) (string, error) {
// TODO: allow configurable max age
if !validateAge(rundata.Timestamp) {
return "", ErrValidation
}
expectedMAC := computeMac(h.secret, rundata.RepositoryFullName, rundata.RunNumber, rundata.Timestamp, rundata.WriteIsolationKey)
expectedMAC := ComputeMac(c.secret, rundata.RepositoryFullName, rundata.RunNumber, rundata.Timestamp, rundata.WriteIsolationKey)
if hmac.Equal([]byte(expectedMAC), []byte(rundata.RepositoryMAC)) {
return rundata.RepositoryFullName, nil
}
@ -40,7 +38,7 @@ func validateAge(ts string) bool {
return true
}
func computeMac(secret, repo, run, ts, writeIsolationKey string) string {
func ComputeMac(secret, repo, run, ts, writeIsolationKey string) string {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(repo))
mac.Write([]byte(">"))

View file

@ -5,12 +5,11 @@ import (
"testing"
"time"
"code.forgejo.org/forgejo/runner/v9/act/cacheproxy"
"github.com/stretchr/testify/require"
)
func TestMac(t *testing.T) {
handler := &Handler{
cache := &cachesImpl{
secret: "secret for testing",
}
@ -19,15 +18,15 @@ func TestMac(t *testing.T) {
run := "1"
ts := strconv.FormatInt(time.Now().Unix(), 10)
mac := computeMac(handler.secret, name, run, ts, "")
rundata := cacheproxy.RunData{
mac := ComputeMac(cache.secret, name, run, ts, "")
rundata := RunData{
RepositoryFullName: name,
RunNumber: run,
Timestamp: ts,
RepositoryMAC: mac,
}
repoName, err := handler.validateMac(rundata)
repoName, err := cache.validateMac(rundata)
require.NoError(t, err)
require.Equal(t, name, repoName)
})
@ -37,15 +36,15 @@ func TestMac(t *testing.T) {
run := "1"
ts := "9223372036854775807" // This should last us for a while...
mac := computeMac(handler.secret, name, run, ts, "")
rundata := cacheproxy.RunData{
mac := ComputeMac(cache.secret, name, run, ts, "")
rundata := RunData{
RepositoryFullName: name,
RunNumber: run,
Timestamp: ts,
RepositoryMAC: mac,
}
_, err := handler.validateMac(rundata)
_, err := cache.validateMac(rundata)
require.Error(t, err)
})
@ -54,14 +53,14 @@ func TestMac(t *testing.T) {
run := "1"
ts := strconv.FormatInt(time.Now().Unix(), 10)
rundata := cacheproxy.RunData{
rundata := RunData{
RepositoryFullName: name,
RunNumber: run,
Timestamp: ts,
RepositoryMAC: "this is not the right mac :D",
}
repoName, err := handler.validateMac(rundata)
repoName, err := cache.validateMac(rundata)
require.Error(t, err)
require.Equal(t, "", repoName)
})
@ -72,12 +71,12 @@ func TestMac(t *testing.T) {
run := "42"
ts := "1337"
mac := computeMac(secret, name, run, ts, "")
expectedMac := "4754474b21329e8beadd2b4054aa4be803965d66e710fa1fee091334ed804f29" // * Precomputed, anytime the computeMac function changes this needs to be recalculated
mac := ComputeMac(secret, name, run, ts, "")
expectedMac := "4754474b21329e8beadd2b4054aa4be803965d66e710fa1fee091334ed804f29" // * Precomputed, anytime the ComputeMac function changes this needs to be recalculated
require.Equal(t, expectedMac, mac)
mac = computeMac(secret, name, run, ts, "refs/pull/12/head")
expectedMac = "9ca8f4cb5e1b083ee8cd215215bc00f379b28511d3ef7930bf054767de34766d" // * Precomputed, anytime the computeMac function changes this needs to be recalculated
mac = ComputeMac(secret, name, run, ts, "refs/pull/12/head")
expectedMac = "9ca8f4cb5e1b083ee8cd215215bc00f379b28511d3ef7930bf054767de34766d" // * Precomputed, anytime the ComputeMac function changes this needs to be recalculated
require.Equal(t, expectedMac, mac)
})
}

View file

@ -0,0 +1,225 @@
// Code generated by mockery v2.53.5. DO NOT EDIT.
package artifactcache
import (
http "net/http"
bolthold "github.com/timshannon/bolthold"
io "io"
mock "github.com/stretchr/testify/mock"
time "time"
)
// mockCaches is an autogenerated mock type for the caches type
type mockCaches struct {
mock.Mock
}
// close provides a mock function with no fields
func (_m *mockCaches) close() {
_m.Called()
}
// commit provides a mock function with given fields: id, size
func (_m *mockCaches) commit(id uint64, size int64) (int64, error) {
ret := _m.Called(id, size)
if len(ret) == 0 {
panic("no return value specified for commit")
}
var r0 int64
var r1 error
if rf, ok := ret.Get(0).(func(uint64, int64) (int64, error)); ok {
return rf(id, size)
}
if rf, ok := ret.Get(0).(func(uint64, int64) int64); ok {
r0 = rf(id, size)
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func(uint64, int64) error); ok {
r1 = rf(id, size)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// exist provides a mock function with given fields: id
func (_m *mockCaches) exist(id uint64) (bool, error) {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for exist")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(uint64) (bool, error)); ok {
return rf(id)
}
if rf, ok := ret.Get(0).(func(uint64) bool); ok {
r0 = rf(id)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(uint64) error); ok {
r1 = rf(id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// gcCache provides a mock function with no fields
func (_m *mockCaches) gcCache() {
_m.Called()
}
// getDB provides a mock function with no fields
func (_m *mockCaches) getDB() *bolthold.Store {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for getDB")
}
var r0 *bolthold.Store
if rf, ok := ret.Get(0).(func() *bolthold.Store); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*bolthold.Store)
}
}
return r0
}
// readCache provides a mock function with given fields: id, repo
func (_m *mockCaches) readCache(id uint64, repo string) (*Cache, error) {
ret := _m.Called(id, repo)
if len(ret) == 0 {
panic("no return value specified for readCache")
}
var r0 *Cache
var r1 error
if rf, ok := ret.Get(0).(func(uint64, string) (*Cache, error)); ok {
return rf(id, repo)
}
if rf, ok := ret.Get(0).(func(uint64, string) *Cache); ok {
r0 = rf(id, repo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*Cache)
}
}
if rf, ok := ret.Get(1).(func(uint64, string) error); ok {
r1 = rf(id, repo)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// serve provides a mock function with given fields: w, r, id
func (_m *mockCaches) serve(w http.ResponseWriter, r *http.Request, id uint64) {
_m.Called(w, r, id)
}
// setgcAt provides a mock function with given fields: at
func (_m *mockCaches) setgcAt(at time.Time) {
_m.Called(at)
}
// useCache provides a mock function with given fields: id
func (_m *mockCaches) useCache(id uint64) error {
ret := _m.Called(id)
if len(ret) == 0 {
panic("no return value specified for useCache")
}
var r0 error
if rf, ok := ret.Get(0).(func(uint64) error); ok {
r0 = rf(id)
} else {
r0 = ret.Error(0)
}
return r0
}
// validateMac provides a mock function with given fields: rundata
func (_m *mockCaches) validateMac(rundata RunData) (string, error) {
ret := _m.Called(rundata)
if len(ret) == 0 {
panic("no return value specified for validateMac")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(RunData) (string, error)); ok {
return rf(rundata)
}
if rf, ok := ret.Get(0).(func(RunData) string); ok {
r0 = rf(rundata)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(RunData) error); ok {
r1 = rf(rundata)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// write provides a mock function with given fields: id, offset, reader
func (_m *mockCaches) write(id uint64, offset uint64, reader io.Reader) error {
ret := _m.Called(id, offset, reader)
if len(ret) == 0 {
panic("no return value specified for write")
}
var r0 error
if rf, ok := ret.Get(0).(func(uint64, uint64, io.Reader) error); ok {
r0 = rf(id, offset, reader)
} else {
r0 = ret.Error(0)
}
return r0
}
// newMockCaches creates a new instance of mockCaches. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func newMockCaches(t interface {
mock.TestingT
Cleanup(func())
},
) *mockCaches {
mock := &mockCaches{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -0,0 +1,9 @@
//go:build !windows
package artifactcache
import "syscall"
func suicide() error {
return syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
}

View file

@ -0,0 +1,14 @@
//go:build windows
package artifactcache
import "syscall"
func suicide() error {
handle, err := syscall.GetCurrentProcess()
if err != nil {
return err
}
return syscall.TerminateProcess(handle, uint32(syscall.SIGTERM))
}

View file

@ -4,9 +4,6 @@
package cacheproxy
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"io"
@ -22,7 +19,8 @@ import (
"github.com/julienschmidt/httprouter"
"github.com/sirupsen/logrus"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/artifactcache"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
const (
@ -40,23 +38,16 @@ type Handler struct {
outboundIP string
cacheServerHost string
cacheProxyHostOverride string
cacheSecret string
runs sync.Map
}
type RunData struct {
RepositoryFullName string
RunNumber string
Timestamp string
RepositoryMAC string
WriteIsolationKey string
}
func (h *Handler) CreateRunData(fullName, runNumber, timestamp, writeIsolationKey string) RunData {
mac := computeMac(h.cacheSecret, fullName, runNumber, timestamp, writeIsolationKey)
return RunData{
func (h *Handler) CreateRunData(fullName, runNumber, timestamp, writeIsolationKey string) artifactcache.RunData {
mac := artifactcache.ComputeMac(h.cacheSecret, fullName, runNumber, timestamp, writeIsolationKey)
return artifactcache.RunData{
RepositoryFullName: fullName,
RunNumber: runNumber,
Timestamp: timestamp,
@ -65,7 +56,7 @@ func (h *Handler) CreateRunData(fullName, runNumber, timestamp, writeIsolationKe
}
}
func StartHandler(targetHost, outboundIP string, port uint16, cacheSecret string, logger logrus.FieldLogger) (*Handler, error) {
func StartHandler(targetHost, outboundIP string, port uint16, cacheProxyHostOverride, cacheSecret string, logger logrus.FieldLogger) (*Handler, error) {
h := &Handler{}
if logger == nil {
@ -73,7 +64,7 @@ func StartHandler(targetHost, outboundIP string, port uint16, cacheSecret string
discard.Out = io.Discard
logger = discard
}
logger = logger.WithField("module", "artifactcache")
logger = logger.WithField("module", "cacheproxy")
h.logger = logger
h.cacheSecret = cacheSecret
@ -87,10 +78,11 @@ func StartHandler(targetHost, outboundIP string, port uint16, cacheSecret string
}
h.cacheServerHost = targetHost
h.cacheProxyHostOverride = cacheProxyHostOverride
proxy, err := h.newReverseProxy(targetHost)
if err != nil {
return nil, fmt.Errorf("unable to set up proxy to target host")
return nil, fmt.Errorf("unable to set up proxy to target host: %v", err)
}
router := httprouter.New()
@ -142,11 +134,12 @@ func (h *Handler) newReverseProxy(targetHost string) (*httputil.ReverseProxy, er
h.logger.Warn(fmt.Sprintf("Tried starting a cache proxy with id %s, which does not exist.", id))
return
}
runData := data.(RunData)
runData := data.(artifactcache.RunData)
uri := matches[2]
r.SetURL(targetURL)
r.Out.URL.Path = uri
h.logger.Debugf("proxy req %s %q to %q", r.In.Method, r.In.URL, r.Out.URL)
r.Out.Header.Set("Forgejo-Cache-Repo", runData.RepositoryFullName)
r.Out.Header.Set("Forgejo-Cache-RunNumber", runData.RunNumber)
@ -158,19 +151,25 @@ func (h *Handler) newReverseProxy(targetHost string) (*httputil.ReverseProxy, er
r.Out.Header.Set("Forgejo-Cache-WriteIsolationKey", runData.WriteIsolationKey)
}
},
ModifyResponse: func(r *http.Response) error {
h.logger.Debugf("proxy resp %s w/ %d bytes", r.Status, r.ContentLength)
return nil
},
}
return proxy, nil
}
func (h *Handler) ExternalURL() string {
// TODO: make the external url configurable if necessary
if h.cacheProxyHostOverride != "" {
return h.cacheProxyHostOverride
}
return fmt.Sprintf("http://%s", net.JoinHostPort(h.outboundIP, strconv.Itoa(h.listener.Addr().(*net.TCPAddr).Port)))
}
// Informs the proxy of a workflow run that can make cache requests.
// The RunData contains the information about the repository.
// The function returns the 32-bit random key which the run will use to identify itself.
func (h *Handler) AddRun(data RunData) (string, error) {
func (h *Handler) AddRun(data artifactcache.RunData) (string, error) {
for range 3 {
key := common.MustRandName(4)
_, loaded := h.runs.LoadOrStore(key, data)
@ -211,15 +210,3 @@ func (h *Handler) Close() error {
}
return retErr
}
func computeMac(secret, repo, run, ts, writeIsolationKey string) string {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(repo))
mac.Write([]byte(">"))
mac.Write([]byte(run))
mac.Write([]byte(">"))
mac.Write([]byte(ts))
mac.Write([]byte(">"))
mac.Write([]byte(writeIsolationKey))
return hex.EncodeToString(mac.Sum(nil))
}

View file

@ -19,7 +19,7 @@ import (
"github.com/mattn/go-isatty"
log "github.com/sirupsen/logrus"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
var (
@ -305,7 +305,7 @@ func gitOptions(token string) (fetchOptions git.FetchOptions, pullOptions git.Pu
func NewGitCloneExecutor(input NewGitCloneExecutorInput) common.Executor {
return func(ctx context.Context) error {
logger := common.Logger(ctx)
logger.Infof(" \u2601 git clone '%s' # ref=%s", input.URL, input.Ref)
logger.Infof(" \u2601\ufe0f git clone '%s' # ref=%s", input.URL, input.Ref)
logger.Debugf(" cloning %s to %s", input.URL, input.Dir)
cloneLock.Lock()

View file

@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
func TestFindGitSlug(t *testing.T) {

View file

@ -5,7 +5,7 @@ import (
"io"
"time"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/docker/go-connections/nat"
)

View file

@ -6,7 +6,7 @@ import (
"context"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/credentials"
"github.com/docker/docker/api/types/registry"

View file

@ -14,7 +14,7 @@ import (
"github.com/moby/patternmatcher"
"github.com/moby/patternmatcher/ignorefile"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
// NewDockerBuildExecutor function to create a run executor for the container

View file

@ -6,7 +6,7 @@ import (
"context"
"fmt"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/image"
)

View file

@ -5,7 +5,7 @@ package container
import (
"context"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/docker/docker/api/types/network"
)

View file

@ -13,7 +13,7 @@ import (
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
// NewDockerPullExecutor function to create a run executor for the container

View file

@ -38,8 +38,8 @@ import (
"github.com/spf13/pflag"
"golang.org/x/term"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/filecollector"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/filecollector"
)
// NewContainer creates a reference to a container
@ -483,6 +483,14 @@ func (cr *containerReference) mergeJobOptions(ctx context.Context, config *conta
}
}
if jobConfig.HostConfig.Memory > 0 {
logger.Debugf("--memory %v", jobConfig.HostConfig.Memory)
if hostConfig.Memory > 0 && jobConfig.HostConfig.Memory > hostConfig.Memory {
return nil, nil, fmt.Errorf("the --memory %v option found in the workflow cannot be greater than the --memory %v option from the runner configuration file", jobConfig.HostConfig.Memory, hostConfig.Memory)
}
hostConfig.Memory = jobConfig.HostConfig.Memory
}
if len(jobConfig.Config.Hostname) > 0 {
logger.Debugf("--hostname %v", jobConfig.Config.Hostname)
config.Hostname = jobConfig.Config.Hostname

View file

@ -11,7 +11,7 @@ import (
"testing"
"time"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"

View file

@ -7,7 +7,7 @@ import (
"errors"
"runtime"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/system"
)

View file

@ -6,7 +6,7 @@ import (
"context"
"slices"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/volume"
)

View file

@ -13,6 +13,7 @@ import (
"path/filepath"
"runtime"
"strings"
"sync/atomic"
"time"
"github.com/go-git/go-billy/v5/helper/polyfill"
@ -20,9 +21,9 @@ import (
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
"golang.org/x/term"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/filecollector"
"code.forgejo.org/forgejo/runner/v9/act/lookpath"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/filecollector"
"code.forgejo.org/forgejo/runner/v11/act/lookpath"
)
type HostEnvironment struct {
@ -33,7 +34,6 @@ type HostEnvironment struct {
Workdir string
ActPath string
Root string
CleanUp func()
StdOut io.Writer
LXC bool
}
@ -191,12 +191,12 @@ func (e *HostEnvironment) Start(_ bool) common.Executor {
type ptyWriter struct {
Out io.Writer
AutoStop bool
AutoStop atomic.Bool
dirtyLine bool
}
func (w *ptyWriter) Write(buf []byte) (int, error) {
if w.AutoStop && len(buf) > 0 && buf[len(buf)-1] == 4 {
if w.AutoStop.Load() && len(buf) > 0 && buf[len(buf)-1] == 4 {
n, err := w.Out.Write(buf[:len(buf)-1])
if err != nil {
return n, err
@ -365,7 +365,7 @@ func (e *HostEnvironment) exec(ctx context.Context, commandparam []string, cmdli
return fmt.Errorf("RUN %w", err)
}
if tty != nil {
writer.AutoStop = true
writer.AutoStop.Store(true)
if _, err := tty.Write([]byte("\x04")); err != nil {
common.Logger(ctx).Debug("Failed to write EOT")
}
@ -388,7 +388,7 @@ func (e *HostEnvironment) ExecWithCmdLine(command []string, cmdline string, env
if err := e.exec(ctx, command, cmdline, env, user, workdir); err != nil {
select {
case <-ctx.Done():
return fmt.Errorf("this step has been cancelled: %w", err)
return fmt.Errorf("this step has been cancelled: ctx: %w, exec: %w", ctx.Err(), err)
default:
return err
}
@ -403,10 +403,12 @@ func (e *HostEnvironment) UpdateFromEnv(srcPath string, env *map[string]string)
func (e *HostEnvironment) Remove() common.Executor {
return func(ctx context.Context) error {
if e.CleanUp != nil {
e.CleanUp()
if e.GetLXC() {
// there may be files owned by root: removal
// is the responsibility of the LXC backend
return nil
}
return os.RemoveAll(e.Path)
return os.RemoveAll(e.Root)
}
}

View file

@ -8,7 +8,7 @@ import (
"io"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
func parseEnvFile(e Container, srcPath string, env *map[string]string) common.Executor {

View file

@ -15,7 +15,7 @@ import (
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/rhysd/actionlint"
)

View file

@ -4,7 +4,7 @@ import (
"path/filepath"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/assert"
)

View file

@ -7,7 +7,7 @@ import (
"reflect"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/rhysd/actionlint"
)
@ -158,6 +158,8 @@ func (impl *interperterImpl) evaluateVariable(variableNode *actionlint.VariableN
return impl.env.Github, nil
case "forge":
return impl.env.Github, nil
case "forgejo":
return impl.env.Github, nil
case "env":
return impl.env.Env, nil
case "job":

View file

@ -4,7 +4,7 @@ import (
"math"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/assert"
)

View file

@ -5,7 +5,7 @@ import (
"regexp"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/exprparser"
"code.forgejo.org/forgejo/runner/v11/act/exprparser"
"go.yaml.in/yaml/v3"
)

View file

@ -1,8 +1,8 @@
package jobparser
import (
"code.forgejo.org/forgejo/runner/v9/act/exprparser"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/exprparser"
"code.forgejo.org/forgejo/runner/v11/act/model"
"go.yaml.in/yaml/v3"
)
@ -76,6 +76,36 @@ func NewInterpeter(
return exprparser.NewInterpeter(ee, config)
}
// Returns an interpeter used in the server in the context of workflow-level templates. Needs github, inputs, and vars
// context only.
func NewWorkflowInterpeter(
gitCtx *model.GithubContext,
vars map[string]string,
inputs map[string]any,
) exprparser.Interpreter {
ee := &exprparser.EvaluationEnvironment{
Github: gitCtx,
Env: nil, // no need
Job: nil, // no need
Steps: nil, // no need
Runner: nil, // no need
Secrets: nil, // no need
Strategy: nil, // no need
Matrix: nil, // no need
Needs: nil, // no need
Inputs: inputs,
Vars: vars,
}
config := exprparser.Config{
Run: nil,
WorkingDir: "", // WorkingDir is used for the function hashFiles, but it's not needed in the server
Context: "workflow",
}
return exprparser.NewInterpeter(ee, config)
}
// JobResult is the minimum requirement of job results for Interpeter
type JobResult struct {
Needs []string

View file

@ -8,7 +8,7 @@ import (
"go.yaml.in/yaml/v3"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
func Parse(content []byte, validate bool, options ...ParseOption) ([]*SingleWorkflow, error) {

View file

@ -1,10 +1,10 @@
package jobparser
import (
"bytes"
"fmt"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"go.yaml.in/yaml/v3"
)
@ -193,83 +193,32 @@ func (evt *Event) Schedules() []map[string]string {
return evt.schedules
}
func ReadWorkflowRawConcurrency(content []byte) (*model.RawConcurrency, error) {
w := new(model.Workflow)
err := yaml.NewDecoder(bytes.NewReader(content)).Decode(w)
return w.RawConcurrency, err
}
func EvaluateConcurrency(rc *model.RawConcurrency, jobID string, job *Job, gitCtx map[string]any, results map[string]*JobResult, vars map[string]string, inputs map[string]any) (string, bool, error) {
actJob := &model.Job{}
if job != nil {
actJob.Strategy = &model.Strategy{
FailFastString: job.Strategy.FailFastString,
MaxParallelString: job.Strategy.MaxParallelString,
RawMatrix: job.Strategy.RawMatrix,
}
actJob.Strategy.FailFast = actJob.Strategy.GetFailFast()
actJob.Strategy.MaxParallel = actJob.Strategy.GetMaxParallel()
}
matrix := make(map[string]any)
matrixes, err := actJob.GetMatrixes()
if err != nil {
return "", false, err
}
if len(matrixes) > 0 {
matrix = matrixes[0]
}
evaluator := NewExpressionEvaluator(NewInterpeter(jobID, actJob, matrix, toGitContext(gitCtx), results, vars, inputs))
// Convert the raw YAML from the `concurrency` block on a workflow into the evaluated concurrency group and
// cancel-in-progress value. This implementation only supports workflow-level concurrency definition, where we expect
// expressions to be able to access only the github, inputs and vars contexts. If RawConcurrency is empty, then the
// returned concurrency group will be "" and cancel-in-progress will be nil -- this can be used to distinguish from an
// explicit cancel-in-progress choice even if a group isn't specified.
func EvaluateWorkflowConcurrency(rc *model.RawConcurrency, gitCtx *model.GithubContext, vars map[string]string, inputs map[string]any) (string, *bool, error) {
evaluator := NewExpressionEvaluator(NewWorkflowInterpeter(gitCtx, vars, inputs))
var node yaml.Node
if err := node.Encode(rc); err != nil {
return "", false, fmt.Errorf("failed to encode concurrency: %w", err)
return "", nil, fmt.Errorf("failed to encode concurrency: %w", err)
}
if err := evaluator.EvaluateYamlNode(&node); err != nil {
return "", false, fmt.Errorf("failed to evaluate concurrency: %w", err)
return "", nil, fmt.Errorf("failed to evaluate concurrency: %w", err)
}
var evaluated model.RawConcurrency
if err := node.Decode(&evaluated); err != nil {
return "", false, fmt.Errorf("failed to unmarshal evaluated concurrency: %w", err)
return "", nil, fmt.Errorf("failed to unmarshal evaluated concurrency: %w", err)
}
if evaluated.RawExpression != "" {
return evaluated.RawExpression, false, nil
return evaluated.RawExpression, nil, nil
}
return evaluated.Group, evaluated.CancelInProgress == "true", nil
if evaluated.CancelInProgress == "" {
return evaluated.Group, nil, nil
}
func toGitContext(input map[string]any) *model.GithubContext {
gitContext := &model.GithubContext{
EventPath: asString(input["event_path"]),
Workflow: asString(input["workflow"]),
RunID: asString(input["run_id"]),
RunNumber: asString(input["run_number"]),
Actor: asString(input["actor"]),
Repository: asString(input["repository"]),
EventName: asString(input["event_name"]),
Sha: asString(input["sha"]),
Ref: asString(input["ref"]),
RefName: asString(input["ref_name"]),
RefType: asString(input["ref_type"]),
HeadRef: asString(input["head_ref"]),
BaseRef: asString(input["base_ref"]),
Token: asString(input["token"]),
Workspace: asString(input["workspace"]),
Action: asString(input["action"]),
ActionPath: asString(input["action_path"]),
ActionRef: asString(input["action_ref"]),
ActionRepository: asString(input["action_repository"]),
Job: asString(input["job"]),
RepositoryOwner: asString(input["repository_owner"]),
RetentionDays: asString(input["retention_days"]),
}
event, ok := input["event"].(map[string]any)
if ok {
gitContext.Event = event
}
return gitContext
cancelInProgress := evaluated.CancelInProgress == "true"
return evaluated.Group, &cancelInProgress, nil
}
func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
@ -278,7 +227,7 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
var val string
err := rawOn.Decode(&val)
if err != nil {
return nil, err
return nil, fmt.Errorf("unable to interpret scalar value into a string: %w", err)
}
return []*Event{
{Name: val},
@ -290,12 +239,12 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
return nil, err
}
res := make([]*Event, 0, len(val))
for _, v := range val {
for i, v := range val {
switch t := v.(type) {
case string:
res = append(res, &Event{Name: t})
default:
return nil, fmt.Errorf("invalid type %T", t)
return nil, fmt.Errorf("value at index %d was unexpected type %[2]T; must be a string but was %#[2]v", i, v)
}
}
return res, nil
@ -315,16 +264,6 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
continue
}
switch t := v.(type) {
case string:
res = append(res, &Event{
Name: k,
acts: map[string][]string{},
})
case []string:
res = append(res, &Event{
Name: k,
acts: map[string][]string{},
})
case map[string]any:
acts := make(map[string][]string, len(t))
for act, branches := range t {
@ -338,15 +277,15 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
for i, v := range b {
var ok bool
if acts[act][i], ok = v.(string); !ok {
return nil, fmt.Errorf("unknown on type: %#v", branches)
return nil, fmt.Errorf("key %q.%q index %d had unexpected type %[4]T; a string was expected but was %#[4]v", k, act, i, v)
}
}
case map[string]any:
if isInvalidOnType(k, act) {
return nil, fmt.Errorf("unknown on type: %#v", v)
if err := isInvalidOnType(k, act); err != nil {
return nil, fmt.Errorf("invalid value on key %q: %w", k, err)
}
default:
return nil, fmt.Errorf("unknown on type: %#v", branches)
return nil, fmt.Errorf("key %q.%q had unexpected type %T; was %#v", k, act, branches, branches)
}
}
if k == "workflow_dispatch" || k == "workflow_call" {
@ -358,19 +297,22 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
})
case []any:
if k != "schedule" {
return nil, fmt.Errorf("unknown on type: %#v", v)
return nil, fmt.Errorf("key %q had an type %T; only the 'schedule' key is expected with this type", k, v)
}
schedules := make([]map[string]string, len(t))
for i, tt := range t {
vv, ok := tt.(map[string]any)
if !ok {
return nil, fmt.Errorf("unknown on type: %#v", v)
return nil, fmt.Errorf("key %q[%d] had unexpected type %[3]T; a map with a key \"cron\" was expected, but value was %#[3]v", k, i, tt)
}
schedules[i] = make(map[string]string, len(vv))
for k, vvv := range vv {
for kk, vvv := range vv {
if strings.ToLower(kk) != "cron" {
return nil, fmt.Errorf("key %q[%d] had unexpected key %q; \"cron\" was expected", k, i, kk)
}
var ok bool
if schedules[i][k], ok = vvv.(string); !ok {
return nil, fmt.Errorf("unknown on type: %#v", v)
if schedules[i][kk], ok = vvv.(string); !ok {
return nil, fmt.Errorf("key %q[%d].%q had unexpected type %[4]T; a string was expected by was %#[4]v", k, i, kk, vvv)
}
}
}
@ -379,23 +321,29 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
schedules: schedules,
})
default:
return nil, fmt.Errorf("unknown on type: %#v", v)
return nil, fmt.Errorf("key %q had unexpected type %[2]T; expected a map or array but was %#[2]v", k, v)
}
}
return res, nil
default:
return nil, fmt.Errorf("unknown on type: %v", rawOn.Kind)
return nil, fmt.Errorf("unexpected yaml node in `on`: %v", rawOn.Kind)
}
}
func isInvalidOnType(onType, subKey string) bool {
if onType == "workflow_dispatch" && subKey == "inputs" {
return false
func isInvalidOnType(onType, subKey string) error {
if onType == "workflow_dispatch" {
if subKey == "inputs" {
return nil
}
if onType == "workflow_call" && (subKey == "inputs" || subKey == "outputs") {
return false
return fmt.Errorf("workflow_dispatch only supports key \"inputs\", but key %q was found", subKey)
}
return true
if onType == "workflow_call" {
if subKey == "inputs" || subKey == "outputs" {
return nil
}
return fmt.Errorf("workflow_call only supports keys \"inputs\" and \"outputs\", but key %q was found", subKey)
}
return fmt.Errorf("unexpected key %q.%q", onType, subKey)
}
// parseMappingNode parse a mapping node and preserve order.
@ -430,12 +378,3 @@ func parseMappingNode[T any](node *yaml.Node) ([]string, []T, error) {
return scalars, datas, nil
}
func asString(v any) string {
if v == nil {
return ""
} else if s, ok := v.(string); ok {
return s
}
return ""
}

View file

@ -5,7 +5,7 @@ import (
"strings"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -16,6 +16,7 @@ func TestParseRawOn(t *testing.T) {
kases := []struct {
input string
result []*Event
err string
}{
{
input: "on: issue_comment",
@ -33,7 +34,10 @@ func TestParseRawOn(t *testing.T) {
},
},
},
{
input: "on: [123]",
err: "value at index 0 was unexpected type int; must be a string but was 123",
},
{
input: "on:\n - push\n - pull_request",
result: []*Event{
@ -45,6 +49,19 @@ func TestParseRawOn(t *testing.T) {
},
},
},
{
input: "on: { push: null }",
result: []*Event{
{
Name: "push",
acts: map[string][]string{},
},
},
},
{
input: "on: { push: 'abc' }",
err: "key \"push\" had unexpected type string; expected a map or array but was \"abc\"",
},
{
input: "on:\n push:\n branches:\n - master",
result: []*Event{
@ -72,6 +89,10 @@ func TestParseRawOn(t *testing.T) {
},
},
},
{
input: "on:\n branch_protection_rule:\n types: [123, deleted]",
err: "key \"branch_protection_rule\".\"types\" index 0 had unexpected type int; a string was expected but was 123",
},
{
input: "on:\n project:\n types: [created, deleted]\n milestone:\n types: [opened, deleted]",
result: []*Event{
@ -189,6 +210,22 @@ func TestParseRawOn(t *testing.T) {
},
},
},
{
input: "on:\n schedule2:\n - cron: '20 6 * * *'",
err: "key \"schedule2\" had an type []interface {}; only the 'schedule' key is expected with this type",
},
{
input: "on:\n schedule:\n - 123",
err: "key \"schedule\"[0] had unexpected type int; a map with a key \"cron\" was expected, but value was 123",
},
{
input: "on:\n schedule:\n - corn: '20 6 * * *'",
err: "key \"schedule\"[0] had unexpected key \"corn\"; \"cron\" was expected",
},
{
input: "on:\n schedule:\n - cron: 123",
err: "key \"schedule\"[0].\"cron\" had unexpected type int; a string was expected by was 123",
},
{
input: `
on:
@ -222,15 +259,37 @@ on:
},
},
},
{
input: `
on:
workflow_call:
mistake:
access-token:
description: 'A token passed from the caller workflow'
required: false
`,
err: "invalid value on key \"workflow_call\": workflow_call only supports keys \"inputs\" and \"outputs\", but key \"mistake\" was found",
},
{
input: `
on:
workflow_call: { map: 123 }
`,
err: "key \"workflow_call\".\"map\" had unexpected type int; was 123",
},
}
for _, kase := range kases {
t.Run(kase.input, func(t *testing.T) {
origin, err := model.ReadWorkflow(strings.NewReader(kase.input), false)
assert.NoError(t, err)
require.NoError(t, err)
events, err := ParseRawOn(&origin.RawOn)
if kase.err != "" {
assert.ErrorContains(t, err, kase.err)
} else {
assert.NoError(t, err)
assert.EqualValues(t, kase.result, events, fmt.Sprintf("%#v", events))
}
})
}
}
@ -345,6 +404,7 @@ func TestEvaluateConcurrency(t *testing.T) {
name string
input model.RawConcurrency
group string
cancelInProgressNil bool
cancelInProgress bool
}{
{
@ -360,7 +420,7 @@ func TestEvaluateConcurrency(t *testing.T) {
name: "undefined",
input: model.RawConcurrency{},
group: "",
cancelInProgress: false,
cancelInProgressNil: true,
},
{
name: "group-evaluation",
@ -368,7 +428,7 @@ func TestEvaluateConcurrency(t *testing.T) {
Group: "${{ github.workflow }}-${{ github.ref }}",
},
group: "test_workflow-main",
cancelInProgress: false,
cancelInProgressNil: true,
},
{
name: "cancel-evaluation-true",
@ -394,7 +454,7 @@ func TestEvaluateConcurrency(t *testing.T) {
Group: "user-${{ github.event.commits[0].author.username }}",
},
group: "user-someone",
cancelInProgress: false,
cancelInProgressNil: true,
},
{
name: "arbitrary-var",
@ -402,7 +462,7 @@ func TestEvaluateConcurrency(t *testing.T) {
Group: "${{ vars.eval_arbitrary_var }}",
},
group: "123",
cancelInProgress: false,
cancelInProgressNil: true,
},
{
name: "arbitrary-input",
@ -410,20 +470,27 @@ func TestEvaluateConcurrency(t *testing.T) {
Group: "${{ inputs.eval_arbitrary_input }}",
},
group: "456",
cancelInProgress: false,
cancelInProgressNil: true,
},
{
name: "cancel-in-progress-only",
input: model.RawConcurrency{
CancelInProgress: "true",
},
group: "",
cancelInProgress: true,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
group, cancelInProgress, err := EvaluateConcurrency(
group, cancelInProgress, err := EvaluateWorkflowConcurrency(
&test.input,
"job-id",
nil, // job
map[string]any{
"workflow": "test_workflow",
"ref": "main",
"event": map[string]any{
// gitCtx
&model.GithubContext{
Workflow: "test_workflow",
Ref: "main",
Event: map[string]any{
"commits": []any{
map[string]any{
"author": map[string]any{
@ -437,20 +504,24 @@ func TestEvaluateConcurrency(t *testing.T) {
},
},
},
}, // gitCtx
map[string]*JobResult{
"job-id": {},
}, // results
},
// vars
map[string]string{
"eval_arbitrary_var": "123",
}, // vars
},
// inputs
map[string]any{
"eval_arbitrary_input": "456",
}, // inputs
},
)
assert.NoError(t, err)
assert.EqualValues(t, test.group, group)
assert.EqualValues(t, test.cancelInProgress, cancelInProgress)
if test.cancelInProgressNil {
assert.Nil(t, cancelInProgress)
} else {
require.NotNil(t, cancelInProgress)
assert.EqualValues(t, test.cancelInProgress, *cancelInProgress)
}
})
}
}

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/require"
)

View file

@ -5,7 +5,7 @@ import (
"io"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/schema"
"code.forgejo.org/forgejo/runner/v11/act/schema"
"go.yaml.in/yaml/v3"
)

View file

@ -5,8 +5,8 @@ import (
"fmt"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/common/git"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common/git"
)
type GithubContext struct {

View file

@ -13,8 +13,8 @@ import (
"strings"
"sync"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/schema"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/schema"
log "github.com/sirupsen/logrus"
"go.yaml.in/yaml/v3"
)

View file

@ -16,9 +16,9 @@ import (
"github.com/kballard/go-shellquote"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
type actionStep interface {

View file

@ -18,7 +18,7 @@ import (
"github.com/go-git/go-git/v5/plumbing/transport"
"github.com/go-git/go-git/v5/plumbing/transport/http"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
)
type ActionCache interface {

View file

@ -6,8 +6,8 @@ import (
"regexp"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
func evaluateCompositeInputAndEnv(ctx context.Context, parent *RunContext, step actionStep) map[string]string {

View file

@ -7,7 +7,7 @@ import (
"strings"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)

View file

@ -5,7 +5,7 @@ import (
"regexp"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/sirupsen/logrus"
)

View file

@ -9,8 +9,8 @@ import (
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
func TestCommandSetEnv(t *testing.T) {

View file

@ -4,8 +4,8 @@ import (
"context"
"io"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"github.com/stretchr/testify/mock"
)

View file

@ -13,10 +13,10 @@ import (
_ "embed"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/exprparser"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/exprparser"
"code.forgejo.org/forgejo/runner/v11/act/model"
"go.yaml.in/yaml/v3"
)
@ -479,8 +479,6 @@ func rewriteSubExpression(ctx context.Context, in string, forceFormat bool) (str
func getEvaluatorInputs(ctx context.Context, rc *RunContext, step step, ghc *model.GithubContext) map[string]any {
inputs := map[string]any{}
setupWorkflowInputs(ctx, &inputs, rc)
var env map[string]string
if step != nil {
env = *step.getEnv()
@ -494,6 +492,8 @@ func getEvaluatorInputs(ctx context.Context, rc *RunContext, step step, ghc *mod
}
}
setupWorkflowInputs(ctx, &inputs, rc)
if rc.caller == nil && ghc.EventName == "workflow_dispatch" {
config := rc.Run.Workflow.WorkflowDispatchConfig()
if config != nil && config.Inputs != nil {

View file

@ -3,8 +3,8 @@ package runner
import (
"testing"
"code.forgejo.org/forgejo/runner/v9/act/exprparser"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/exprparser"
"code.forgejo.org/forgejo/runner/v11/act/model"
assert "github.com/stretchr/testify/assert"
yaml "go.yaml.in/yaml/v3"
)

View file

@ -5,9 +5,10 @@ import (
"fmt"
"time"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/sirupsen/logrus"
)
type jobInfo interface {
@ -104,17 +105,20 @@ func newJobExecutor(info jobInfo, sf stepFactory, rc *RunContext) common.Executo
}
}
postExecutor = postExecutor.Finally(func(ctx context.Context) error {
setJobResults := func(ctx context.Context) error {
jobError := common.JobError(ctx)
// Fresh context to ensure job result output works even if prev. context was a cancelled job
ctx, cancel := context.WithTimeout(common.WithLogger(context.Background(), common.Logger(ctx)), time.Minute)
defer cancel()
setJobResult(ctx, info, rc, jobError == nil)
setJobOutputs(ctx, rc)
return nil
}
cleanupJob := func(_ context.Context) error {
var err error
{
// Separate timeout for cleanup tasks; logger is cleared so that cleanup logs go to runner, not job
ctx, cancel := context.WithTimeout(context.Background(), cleanupTimeout)
defer cancel()
@ -132,9 +136,9 @@ func newJobExecutor(info jobInfo, sf stepFactory, rc *RunContext) common.Executo
logger.Errorf("Error while cleaning network %s: %v", networkName, err)
}
}
}
return err
})
}
pipeline := make([]common.Executor, 0)
pipeline = append(pipeline, preSteps...)
@ -152,6 +156,8 @@ func newJobExecutor(info jobInfo, sf stepFactory, rc *RunContext) common.Executo
return postExecutor(ctx)
}).
Finally(info.interpolateOutputs()).
Finally(setJobResults).
Finally(cleanupJob).
Finally(info.closeContainer()))
}
@ -174,33 +180,42 @@ func setJobResult(ctx context.Context, info jobInfo, rc *RunContext, success boo
jobResult = "failure"
}
// Set local result on current job (child or parent)
info.result(jobResult)
if rc.caller != nil {
// set reusable workflow job result
// Child reusable workflow:
// 1) propagate result to parent job state
rc.caller.runContext.result(jobResult)
// 2) copy workflow_call outputs from child to parent (as in upstream)
jobOutputs := make(map[string]string)
ee := rc.NewExpressionEvaluator(ctx)
if wfcc := rc.Run.Workflow.WorkflowCallConfig(); wfcc != nil {
for k, v := range wfcc.Outputs {
jobOutputs[k] = ee.Interpolate(ctx, ee.Interpolate(ctx, v.Value))
}
}
rc.caller.runContext.Run.Job().Outputs = jobOutputs
// 3) DO NOT print banner in child job (prevents premature token revocation)
logger.Debugf("Reusable job result=%s (parent will finalize, no banner)", jobResult)
return
}
// Parent job: print the final banner ONCE (job-level)
jobResultMessage := "succeeded"
if jobResult != "success" {
jobResultMessage = "failed"
}
jobOutputs := rc.Run.Job().Outputs
logger.WithField("jobResult", jobResult).Infof("\U0001F3C1 Job %s", jobResultMessage)
}
func setJobOutputs(ctx context.Context, rc *RunContext) {
if rc.caller != nil {
// map outputs for reusable workflows
callerOutputs := make(map[string]string)
ee := rc.NewExpressionEvaluator(ctx)
for k, v := range rc.Run.Workflow.WorkflowCallConfig().Outputs {
callerOutputs[k] = ee.Interpolate(ctx, ee.Interpolate(ctx, v.Value))
}
rc.caller.runContext.Run.Job().Outputs = callerOutputs
}
logger.
WithFields(logrus.Fields{
"jobResult": jobResult,
"jobOutputs": jobOutputs,
}).
Infof("\U0001F3C1 Job %s", jobResultMessage)
}
func useStepLogger(rc *RunContext, stepModel *model.Step, stage stepStage, executor common.Executor) common.Executor {

View file

@ -9,13 +9,17 @@ import (
"testing"
"time"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/model"
"code.forgejo.org/forgejo/runner/v11/act/runner/mocks"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
//go:generate mockery --srcpkg=github.com/sirupsen/logrus --name=FieldLogger
func TestJobExecutor(t *testing.T) {
tables := []TestJobFileInfo{
{workdir, "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, secrets},
@ -127,8 +131,9 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
executedSteps: []string{
"startContainer",
"step1",
"stopContainer",
"interpolateOutputs",
"setJobResults",
"stopContainer",
"closeContainer",
},
result: "success",
@ -144,8 +149,9 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
executedSteps: []string{
"startContainer",
"step1",
"stopContainer",
"interpolateOutputs",
"setJobResults",
"stopContainer",
"closeContainer",
},
result: "failure",
@ -162,8 +168,9 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
"startContainer",
"pre1",
"step1",
"stopContainer",
"interpolateOutputs",
"setJobResults",
"stopContainer",
"closeContainer",
},
result: "success",
@ -180,8 +187,9 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
"startContainer",
"step1",
"post1",
"stopContainer",
"interpolateOutputs",
"setJobResults",
"stopContainer",
"closeContainer",
},
result: "success",
@ -199,8 +207,9 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
"pre1",
"step1",
"post1",
"stopContainer",
"interpolateOutputs",
"setJobResults",
"stopContainer",
"closeContainer",
},
result: "success",
@ -229,8 +238,9 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
"step3",
"post3",
"post2",
"stopContainer",
"interpolateOutputs",
"setJobResults",
"stopContainer",
"closeContainer",
},
result: "success",
@ -246,7 +256,27 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
fmt.Printf("::group::%s\n", tt.name)
ctx := common.WithJobErrorContainer(t.Context())
executorOrder := make([]string, 0)
mockLogger := mocks.NewFieldLogger(t)
mockLogger.On("Debugf", mock.Anything, mock.Anything).Return(0).Maybe()
mockLogger.On("Warningf", mock.Anything, mock.Anything).Return(0).Maybe()
mockLogger.On("WithField", mock.Anything, mock.Anything).Return(&logrus.Entry{Logger: &logrus.Logger{}}).Maybe()
// When `WithFields()` is called with jobResult & jobOutputs field, add `setJobResults` to executorOrder.
mockLogger.On("WithFields",
mock.MatchedBy(func(fields logrus.Fields) bool {
_, okJobResult := fields["jobResult"]
_, okJobOutput := fields["jobOutputs"]
return okJobOutput && okJobResult
})).
Run(func(args mock.Arguments) {
executorOrder = append(executorOrder, "setJobResults")
}).
Return(&logrus.Entry{Logger: &logrus.Logger{}}).Maybe()
mockLogger.On("WithFields", mock.Anything).Return(&logrus.Entry{Logger: &logrus.Logger{}}).Maybe()
ctx := common.WithLogger(common.WithJobErrorContainer(t.Context()), mockLogger)
jim := &jobInfoMock{}
sfm := &stepFactoryMock{}
rc := &RunContext{
@ -262,7 +292,6 @@ func TestJobExecutorNewJobExecutor(t *testing.T) {
Config: &Config{},
}
rc.ExprEval = rc.NewExpressionEvaluator(ctx)
executorOrder := make([]string, 0)
jim.On("steps").Return(tt.steps)
@ -415,3 +444,76 @@ func TestSetJobResultConcurrency(t *testing.T) {
assert.Equal(t, "failure", lastResult)
}
func TestSetJobResult_SkipsBannerInChildReusableWorkflow(t *testing.T) {
// Test that child reusable workflow does not print final banner
// to prevent premature token revocation
mockLogger := mocks.NewFieldLogger(t)
// Allow all variants of Debugf (git operations can call with 1-3 args)
mockLogger.On("Debugf", mock.Anything).Return(0).Maybe()
mockLogger.On("Debugf", mock.Anything, mock.Anything).Return(0).Maybe()
mockLogger.On("Debugf", mock.Anything, mock.Anything, mock.Anything).Return(0).Maybe()
// CRITICAL: In CI, git ref detection may fail and call Warningf
mockLogger.On("Warningf", mock.Anything, mock.Anything).Return(0).Maybe()
mockLogger.On("WithField", mock.Anything, mock.Anything).Return(&logrus.Entry{Logger: &logrus.Logger{}}).Maybe()
mockLogger.On("WithFields", mock.Anything).Return(&logrus.Entry{Logger: &logrus.Logger{}}).Maybe()
ctx := common.WithLogger(common.WithJobErrorContainer(t.Context()), mockLogger)
// Setup parent job
parentJob := &model.Job{
Result: "success",
}
parentRC := &RunContext{
Config: &Config{Env: map[string]string{}}, // Must have Config
Run: &model.Run{
JobID: "parent",
Workflow: &model.Workflow{
Jobs: map[string]*model.Job{
"parent": parentJob,
},
},
},
}
// Setup child job with caller reference
childJob := &model.Job{
Result: "success",
}
childRC := &RunContext{
Config: &Config{Env: map[string]string{}}, // Must have Config
Run: &model.Run{
JobID: "child",
Workflow: &model.Workflow{
Jobs: map[string]*model.Job{
"child": childJob,
},
},
},
caller: &caller{
runContext: parentRC,
},
}
jim := &jobInfoMock{}
jim.On("matrix").Return(map[string]any{}) // REQUIRED: setJobResult always calls matrix()
jim.On("result", "success")
// Call setJobResult for child workflow
setJobResult(ctx, jim, childRC, true)
// Verify:
// 1. Child result is set
jim.AssertCalled(t, "result", "success")
// 2. Parent result is propagated
assert.Equal(t, "success", parentJob.Result)
// 3. Final banner was NOT printed by child (critical for token security)
mockLogger.AssertNotCalled(t, "WithFields", mock.MatchedBy(func(fields logrus.Fields) bool {
_, okJobResult := fields["jobResult"]
_, okJobOutput := fields["jobOutputs"]
return okJobOutput && okJobResult
}))
}

View file

@ -12,7 +12,7 @@ import (
"path/filepath"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/filecollector"
"code.forgejo.org/forgejo/runner/v11/act/filecollector"
)
type LocalRepositoryCache struct {

View file

@ -10,7 +10,7 @@ import (
"strings"
"sync"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/sirupsen/logrus"
"golang.org/x/term"
@ -146,6 +146,26 @@ func WithCompositeStepLogger(ctx context.Context, stepID string) context.Context
}).WithContext(ctx))
}
func GetOuterStepResult(entry *logrus.Entry) any {
r, ok := entry.Data["stepResult"]
if !ok {
return nil
}
// composite actions steps log with a list of stepID
if s, ok := entry.Data["stepID"]; ok {
if stepIDs, ok := s.([]string); ok {
if len(stepIDs) > 1 {
return nil
}
}
} else {
return nil
}
return r
}
func withStepLogger(ctx context.Context, stepNumber int, stepID, stepName, stageName string) context.Context {
rtn := common.Logger(ctx).WithFields(logrus.Fields{
"stepNumber": stepNumber,

63
act/runner/logger_test.go Normal file
View file

@ -0,0 +1,63 @@
package runner
import (
"testing"
"code.forgejo.org/forgejo/runner/v11/act/common"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestRunner_GetOuterStepResult(t *testing.T) {
nullLogger, hook := test.NewNullLogger()
ctx := common.WithLogger(t.Context(), nullLogger)
t.Run("no stepResult", func(t *testing.T) {
hook.Reset()
common.Logger(ctx).Info("✅ Success")
entry := hook.LastEntry()
require.NotNil(t, entry)
assert.Nil(t, GetOuterStepResult(entry))
})
t.Run("stepResult and no stepID", func(t *testing.T) {
hook.Reset()
common.Logger(ctx).WithField("stepResult", "success").Info("✅ Success")
entry := hook.LastEntry()
require.NotNil(t, entry)
assert.Nil(t, GetOuterStepResult(entry))
})
stepNumber := 123
stepID := "step id"
stepName := "readable name"
stageName := "Main"
ctx = withStepLogger(ctx, stepNumber, stepID, stepName, stageName)
t.Run("stepResult and stepID", func(t *testing.T) {
hook.Reset()
common.Logger(ctx).WithField("stepResult", "success").Info("✅ Success")
entry := hook.LastEntry()
actualStepIDs, ok := entry.Data["stepID"]
require.True(t, ok)
require.Equal(t, []string{stepID}, actualStepIDs)
require.NotNil(t, entry)
assert.Equal(t, "success", GetOuterStepResult(entry))
})
compositeStepID := "composite step id"
ctx = WithCompositeStepLogger(ctx, compositeStepID)
t.Run("stepResult and composite stepID", func(t *testing.T) {
hook.Reset()
common.Logger(ctx).WithField("stepResult", "success").Info("✅ Success")
entry := hook.LastEntry()
actualStepIDs, ok := entry.Data["stepID"]
require.True(t, ok)
require.Equal(t, []string{stepID, compositeStepID}, actualStepIDs)
require.NotNil(t, entry)
assert.Nil(t, GetOuterStepResult(entry))
})
}

View file

@ -11,6 +11,8 @@ LXC_IPV6_PREFIX_DEFAULT="fd15"
LXC_DOCKER_PREFIX_DEFAULT="172.17"
LXC_IPV6_DOCKER_PREFIX_DEFAULT="fd00:d0ca"
LXC_APT_TOO_OLD='1 week ago'
: ${LXC_TRANSACTION_TIMEOUT:=600}
LXC_TRANSACTION_LOCK_FILE=/tmp/lxc-helper.lock
: ${LXC_SUDO:=}
: ${LXC_CONTAINER_RELEASE:=bookworm}
@ -28,16 +30,22 @@ function lxc_template_release() {
echo lxc-helpers-$LXC_CONTAINER_RELEASE
}
function lxc_directory() {
local name="$1"
echo /var/lib/lxc/$name
}
function lxc_root() {
local name="$1"
echo /var/lib/lxc/$name/rootfs
echo $(lxc_directory $name)/rootfs
}
function lxc_config() {
local name="$1"
echo /var/lib/lxc/$name/config
echo $(lxc_directory $name)/config
}
function lxc_container_run() {
@ -47,6 +55,42 @@ function lxc_container_run() {
$LXC_SUDO lxc-attach --clear-env --name $name -- "$@"
}
function lxc_transaction_lock() {
exec 7>$LXC_TRANSACTION_LOCK_FILE
flock --timeout $LXC_TRANSACTION_TIMEOUT 7
}
function lxc_transaction_unlock() {
exec 7>&-
}
function lxc_transaction_draft_name() {
echo "lxc-helper-draft"
}
function lxc_transaction_begin() {
local name=$1 # not actually used but it helps when reading in the caller
local draft=$(lxc_transaction_draft_name)
lxc_transaction_lock
lxc_container_destroy $draft
}
function lxc_transaction_commit() {
local name=$1
local draft=$(lxc_transaction_draft_name)
# do not use lxc-copy because it is not atomic if lxc-copy is
# interrupted it may leave the $name container half populated
$LXC_SUDO sed -i -e "s/$draft/$name/g" \
$(lxc_config $draft) \
$(lxc_root $draft)/etc/hosts \
$(lxc_root $draft)/etc/hostname
$LXC_SUDO rm -f $(lxc_root $draft)/var/lib/dhcp/dhclient.*
$LXC_SUDO mv $(lxc_directory $draft) $(lxc_directory $name)
lxc_transaction_unlock
}
function lxc_container_run_script_as() {
local name="$1"
local user="$2"
@ -242,7 +286,7 @@ function lxc_container_configure() {
function lxc_container_install_lxc_helpers() {
local name="$1"
$LXC_SUDO cp -a $LXC_SELF_DIR/lxc-helpers*.sh $root/$LXC_BIN
$LXC_SUDO cp -a $LXC_SELF_DIR/lxc-helpers*.sh $(lxc_root $name)/$LXC_BIN
#
# Wait for the network to come up
#
@ -304,10 +348,9 @@ function lxc_container_stop() {
function lxc_container_destroy() {
local name="$1"
local root="$2"
if lxc_exists "$name"; then
lxc_container_stop $name $root
lxc_container_stop $name
$LXC_SUDO lxc-destroy --force --name="$name"
fi
}
@ -342,36 +385,44 @@ function lxc_running() {
function lxc_build_template_release() {
local name="$(lxc_template_release)"
lxc_transaction_begin $name
if lxc_exists_and_apt_not_old $name; then
lxc_transaction_unlock
return
fi
local root=$(lxc_root $name)
$LXC_SUDO lxc-create --name $name --template debian -- --release=$LXC_CONTAINER_RELEASE
echo 'lxc.apparmor.profile = unconfined' | $LXC_SUDO tee -a $(lxc_config $name)
lxc_container_install_lxc_helpers $name
lxc_container_start $name
lxc_container_run $name apt-get update -qq
lxc_apt_install $name sudo git python3
lxc_container_stop $name
local draft=$(lxc_transaction_draft_name)
$LXC_SUDO lxc-create --name $draft --template debian -- --release=$LXC_CONTAINER_RELEASE
echo 'lxc.apparmor.profile = unconfined' | $LXC_SUDO tee -a $(lxc_config $draft)
lxc_container_install_lxc_helpers $draft
lxc_container_start $draft
lxc_container_run $draft apt-get update -qq
lxc_apt_install $draft sudo git python3
lxc_container_stop $draft
lxc_transaction_commit $name
}
function lxc_build_template() {
local name="$1"
local newname="$2"
if lxc_exists_and_apt_not_old $newname; then
return
fi
if test "$name" = "$(lxc_template_release)"; then
lxc_build_template_release
fi
if ! $LXC_SUDO lxc-copy --name=$name --newname=$newname; then
echo lxc-copy --name=$name --newname=$newname failed
lxc_transaction_begin $name
if lxc_exists_and_apt_not_old $newname; then
lxc_transaction_unlock
return
fi
local draft=$(lxc_transaction_draft_name)
if ! $LXC_SUDO lxc-copy --name=$name --newname=$draft; then
echo lxc-copy --name=$name --newname=$draft failed
return 1
fi
lxc_transaction_commit $newname
lxc_container_configure $newname
}
@ -413,7 +464,7 @@ function lxc_install_lxc_inside() {
local prefixv6="${2:-$LXC_IPV6_PREFIX_DEFAULT}"
local packages="make git libvirt0 libpam-cgfs bridge-utils uidmap dnsmasq-base dnsmasq dnsmasq-utils qemu-user-static lxc-templates debootstrap"
if test "$(lxc_release)" = bookworm; then
if test "$(lxc_release)" != bullseye; then
packages="$packages distro-info"
fi

View file

@ -18,11 +18,11 @@ lxc-helpers.sh - LXC container management helpers
SYNOPSIS
lxc-helpers.sh [-v|--verbose] [-h|--help]
[-o|--os {bookworm|bullseye} (default bookworm)]
[-o|--os {trixie|bookworm|bullseye} (default bookworm)]
command [arguments]
lxc-helpers.sh [-v|--verbose] [-h|--help]
[-o|--os {bookworm|bullseye} (default bookworm)]
[-o|--os {trixie|bookworm|bullseye} (default bookworm)]
[-c|--config {unprivileged lxc libvirt docker k8s} (default "lxc libvirt docker")]
lxc_container_create [arguments]

View file

@ -0,0 +1,264 @@
// Code generated by mockery v2.53.5. DO NOT EDIT.
package mocks
import (
logrus "github.com/sirupsen/logrus"
mock "github.com/stretchr/testify/mock"
)
// FieldLogger is an autogenerated mock type for the FieldLogger type
type FieldLogger struct {
mock.Mock
}
// Debug provides a mock function with given fields: args
func (_m *FieldLogger) Debug(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Debugf provides a mock function with given fields: format, args
func (_m *FieldLogger) Debugf(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Debugln provides a mock function with given fields: args
func (_m *FieldLogger) Debugln(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Error provides a mock function with given fields: args
func (_m *FieldLogger) Error(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Errorf provides a mock function with given fields: format, args
func (_m *FieldLogger) Errorf(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Errorln provides a mock function with given fields: args
func (_m *FieldLogger) Errorln(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Fatal provides a mock function with given fields: args
func (_m *FieldLogger) Fatal(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Fatalf provides a mock function with given fields: format, args
func (_m *FieldLogger) Fatalf(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Fatalln provides a mock function with given fields: args
func (_m *FieldLogger) Fatalln(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Info provides a mock function with given fields: args
func (_m *FieldLogger) Info(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Infof provides a mock function with given fields: format, args
func (_m *FieldLogger) Infof(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Infoln provides a mock function with given fields: args
func (_m *FieldLogger) Infoln(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Panic provides a mock function with given fields: args
func (_m *FieldLogger) Panic(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Panicf provides a mock function with given fields: format, args
func (_m *FieldLogger) Panicf(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Panicln provides a mock function with given fields: args
func (_m *FieldLogger) Panicln(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Print provides a mock function with given fields: args
func (_m *FieldLogger) Print(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Printf provides a mock function with given fields: format, args
func (_m *FieldLogger) Printf(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Println provides a mock function with given fields: args
func (_m *FieldLogger) Println(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Warn provides a mock function with given fields: args
func (_m *FieldLogger) Warn(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Warnf provides a mock function with given fields: format, args
func (_m *FieldLogger) Warnf(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Warning provides a mock function with given fields: args
func (_m *FieldLogger) Warning(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Warningf provides a mock function with given fields: format, args
func (_m *FieldLogger) Warningf(format string, args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, format)
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Warningln provides a mock function with given fields: args
func (_m *FieldLogger) Warningln(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// Warnln provides a mock function with given fields: args
func (_m *FieldLogger) Warnln(args ...interface{}) {
var _ca []interface{}
_ca = append(_ca, args...)
_m.Called(_ca...)
}
// WithError provides a mock function with given fields: err
func (_m *FieldLogger) WithError(err error) *logrus.Entry {
ret := _m.Called(err)
if len(ret) == 0 {
panic("no return value specified for WithError")
}
var r0 *logrus.Entry
if rf, ok := ret.Get(0).(func(error) *logrus.Entry); ok {
r0 = rf(err)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*logrus.Entry)
}
}
return r0
}
// WithField provides a mock function with given fields: key, value
func (_m *FieldLogger) WithField(key string, value interface{}) *logrus.Entry {
ret := _m.Called(key, value)
if len(ret) == 0 {
panic("no return value specified for WithField")
}
var r0 *logrus.Entry
if rf, ok := ret.Get(0).(func(string, interface{}) *logrus.Entry); ok {
r0 = rf(key, value)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*logrus.Entry)
}
}
return r0
}
// WithFields provides a mock function with given fields: fields
func (_m *FieldLogger) WithFields(fields logrus.Fields) *logrus.Entry {
ret := _m.Called(fields)
if len(ret) == 0 {
panic("no return value specified for WithFields")
}
var r0 *logrus.Entry
if rf, ok := ret.Get(0).(func(logrus.Fields) *logrus.Entry); ok {
r0 = rf(fields)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*logrus.Entry)
}
}
return r0
}
// NewFieldLogger creates a new instance of FieldLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewFieldLogger(t interface {
mock.TestingT
Cleanup(func())
},
) *FieldLogger {
mock := &FieldLogger{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View file

@ -13,9 +13,10 @@ import (
"strings"
"sync"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/common/git"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common/git"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/sirupsen/logrus"
)
func newLocalReusableWorkflowExecutor(rc *RunContext) common.Executor {
@ -115,7 +116,10 @@ func newActionCacheReusableWorkflowExecutor(rc *RunContext, filename string, rem
return err
}
return runner.NewPlanExecutor(plan)(ctx)
planErr := runner.NewPlanExecutor(plan)(ctx)
// Finalize from parent context: one job-level banner
return finalizeReusableWorkflow(ctx, rc, planErr)
}
}
@ -171,7 +175,10 @@ func newReusableWorkflowExecutor(rc *RunContext, directory, workflow string) com
return err
}
return runner.NewPlanExecutor(plan)(ctx)
planErr := runner.NewPlanExecutor(plan)(ctx)
// Finalize from parent context: one job-level banner
return finalizeReusableWorkflow(ctx, rc, planErr)
}
}
@ -229,3 +236,29 @@ func newRemoteReusableWorkflowWithPlat(url, uses string) *remoteReusableWorkflow
URL: url,
}
}
// finalizeReusableWorkflow prints the final job banner from the parent job context.
//
// The Forgejo reporter waits for this banner (log entry with "jobResult"
// field and without stage="Main") before marking the job as complete and revoking
// tokens. Printing this banner from the child reusable workflow would cause
// premature token revocation, breaking subsequent steps in the parent workflow.
func finalizeReusableWorkflow(ctx context.Context, rc *RunContext, planErr error) error {
jobResult := "success"
jobResultMessage := "succeeded"
if planErr != nil {
jobResult = "failure"
jobResultMessage = "failed"
}
// Outputs should already be present in the parent context:
// - copied by child's setJobResult branch (rc.caller != nil)
jobOutputs := rc.Run.Job().Outputs
common.Logger(ctx).WithFields(logrus.Fields{
"jobResult": jobResult,
"jobOutputs": jobOutputs,
}).Infof("\U0001F3C1 Job %s", jobResultMessage)
return planErr
}

View file

@ -0,0 +1,247 @@
package runner
import (
"errors"
"testing"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
"code.forgejo.org/forgejo/runner/v11/act/runner/mocks"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestConfig_GetToken(t *testing.T) {
t.Run("returns GITEA_TOKEN when both GITEA_TOKEN and GITHUB_TOKEN present", func(t *testing.T) {
c := &Config{
Secrets: map[string]string{
"GITHUB_TOKEN": "github-token",
"GITEA_TOKEN": "gitea-token",
},
}
assert.Equal(t, "gitea-token", c.GetToken())
})
t.Run("returns GITHUB_TOKEN when only GITHUB_TOKEN present", func(t *testing.T) {
c := &Config{
Secrets: map[string]string{
"GITHUB_TOKEN": "github-token",
},
}
assert.Equal(t, "github-token", c.GetToken())
})
t.Run("returns empty string when no tokens present", func(t *testing.T) {
c := &Config{
Secrets: map[string]string{},
}
assert.Equal(t, "", c.GetToken())
})
t.Run("returns empty string when Secrets is nil", func(t *testing.T) {
c := &Config{}
assert.Equal(t, "", c.GetToken())
})
}
func TestRemoteReusableWorkflow_CloneURL(t *testing.T) {
t.Run("adds https prefix when missing", func(t *testing.T) {
rw := &remoteReusableWorkflow{
URL: "code.forgejo.org",
Org: "owner",
Repo: "repo",
}
assert.Equal(t, "https://code.forgejo.org/owner/repo", rw.CloneURL())
})
t.Run("preserves https prefix", func(t *testing.T) {
rw := &remoteReusableWorkflow{
URL: "https://code.forgejo.org",
Org: "owner",
Repo: "repo",
}
assert.Equal(t, "https://code.forgejo.org/owner/repo", rw.CloneURL())
})
t.Run("preserves http prefix", func(t *testing.T) {
rw := &remoteReusableWorkflow{
URL: "http://localhost:3000",
Org: "owner",
Repo: "repo",
}
assert.Equal(t, "http://localhost:3000/owner/repo", rw.CloneURL())
})
}
func TestRemoteReusableWorkflow_FilePath(t *testing.T) {
tests := []struct {
name string
gitPlatform string
filename string
expectedPath string
}{
{
name: "github platform",
gitPlatform: "github",
filename: "test.yml",
expectedPath: "./.github/workflows/test.yml",
},
{
name: "gitea platform",
gitPlatform: "gitea",
filename: "build.yaml",
expectedPath: "./.gitea/workflows/build.yaml",
},
{
name: "forgejo platform",
gitPlatform: "forgejo",
filename: "deploy.yml",
expectedPath: "./.forgejo/workflows/deploy.yml",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
rw := &remoteReusableWorkflow{
GitPlatform: tt.gitPlatform,
Filename: tt.filename,
}
assert.Equal(t, tt.expectedPath, rw.FilePath())
})
}
}
func TestNewRemoteReusableWorkflowWithPlat(t *testing.T) {
tests := []struct {
name string
url string
uses string
expectedOrg string
expectedRepo string
expectedPlatform string
expectedFilename string
expectedRef string
shouldFail bool
}{
{
name: "valid github workflow",
url: "github.com",
uses: "owner/repo/.github/workflows/test.yml@main",
expectedOrg: "owner",
expectedRepo: "repo",
expectedPlatform: "github",
expectedFilename: "test.yml",
expectedRef: "main",
shouldFail: false,
},
{
name: "valid gitea workflow",
url: "code.forgejo.org",
uses: "forgejo/runner/.gitea/workflows/build.yaml@v1.0.0",
expectedOrg: "forgejo",
expectedRepo: "runner",
expectedPlatform: "gitea",
expectedFilename: "build.yaml",
expectedRef: "v1.0.0",
shouldFail: false,
},
{
name: "invalid format - missing platform",
url: "github.com",
uses: "owner/repo/workflows/test.yml@main",
shouldFail: true,
},
{
name: "invalid format - no ref",
url: "github.com",
uses: "owner/repo/.github/workflows/test.yml",
shouldFail: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := newRemoteReusableWorkflowWithPlat(tt.url, tt.uses)
if tt.shouldFail {
assert.Nil(t, result)
} else {
assert.NotNil(t, result)
assert.Equal(t, tt.expectedOrg, result.Org)
assert.Equal(t, tt.expectedRepo, result.Repo)
assert.Equal(t, tt.expectedPlatform, result.GitPlatform)
assert.Equal(t, tt.expectedFilename, result.Filename)
assert.Equal(t, tt.expectedRef, result.Ref)
assert.Equal(t, tt.url, result.URL)
}
})
}
}
func TestFinalizeReusableWorkflow_PrintsBannerSuccess(t *testing.T) {
mockLogger := mocks.NewFieldLogger(t)
bannerCalled := false
mockLogger.On("WithFields",
mock.MatchedBy(func(fields logrus.Fields) bool {
result, ok := fields["jobResult"].(string)
if !ok || result != "success" {
return false
}
outs, ok := fields["jobOutputs"].(map[string]string)
return ok && outs["foo"] == "bar"
}),
).Run(func(args mock.Arguments) {
bannerCalled = true
}).Return(&logrus.Entry{Logger: &logrus.Logger{}}).Once()
ctx := common.WithLogger(t.Context(), mockLogger)
rc := &RunContext{
Run: &model.Run{
JobID: "parent",
Workflow: &model.Workflow{
Jobs: map[string]*model.Job{
"parent": {
Outputs: map[string]string{"foo": "bar"},
},
},
},
},
}
err := finalizeReusableWorkflow(ctx, rc, nil)
assert.NoError(t, err)
assert.True(t, bannerCalled, "final banner should be printed from parent")
}
func TestFinalizeReusableWorkflow_PrintsBannerFailure(t *testing.T) {
mockLogger := mocks.NewFieldLogger(t)
bannerCalled := false
mockLogger.On("WithFields",
mock.MatchedBy(func(fields logrus.Fields) bool {
result, ok := fields["jobResult"].(string)
return ok && result == "failure"
}),
).Run(func(args mock.Arguments) {
bannerCalled = true
}).Return(&logrus.Entry{Logger: &logrus.Logger{}}).Once()
ctx := common.WithLogger(t.Context(), mockLogger)
rc := &RunContext{
Run: &model.Run{
JobID: "parent",
Workflow: &model.Workflow{
Jobs: map[string]*model.Job{
"parent": {},
},
},
},
}
planErr := errors.New("workflow failed")
err := finalizeReusableWorkflow(ctx, rc, planErr)
assert.EqualError(t, err, "workflow failed")
assert.True(t, bannerCalled, "banner should be printed even on failure")
}

View file

@ -21,10 +21,10 @@ import (
"text/template"
"time"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/exprparser"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/exprparser"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/docker/docker/api/types/network"
"github.com/docker/go-connections/nat"
"github.com/opencontainers/selinux/go-selinux"
@ -248,12 +248,18 @@ var stopTemplate = template.Must(template.New("stop").Parse(`#!/bin/bash
source $(dirname $0)/lxc-helpers-lib.sh
lxc_container_destroy "{{.Name}}"
lxc_maybe_sudo
$LXC_SUDO rm -fr "{{ .Root }}"
`))
func (rc *RunContext) stopHostEnvironment(ctx context.Context) error {
logger := common.Logger(ctx)
logger.Debugf("stopHostEnvironment")
if !rc.IsLXCHostEnv(ctx) {
return nil
}
var stopScript bytes.Buffer
if err := stopTemplate.Execute(&stopScript, struct {
Name string
@ -310,13 +316,18 @@ func (rc *RunContext) startHostEnvironment() common.Executor {
ToolCache: rc.getToolCache(ctx),
Workdir: rc.Config.Workdir,
ActPath: actPath,
CleanUp: func() {
os.RemoveAll(miscpath)
},
StdOut: logWriter,
LXC: rc.IsLXCHostEnv(ctx),
}
rc.cleanUpJobContainer = rc.JobContainer.Remove()
rc.cleanUpJobContainer = func(ctx context.Context) error {
if err := rc.stopHostEnvironment(ctx); err != nil {
return err
}
if rc.JobContainer == nil {
return nil
}
return rc.JobContainer.Remove()(ctx)
}
for k, v := range rc.JobContainer.GetRunnerContext(ctx) {
if v, ok := v.(string); ok {
rc.Env[fmt.Sprintf("RUNNER_%s", strings.ToUpper(k))] = v
@ -890,9 +901,6 @@ func (rc *RunContext) IsHostEnv(ctx context.Context) bool {
func (rc *RunContext) stopContainer() common.Executor {
return func(ctx context.Context) error {
if rc.IsLXCHostEnv(ctx) {
return rc.stopHostEnvironment(ctx)
}
return rc.stopJobContainer()(ctx)
}
}
@ -900,9 +908,6 @@ func (rc *RunContext) stopContainer() common.Executor {
func (rc *RunContext) closeContainer() common.Executor {
return func(ctx context.Context) error {
if rc.JobContainer != nil {
if rc.IsLXCHostEnv(ctx) {
return rc.stopHostEnvironment(ctx)
}
return rc.JobContainer.Close()(ctx)
}
return nil
@ -943,7 +948,10 @@ func (rc *RunContext) Executor() (common.Executor, error) {
return err
}
if res {
return executor(ctx)
timeoutctx, cancelTimeOut := evaluateTimeout(ctx, "job", rc.ExprEval, rc.Run.Job().TimeoutMinutes)
defer cancelTimeOut()
return executor(timeoutctx)
}
return nil
}, nil
@ -1202,7 +1210,7 @@ func (rc *RunContext) getGithubContext(ctx context.Context) *model.GithubContext
ghc.RetentionDays = preset.RetentionDays
instance := rc.Config.GitHubInstance
if !strings.HasPrefix(instance, "http://") &&
if instance != "" && !strings.HasPrefix(instance, "http://") &&
!strings.HasPrefix(instance, "https://") {
instance = "https://" + instance
}
@ -1245,7 +1253,7 @@ func (rc *RunContext) getGithubContext(ctx context.Context) *model.GithubContext
{ // Adapt to Gitea
instance := rc.Config.GitHubInstance
if !strings.HasPrefix(instance, "http://") &&
if instance != "" && !strings.HasPrefix(instance, "http://") &&
!strings.HasPrefix(instance, "https://") {
instance = "https://" + instance
}
@ -1347,16 +1355,6 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
set("SERVER_URL", github.ServerURL)
set("API_URL", github.APIURL)
{ // Adapt to Forgejo
instance := rc.Config.GitHubInstance
if !strings.HasPrefix(instance, "http://") &&
!strings.HasPrefix(instance, "https://") {
instance = "https://" + instance
}
set("SERVER_URL", instance)
set("API_URL", instance+"/api/v1")
}
if rc.Config.ArtifactServerPath != "" {
setActionRuntimeVars(rc, env)
}

View file

@ -11,10 +11,10 @@ import (
"testing"
"time"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/exprparser"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v9/testutils"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/exprparser"
"code.forgejo.org/forgejo/runner/v11/act/model"
"code.forgejo.org/forgejo/runner/v11/testutils"
"github.com/docker/go-connections/nat"
log "github.com/sirupsen/logrus"
@ -280,6 +280,39 @@ func TestRunContext_GetBindsAndMounts(t *testing.T) {
})
}
func TestRunContext_GetGithubContextURL(t *testing.T) {
table := []struct {
instance string
serverURL string
APIURL string
}{
{instance: "", serverURL: "", APIURL: "/api/v1"},
{instance: "example.com", serverURL: "https://example.com", APIURL: "https://example.com/api/v1"},
{instance: "http://example.com", serverURL: "http://example.com", APIURL: "http://example.com/api/v1"},
{instance: "https://example.com", serverURL: "https://example.com", APIURL: "https://example.com/api/v1"},
}
for _, data := range table {
t.Run(data.instance, func(t *testing.T) {
rc := &RunContext{
EventJSON: "{}",
Config: &Config{
GitHubInstance: data.instance,
},
Run: &model.Run{
Workflow: &model.Workflow{
Name: "GitHubContextTest",
},
},
}
ghc := rc.getGithubContext(t.Context())
assert.Equal(t, data.serverURL, ghc.ServerURL)
assert.Equal(t, data.APIURL, ghc.APIURL)
})
}
}
func TestRunContext_GetGithubContextRef(t *testing.T) {
table := []struct {
event string

View file

@ -11,8 +11,8 @@ import (
docker_container "github.com/docker/docker/api/types/container"
log "github.com/sirupsen/logrus"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
// Runner provides capabilities to run GitHub actions

View file

@ -18,8 +18,8 @@ import (
"github.com/stretchr/testify/require"
"go.yaml.in/yaml/v3"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
var (
@ -263,6 +263,7 @@ func TestRunner_RunEvent(t *testing.T) {
{workdir, "uses-workflow", "pull_request", "", platforms, map[string]string{"secret": "keep_it_private"}},
{workdir, "uses-docker-url", "push", "", platforms, secrets},
{workdir, "act-composite-env-test", "push", "", platforms, secrets},
{workdir, "uses-workflow-env-input", "push", "", platforms, secrets},
// Eval
{workdir, "evalmatrix", "push", "", platforms, secrets},
@ -272,6 +273,8 @@ func TestRunner_RunEvent(t *testing.T) {
{workdir, "evalmatrix-merge-array", "push", "", platforms, secrets},
{workdir, "basic", "push", "", platforms, secrets},
{workdir, "timeout-minutes-stop", "push", "Job 'check' failed", platforms, secrets},
{workdir, "timeout-minutes-job", "push", "context deadline exceeded", platforms, secrets},
{workdir, "fail", "push", "Job 'build' failed", platforms, secrets},
{workdir, "runs-on", "push", "", platforms, secrets},
{workdir, "checkout", "push", "", platforms, secrets},

View file

@ -12,10 +12,10 @@ import (
"strings"
"time"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/exprparser"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/exprparser"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/sirupsen/logrus"
)
@ -177,7 +177,7 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
Mode: 0o666,
})(ctx)
timeoutctx, cancelTimeOut := evaluateStepTimeout(ctx, rc.ExprEval, stepModel)
timeoutctx, cancelTimeOut := evaluateTimeout(ctx, "step", rc.ExprEval, stepModel.TimeoutMinutes)
defer cancelTimeOut()
err = executor(timeoutctx)
@ -213,12 +213,15 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
}
}
func evaluateStepTimeout(ctx context.Context, exprEval ExpressionEvaluator, stepModel *model.Step) (context.Context, context.CancelFunc) {
timeout := exprEval.Interpolate(ctx, stepModel.TimeoutMinutes)
func evaluateTimeout(ctx context.Context, contextType string, exprEval ExpressionEvaluator, timeoutMinutes string) (context.Context, context.CancelFunc) {
timeout := exprEval.Interpolate(ctx, timeoutMinutes)
if timeout != "" {
if timeOutMinutes, err := strconv.ParseInt(timeout, 10, 64); err == nil {
timeOutMinutes, err := strconv.ParseInt(timeout, 10, 64)
if err == nil {
common.Logger(ctx).Debugf("the %s will stop in timeout-minutes %s", contextType, timeout)
return context.WithTimeout(ctx, time.Duration(timeOutMinutes)*time.Minute)
}
common.Logger(ctx).Errorf("timeout-minutes %s cannot be parsed and will be ignored: %w", timeout, err)
}
return ctx, func() {}
}

View file

@ -11,8 +11,8 @@ import (
"path"
"path/filepath"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
type stepActionLocal struct {

View file

@ -8,8 +8,8 @@ import (
"strings"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"go.yaml.in/yaml/v3"

View file

@ -14,9 +14,9 @@ import (
gogit "github.com/go-git/go-git/v5"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/common/git"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common/git"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
type stepActionRemote struct {

View file

@ -11,9 +11,9 @@ import (
"github.com/stretchr/testify/mock"
"go.yaml.in/yaml/v3"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/common/git"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/common/git"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
type stepActionRemoteMocks struct {

View file

@ -5,9 +5,9 @@ import (
"fmt"
"strings"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/kballard/go-shellquote"
)

View file

@ -6,8 +6,8 @@ import (
"io"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)

View file

@ -3,7 +3,7 @@ package runner
import (
"fmt"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
type stepFactory interface {

View file

@ -3,7 +3,7 @@ package runner
import (
"testing"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/model"
"github.com/stretchr/testify/assert"
)

View file

@ -9,10 +9,10 @@ import (
"github.com/kballard/go-shellquote"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/lookpath"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/lookpath"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
type stepRun struct {

View file

@ -9,8 +9,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"code.forgejo.org/forgejo/runner/v9/act/container"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/container"
"code.forgejo.org/forgejo/runner/v11/act/model"
)
func TestStepRun(t *testing.T) {

View file

@ -4,8 +4,8 @@ import (
"context"
"testing"
"code.forgejo.org/forgejo/runner/v9/act/common"
"code.forgejo.org/forgejo/runner/v9/act/model"
"code.forgejo.org/forgejo/runner/v11/act/common"
"code.forgejo.org/forgejo/runner/v11/act/model"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

View file

@ -0,0 +1,21 @@
name: "use-inputs-impl"
on:
workflow_call:
inputs:
greet_target:
type: string
required: false
default: "Some Default Value"
jobs:
works:
runs-on: ubuntu-latest
env:
MY_INPUT_TEST: ${{ inputs.greet_target }}
INPUT_TEST: ${{ inputs.greet_target }}
INPUT_GREET_TARGET: ${{ inputs.greet_target }}
steps:
- run: '[ "$MY_INPUT_TEST" = "Mona the Octocat" ] || exit 1'
- run: '[ "$INPUT_TEST" = "Mona the Octocat" ] || exit 1'
- run: '[ "$INPUT_GREET_TARGET" = "Mona the Octocat" ] || exit 1'

View file

@ -1,4 +1,4 @@
FROM alpine:3
FROM code.forgejo.org/oci/alpine:latest
COPY entrypoint.sh /entrypoint.sh

View file

@ -18,7 +18,8 @@ jobs:
- run: ls
- run: echo 'hello world'
- run: echo ${GITHUB_SHA} >> $(dirname "${GITHUB_WORKSPACE}")/sha.txt
- run: cat $(dirname "${GITHUB_WORKSPACE}")/sha.txt | grep ${GITHUB_SHA}
- timeout-minutes: 30
run: cat $(dirname "${GITHUB_WORKSPACE}")/sha.txt | grep ${GITHUB_SHA}
build:
runs-on: ubuntu-latest
needs: [check]

View file

@ -0,0 +1,12 @@
name: timeout-minutes
on: push
env:
TIMEOUT_MINUTES: 0
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: ${{ env.TIMEOUT_MINUTES }}
steps:
- run: sleep 10

View file

@ -0,0 +1,12 @@
name: timeout-minutes
on: push
env:
TIMEOUT_MINUTES: 0
jobs:
check:
runs-on: ubuntu-latest
steps:
- timeout-minutes: ${{ env.TIMEOUT_MINUTES }}
run: sleep 10

View file

@ -0,0 +1,8 @@
name: local-action-env-input
on: push
jobs:
test:
runs-on: docker
uses: ./testdata/.github/workflows/local-reusable-env-input.yml
with:
greet_target: 'Mona the Octocat'

View file

@ -157,6 +157,7 @@
"output-value": {
"context": [
"forge",
"forgejo",
"github",
"strategy",
"matrix",
@ -171,7 +172,9 @@
"input-default-context": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"env",
"strategy",
"matrix",
@ -190,6 +193,7 @@
"string-steps-context": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"strategy",
@ -206,6 +210,7 @@
"boolean-steps-context": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"strategy",
@ -222,6 +227,7 @@
"step-env": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"strategy",
@ -241,6 +247,7 @@
"step-if": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"strategy",
@ -261,6 +268,7 @@
"step-with": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"strategy",

View file

@ -237,6 +237,9 @@ func (s *Node) UnmarshalYAML(node *yaml.Node) error {
if node != nil && node.Kind == yaml.DocumentNode {
return s.UnmarshalYAML(node.Content[0])
}
if node != nil && node.Kind == yaml.AliasNode {
return s.UnmarshalYAML(node.Alias)
}
def := s.Schema.GetDefinition(s.Definition)
if s.Context == nil {
s.Context = def.Context
@ -360,6 +363,15 @@ func (s *Node) checkMapping(node *yaml.Node, def Definition) error {
if node.Kind != yaml.MappingNode {
return fmt.Errorf("%sExpected a mapping got %v", formatLocation(node), getStringKind(node.Kind))
}
// merges cannot be conveniently validated and are skipped
// https://yaml.org/type/merge.html
for i, n := range node.Content {
if i%2 == 0 {
if n.Kind == yaml.ScalarNode && n.Value == "<<" && (n.Tag == "" || n.ShortTag() == "!!merge") {
return nil
}
}
}
insertDirective := regexp.MustCompile(`\${{\s*insert\s*}}`)
var allErrors error
for i, k := range node.Content {

View file

@ -1,6 +1,7 @@
package schema
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
@ -29,6 +30,140 @@ jobs:
assert.NoError(t, err)
}
func TestContextsInWorkflowMatrix(t *testing.T) {
t.Run("KnownContexts", func(t *testing.T) {
// Parse raw YAML snippet.
var node yaml.Node
err := yaml.Unmarshal([]byte(`
on: push
jobs:
job:
uses: ./.forgejo/workflow/test.yaml
strategy:
matrix:
input1:
- ${{ forge.KEY }}
- ${{ forgejo.KEY }}
- ${{ github.KEY }}
- ${{ inputs.KEY }}
- ${{ vars.KEY }}
- ${{ needs.KEY }}
include:
- forge: ${{ forge.KEY }}
- forgejo: ${{ forgejo.KEY }}
- github: ${{ github.KEY }}
- inputs: ${{ inputs.KEY }}
- vars: ${{ vars.KEY }}
- needs: ${{ needs.KEY }}
exclude:
- forge: ${{ forge.KEY }}
- forgejo: ${{ forgejo.KEY }}
- github: ${{ github.KEY }}
- inputs: ${{ inputs.KEY }}
- vars: ${{ vars.KEY }}
- needs: ${{ needs.KEY }}
`), &node)
if !assert.NoError(t, err) {
return
}
// Parse YAML node as a validated workflow.
err = (&Node{
Definition: "workflow-root",
Schema: GetWorkflowSchema(),
}).UnmarshalYAML(&node)
assert.NoError(t, err)
})
t.Run("UnknownContext", func(t *testing.T) {
for _, property := range []string{"include", "exclude", "input1"} {
t.Run(property, func(t *testing.T) {
for _, context := range []string{"secrets", "job", "steps", "runner", "matrix", "strategy"} {
t.Run(context, func(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(fmt.Sprintf(`
on: push
jobs:
job:
uses: ./.forgejo/workflow/test.yaml
strategy:
matrix:
%[1]s:
- input1: ${{ %[2]s.KEY }}
`, property, context)), &node)
if !assert.NoError(t, err) {
return
}
err = (&Node{
Definition: "workflow-root",
Schema: GetWorkflowSchema(),
}).UnmarshalYAML(&node)
assert.ErrorContains(t, err, "Unknown Variable Access "+context)
})
}
})
}
})
}
func TestReusableWorkflow(t *testing.T) {
t.Run("KnownContexts", func(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`
on: push
jobs:
job:
uses: ./.forgejo/workflow/test.yaml
with:
input1: |
${{ forge.KEY }}
${{ github.KEY }}
${{ inputs.KEY }}
${{ vars.KEY }}
${{ env.KEY }}
${{ needs.KEY }}
${{ strategy.KEY }}
${{ matrix.KEY }}
`), &node)
if !assert.NoError(t, err) {
return
}
err = (&Node{
Definition: "workflow-root",
Schema: GetWorkflowSchema(),
}).UnmarshalYAML(&node)
assert.NoError(t, err)
})
t.Run("UnknownContext", func(t *testing.T) {
for _, context := range []string{"secrets", "job", "steps", "runner"} {
t.Run(context, func(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(fmt.Sprintf(`
on: push
jobs:
job:
uses: ./.forgejo/workflow/test.yaml
with:
input1: ${{ %[1]s.KEY }}
`, context)), &node)
if !assert.NoError(t, err) {
return
}
err = (&Node{
Definition: "workflow-root",
Schema: GetWorkflowSchema(),
}).UnmarshalYAML(&node)
assert.ErrorContains(t, err, "Unknown Variable Access "+context)
})
}
})
}
func TestAdditionalFunctionsFailure(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`
@ -107,7 +242,7 @@ jobs:
name: Build Silo Frontend DEV
runs-on: ubuntu-latest
container:
image: code.forgejo.org/oci/node:22-bookworm
image: code.forgejo.org/oci/${{ env.IMAGE }}
uses: ./.forgejo/workflows/${{ vars.PATHNAME }}
with:
STAGE: dev
@ -140,7 +275,7 @@ inputs:
default: '${{ env.GITHUB_SERVER_URL }}'
repo:
description: 'repo description'
default: '${{ github.repository }} ${{ vars.VARIABLE }}'
default: '${{ github.repository }} ${{ vars.VARIABLE }} ${{ inputs.VARIABLE }}'
runs:
using: "composite"
steps:
@ -186,3 +321,39 @@ runs:
})
}
}
// https://yaml.org/spec/1.2.1/#id2785586
// An anchor is denoted by the “&” indicator. It marks a node for future reference.
// https://yaml.org/type/merge.html
// Specify one or more mappings to be merged with the current one.
func TestSchema_AnchorAndReference(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`
on: [push]
jobs:
test1:
runs-on: docker
steps:
- &step
run: echo All good!
- *step
test2:
runs-on: docker
steps:
- << : *step
name: other name
test3:
runs-on: docker
steps:
- !!merge << : *step
name: other name
`), &node)
if !assert.NoError(t, err) {
return
}
err = (&Node{
Definition: "workflow-root",
Schema: GetWorkflowSchema(),
}).UnmarshalYAML(&node)
assert.NoError(t, err)
}

View file

@ -52,7 +52,7 @@
"boolean": {}
},
"run-name": {
"context": ["forge", "github", "inputs", "vars"],
"context": ["forge", "forgejo", "github", "inputs", "vars"],
"string": {},
"description": "The name for workflow runs generated from the workflow. GitHub displays the workflow run name in the list of workflow runs on your repository's 'Actions' tab.\n\n[Documentation](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#run-name)"
},
@ -1139,7 +1139,7 @@
},
"workflow-call-input-default": {
"description": "If a `default` parameter is not set, the default value of the input is `false` for boolean, `0` for a number, and `\"\"` for a string.",
"context": ["forge", "github", "inputs", "vars"],
"context": ["forge", "forgejo", "github", "inputs", "vars"],
"one-of": ["string", "boolean", "number"]
},
"workflow-call-secrets": {
@ -1201,7 +1201,7 @@
},
"workflow-output-context": {
"description": "The value to assign to the output parameter.",
"context": ["forge", "github", "inputs", "vars", "jobs"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "jobs"],
"string": {}
},
"workflow-dispatch-string": {
@ -1402,7 +1402,7 @@
},
"workflow-env": {
"description": "A map of environment variables that are available to the steps of all jobs in the workflow. You can also set environment variables that are only available to the steps of a single job or to a single step.\n\n[Documentation](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#env)",
"context": ["forge", "github", "inputs", "vars", "secrets", "env"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "secrets", "env"],
"mapping": {
"loose-key-type": "non-empty-string",
"loose-value-type": "string"
@ -1517,6 +1517,7 @@
"description": "You can use the `if` conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.",
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1534,6 +1535,7 @@
"job-if-result": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1548,7 +1550,7 @@
},
"strategy": {
"description": "Use `strategy` to use a matrix strategy for your jobs. A matrix strategy lets you use variables in a single job definition to automatically create multiple job runs that are based on the combinations of the variables. ",
"context": ["forge", "github", "inputs", "vars", "needs"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs"],
"mapping": {
"properties": {
"fail-fast": {
@ -1566,6 +1568,7 @@
"fail-fast": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1584,6 +1587,7 @@
"max-parallel": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1630,7 +1634,7 @@
"runs-on": {
"description": "Use `runs-on` to define the type of machine to run the job on.\n* The destination machine can be either a GitHub-hosted runner, larger runner, or a self-hosted runner.\n* You can target runners based on the labels assigned to them, or their group membership, or a combination of these.\n* You can provide `runs-on` as a single string or as an array of strings.\n* If you specify an array of strings, your workflow will execute on any runner that matches all of the specified `runs-on` values.\n* If you would like to run your workflow on multiple machines, use `jobs.<job_id>.strategy`.",
"required": true,
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"one-of": [
"non-empty-string",
"sequence-of-non-empty-string",
@ -1656,6 +1660,7 @@
"description": "A map of variables that are available to all steps in the job.",
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1671,12 +1676,12 @@
},
"workflow-concurrency": {
"description": "Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression.\n\nYou can also specify `concurrency` at the job level.\n\n[Documentation](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#concurrency)",
"context": ["forge", "github", "inputs", "vars"],
"context": ["forge", "forgejo", "github", "inputs", "vars"],
"one-of": ["string", "concurrency-mapping"]
},
"job-concurrency": {
"description": "Concurrency ensures that only a single job using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the `secrets` context.\n\nYou can also specify `concurrency` at the workflow level.",
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"one-of": ["non-empty-string", "concurrency-mapping"]
},
"concurrency-mapping": {
@ -1697,7 +1702,7 @@
},
"job-environment": {
"description": "The environment that the job references. All environment protection rules must pass before a job referencing the environment is sent to a runner.",
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"one-of": ["string", "job-environment-mapping"]
},
"job-environment-mapping": {
@ -1716,7 +1721,7 @@
},
"job-environment-name": {
"description": "The name of the environment used by the job.",
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"string": {}
},
"job-defaults": {
@ -1730,6 +1735,7 @@
"job-defaults-run": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1800,6 +1806,7 @@
"step-uses": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1821,6 +1828,7 @@
"job-uses": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1841,6 +1849,7 @@
"step-continue-on-error": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1866,6 +1875,7 @@
"step-if": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1891,6 +1901,7 @@
"step-if-result": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1913,6 +1924,7 @@
"description": "Sets variables for steps to use in the runner environment. You can also set variables for the entire workflow or a job.",
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1934,6 +1946,7 @@
"step-name": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1953,6 +1966,7 @@
"step-timeout-minutes": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1973,6 +1987,7 @@
"description": "A map of the input parameters defined by the action. Each input parameter is a key/value pair. Input parameters are set as variables. When you specify an input in a workflow file or use a default input value, GitHub creates a variable for the input with the name `INPUT_<VARIABLE_NAME>`. The variable created converts input names to uppercase letters and replaces spaces with `_`.",
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -1993,7 +2008,7 @@
},
"container": {
"description": "A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.\n\nIf you do not set a container, all steps will run directly on the host specified by runs-on unless a step refers to an action configured to run in a container.",
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix", "env"],
"one-of": ["string", "container-mapping"]
},
"container-mapping": {
@ -2026,19 +2041,19 @@
},
"services": {
"description": "Additional containers to host services for a job in a workflow. These are useful for creating databases or cache services like redis. The runner on the virtual machine will automatically create a network and manage the life cycle of the service containers. When you use a service container for a job or your step uses container actions, you don't need to set port information to access the service. Docker automatically exposes all ports between containers on the same network. When both the job and the action run in a container, you can directly reference the container by its hostname. The hostname is automatically mapped to the service name. When a step does not use a container action, you must access the service using localhost and bind the ports.",
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"mapping": {
"loose-key-type": "non-empty-string",
"loose-value-type": "services-container"
}
},
"services-container": {
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"one-of": ["non-empty-string", "container-mapping"]
},
"container-registry-credentials": {
"description": "If the image's container registry requires authentication to pull the image, you can use `jobs.<job_id>.container.credentials` to set a map of the username and password. The credentials are the same values that you would provide to the `docker login` command.",
"context": ["forge", "github", "inputs", "vars", "secrets", "env"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "secrets", "env"],
"mapping": {
"properties": {
"username": "non-empty-string",
@ -2064,24 +2079,25 @@
}
},
"boolean-needs-context": {
"context": ["forge", "github", "inputs", "vars", "needs"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs"],
"boolean": {}
},
"number-needs-context": {
"context": ["forge", "github", "inputs", "vars", "needs"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs"],
"number": {}
},
"string-needs-context": {
"context": ["forge", "github", "inputs", "vars", "needs"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs"],
"string": {}
},
"scalar-needs-context": {
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "env", "needs", "strategy", "matrix"],
"one-of": ["string", "boolean", "number"]
},
"scalar-needs-context-with-secrets": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -2093,24 +2109,25 @@
"one-of": ["string", "boolean", "number"]
},
"boolean-strategy-context": {
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"boolean": {}
},
"number-strategy-context": {
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"number": {}
},
"string-strategy-context": {
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"string": {}
},
"job-timeout-minutes": {
"context": ["forge", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"context": ["forge", "forgejo", "github", "inputs", "vars", "needs", "strategy", "matrix"],
"one-of": ["number", "string"]
},
"boolean-steps-context": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -2129,6 +2146,7 @@
"number-steps-context": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -2147,6 +2165,7 @@
"string-runner-context": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -2164,6 +2183,7 @@
"string-runner-context-no-secrets": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",
@ -2180,6 +2200,7 @@
"string-steps-context": {
"context": [
"forge",
"forgejo",
"github",
"inputs",
"vars",

Some files were not shown because too many files have changed in this diff Show more