feat(hub): headless job status + artifact fetch by Job ID#2
Open
proggeramlug wants to merge 1 commit into
Open
feat(hub): headless job status + artifact fetch by Job ID#2proggeramlug wants to merge 1 commit into
proggeramlug wants to merge 1 commit into
Conversation
Headless/CI clients that publish over a non-TTY shell couldn't reliably get their artifact: the only path was a long-lived WebSocket that delivers the download token via a Complete message. If the WS dropped or the job sat in the queue, the artifact was unreachable (and lost entirely on a hub restart, since the queue is in-memory). Add two Bearer-authed (api_token) endpoints so a job can be enqueued, then polled + fetched by Job ID without holding a socket open: - GET /api/v1/jobs/:jobId/status -> queued|running|completed|failed + artifact_url - GET /api/v1/jobs/:jobId/artifact -> the final artifact (base64 text, like /dl) On artifact upload the hub now also writes a job-id-keyed record to disk, so a completed artifact is retrievable by Job ID and survives a hub restart. (Intermediate *-precompiled sign bundles are skipped.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Headless/CI clients (e.g.
perry publishin a non-TTY GitHub Actions shell) can't reliably retrieve their build artifact. The only path is a long-lived WebSocket that delivers the download token via aCompletemessage — if the WS drops or the job sits in the queue, the artifact is unreachable, and it's lost entirely if the hub restarts (the queue is in-memory).Fix
Two Bearer-authed (the same
api_tokenused byperry publish) endpoints to enqueue-then-poll-then-fetch by Job ID, no socket required:GET /api/v1/jobs/:jobId/status→queued|running|completed|failed(+artifact_url, size, sha256 when ready)GET /api/v1/jobs/:jobId/artifact→ the final artifact as base64 text (same encoding as/api/v1/dl)On artifact upload the hub also writes a job-id-keyed record to disk, so a completed artifact is retrievable by Job ID and survives a hub restart. Intermediate
*-precompiledsign bundles are skipped (only the CLI-facing final is recorded).Deployed + verified live: endpoints return 401 without a valid token, 404 for unknown jobs; existing routes/WS unaffected.
Follow-up (not in this PR): persist the queue itself so queued (not-yet-built) jobs survive a restart + get re-dispatched. Pairs with PerryTS/perry#4732 (CLI no longer exits 0 without a result).