Re-run workflow runs from fj on private repos #297

Closed
opened 2026-10-22 03:45:12 +00:00 by stephen · 0 comments
Owner

What

Make fj run rerun <n> [--failed | -j <job>] actually re-run a workflow run. Today it stops with "Forgejo has no API route to rerun a workflow run. Open the run in the web UI instead." The web UI route (POST /{owner}/{repo}/actions/runs/{run}/rerun, and /jobs/{job}/rerun for one job) takes a session cookie and CSRF token, not an API token. A POST with a bearer token to fjord.sh/.../actions/runs/140/rerun returns 405.

Options, in order of preference:

  1. A token-accepting /api/v1 rerun endpoint, if the Forgejo version on rasterhub exposes one (check the current version's swagger first).
  2. The cookie/CSRF path designed in rasterstate/fj#103. Reruns and log reads need the same second auth path, so build it once for both, through Client::request and is_trusted_url.
  3. A server-side route on rasterhub that accepts the Fjord Account token, if 1 doesn't exist and 2 is unwanted.

Why

The fleet agents on shop-dev-01 babysit CI and have to re-run flaky or infra-failed runs (for example fjord-apple#86, a SwiftPM cache collision on the runner). They have only the fj token, no browser session, so today every re-run goes to a person or turns into an empty commit.

Acceptance

  • fj run rerun <n> -R owner/repo re-runs a run on a private repo; --failed and -j re-run only those jobs.
  • Auth goes through Client::request and respects is_trusted_url.
  • Wiremock coverage for the chosen path.
  • cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --all pass (in CI).

Dependencies

Shares its auth path with rasterstate/fj#103.

## What Make `fj run rerun <n> [--failed | -j <job>]` actually re-run a workflow run. Today it stops with "Forgejo has no API route to rerun a workflow run. Open the run in the web UI instead." The web UI route (`POST /{owner}/{repo}/actions/runs/{run}/rerun`, and `/jobs/{job}/rerun` for one job) takes a session cookie and CSRF token, not an API token. A POST with a bearer token to `fjord.sh/.../actions/runs/140/rerun` returns 405. Options, in order of preference: 1. A token-accepting `/api/v1` rerun endpoint, if the Forgejo version on rasterhub exposes one (check the current version's swagger first). 2. The cookie/CSRF path designed in rasterstate/fj#103. Reruns and log reads need the same second auth path, so build it once for both, through `Client::request` and `is_trusted_url`. 3. A server-side route on rasterhub that accepts the Fjord Account token, if 1 doesn't exist and 2 is unwanted. ## Why The fleet agents on shop-dev-01 babysit CI and have to re-run flaky or infra-failed runs (for example fjord-apple#86, a SwiftPM cache collision on the runner). They have only the fj token, no browser session, so today every re-run goes to a person or turns into an empty commit. ## Acceptance - [ ] `fj run rerun <n> -R owner/repo` re-runs a run on a private repo; `--failed` and `-j` re-run only those jobs. - [ ] Auth goes through `Client::request` and respects `is_trusted_url`. - [ ] Wiremock coverage for the chosen path. - [ ] `cargo fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`, `cargo test --all` pass (in CI). ## Dependencies Shares its auth path with rasterstate/fj#103.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rasterstate/fj#297
No description provided.