@@ -38,13 +38,15 @@ directly for JWT signing. |
| 38 | 38 | Job JWTs are single-use. Every job endpoint verifies the signature and |
| 39 | 39 | expiry, checks that the path job belongs to the claimed runner/run, and |
| 40 | 40 | then inserts `jti` into `runner_jwt_used`. A replay returns 401. To |
| 41 | | -support multi-step runner flows, successful non-terminal job endpoints |
| 41 | +support multi-step runner flows, successful in-flight job endpoints |
| 42 | 42 | return `next_token` and `next_token_expires_at`. |
| 43 | 43 | |
| 44 | 44 | `shithubd-runner` consumes the same token chain: it claims with the |
| 45 | 45 | registration token, marks the job `running` with the first job JWT, then |
| 46 | | -uses the returned `next_token` for the terminal status update. Reusing |
| 47 | | -any consumed job JWT is a replay and must fail with 401. |
| 46 | +uses each returned `next_token` serially for log chunks, step-status |
| 47 | +updates, cancel checks, artifact upload requests, and finally the |
| 48 | +terminal job-status update. Reusing any consumed job JWT is a replay and |
| 49 | +must fail with 401. |
| 48 | 50 | |
| 49 | 51 | ## Endpoints |
| 50 | 52 | |
@@ -74,6 +76,26 @@ first step in the job receives the chunk. Chunks are base64-decoded, |
| 74 | 76 | capped at 512 KiB raw, and appended to `workflow_step_log_chunks`. |
| 75 | 77 | Duplicate `(step_id, seq)` inserts are accepted as idempotent retries. |
| 76 | 78 | |
| 79 | +`POST /api/v1/jobs/{id}/steps/{step_id}/status` |
| 80 | + |
| 81 | +Auth: job JWT. Body: |
| 82 | + |
| 83 | +```json |
| 84 | +{"status":"completed","conclusion":"success"} |
| 85 | +``` |
| 86 | + |
| 87 | +Valid transitions are `queued|running -> running|completed|cancelled|skipped` |
| 88 | +with idempotent repeats of the target terminal state. Completed and |
| 89 | +skipped steps require a valid check conclusion; cancelled defaults to |
| 90 | +`cancelled` when omitted. The endpoint always returns a `next_token` |
| 91 | +because a completed step is not the end of the job. |
| 92 | + |
| 93 | +When object storage is configured, terminal step updates enqueue |
| 94 | +`workflow:finalize_step`. The worker concatenates |
| 95 | +`workflow_step_log_chunks` in sequence order, uploads the log to |
| 96 | +`actions/runs/<run_id>/jobs/<job_id>/steps/<step_id>.log`, stores that |
| 97 | +key and byte count on `workflow_steps`, then deletes the SQL chunks. |
| 98 | + |
| 77 | 99 | `POST /api/v1/jobs/{id}/status` |
| 78 | 100 | |
| 79 | 101 | Auth: job JWT. Body: |
@@ -87,10 +109,11 @@ Completed jobs require a valid check conclusion. The handler updates |
| 87 | 109 | `workflow_jobs`, rolls up `workflow_runs`, and best-effort updates the |
| 88 | 110 | matching `check_runs` row created by the trigger pipeline. |
| 89 | 111 | |
| 90 | | -S41d PR1 runner execution supports containerized `run:` steps. `uses:` |
| 91 | | -aliases such as `actions/checkout@v4` and artifact upload/download are |
| 92 | | -reserved for the later S41d slices that add checkout metadata, log |
| 93 | | -streaming, and artifact transfer. |
| 112 | +S41d PR2 runner execution supports containerized `run:` steps with |
| 113 | +per-step log streaming and server-side log finalization. `uses:` aliases |
| 114 | +such as `actions/checkout@v4` and artifact upload/download remain |
| 115 | +reserved for the later S41d slices that add checkout metadata and |
| 116 | +artifact transfer. |
| 94 | 117 | |
| 95 | 118 | `POST /api/v1/jobs/{id}/artifacts/upload` |
| 96 | 119 | |