Skip to content

builds: build history, status, logs, download and cancel across providers - #33

Open
Interlap01 wants to merge 6 commits into
mainfrom
builds
Open

Interlap01 wants to merge 6 commits into
mainfrom
builds

Conversation

@Interlap01

Copy link
Copy Markdown
Collaborator

What

builder builds reads the builds Builder started on GitHub Actions, Codemagic or Bitrise and normalizes them:

  • builder builds [--provider] [--limit N] [--status running|failed|succeeded] [--json]: build ID, kind (ipa/simulator), profile when recoverable, status (with the provider's own word), started, duration, run URL.
  • builder builds show <id>: jobs and steps, failed step with its error annotations (same data as RunFailedError), artifacts with size and expiry.
  • builder builds logs <id> [--failed] [--follow]: GitHub job logs (/actions/jobs/{id}/logs), Codemagic step logs, Bitrise log chunks or the archived raw log; --follow polls until the build ends.
  • builder builds download <id> [-o dist]: the IPA, using the existing download code, so it works after ios build was interrupted.
  • builder builds cancel <id>: GitHub run cancel, plus Codemagic/Bitrise through build.CancelRemote. ios cancel --provider --run-id still works as a deprecated alias that calls the same path; with a bare Codemagic/Bitrise run ID it skips the lookup, so it behaves as it did before.

<id> is the 8-hex build ID, a provider run ID, or a run URL (the URL's host also picks the provider).

Why

The provider dashboards were the only way to see past builds, read a failure, or get an IPA back after the CLI was interrupted. Builder already knows how to identify its own runs, so this puts that behind one command for all three providers.

How

  • internal/builds: a Source per provider (GitHub, Remote) with list/find/show/logs/download/cancel and a small LogStream interface for follow mode.
  • GitHub: runs of ios-build.yml and ios-share.yml, build ID taken from display_title (iOS Build <id>, or the tag name for tag-triggered runs).
  • internal/ci: ci.History for Codemagic (GET /builds?appId&workflowId, GET /builds/{id}) and Bitrise (GET /apps/{app}/builds?workflow, /builds/{slug}, /log). Build ID and profile come from the variables the provider reports back, else from the <id>.ipa artifact name.
  • Remote builds now also send BUILDER_PROFILE when a profile is selected, so the profile can be shown later. The runner ignores it, and the BUILDER_ prefix is already reserved.
  • README has a "Build history" section; CLAUDE.md lists the commands and patterns.

Testing

  • go test -race ./... passes.
  • golangci-lint v2 reports 0 issues. The installed binary was built with an older Go than this module needs, so I ran the latest release through go run. go vet and gofmt are also clean.
  • httptest fakes for each provider. GitHub: list, limit, status filter, find by build ID / tag run / run ID / URL / other-repo URL, show with failure annotations, logs (all, --failed, follow), download (ok, expired, still running, simulator), cancel. Codemagic and Bitrise (TLS fakes, because artifact URLs must be HTTPS): list, filter, find, show, step logs or chunk logs, archived log, download, cancel. Command-layer tests cover output, JSON, provider routing by URL, and the ios cancel alias.
  • Nothing was run against real repos or CI providers.

Left out

  • With no --provider, builds lists only the default provider. It does not merge all configured providers.
  • GitHub does not return workflow inputs on a run, so the profile column is empty for GitHub builds. Fixing that would mean changing run-name in the workflow templates.
  • I wrote the response shapes for the Codemagic builds list and per-step log URLs from the public API docs and did not check them against a live account. If Codemagic does not return the environment variables, the build ID falls back to the IPA artifact name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant