feat(bakery): FCOS sysext catalog client for fedora-sysexts/community#736
feat(bakery): FCOS sysext catalog client for fedora-sysexts/community#736clubanderson wants to merge 1 commit into
Conversation
Implements issue projectbluefin#641. Adds a complete FCOS sysext catalog client that fetches extensions from the fedora-sysexts/community GitHub Releases API, with Fedora version filtering, tag name parsing, curated descriptions, and full test coverage. New packages and files: - internal/fcos/streams.go: FetchStreamFedoraVersion — queries the FCOS stream metadata JSON (builds.coreos.fedoraproject.org) to derive the current Fedora major version (e.g. 44) for the given stream. Prefers x86_64, falls back to aarch64. Injectable HTTP client for 100% test coverage. - internal/fcos/streams_test.go: 100% statement coverage with httptest servers, error injection (invalid URL, hijacked connection), context cancellation, and table-driven JSON parsing tests. - internal/bakery/fcos_tag.go: ParseFCOSTagName — parses tags in the format '<name>-<version>-<fedoraVersion>-<arch>' including RPM epoch prefixes (tailscale-0-1.98.3-1), multi-word names (docker-ce), and digit-starting names (1password-gui). Bare pointer tags are rejected. - internal/bakery/fcos_tag_test.go: 30+ table-driven test cases with real catalog tags sampled from the live API. - internal/bakery/fcos.go: FCOSCatalogURL, fcosMaxCatalogPages=20, FetchCatalogFCOS (paginated, deduplicating, with SHA256 verification), FCOSClient (implements Client), NewFCOSClient/NewFCOSClientWithURL. - internal/bakery/fcos_test.go: 100% coverage — success, arch/version filtering, deduplication, pagination, page-cap error, SHA256 fetch, soft-fail SHA256, curated descriptions, bad tags, URL length limits, invalid JSON, read errors, and 5MB response size limit. - internal/bakery/fcos_descriptions.go: FCOSLookup and fcosCatalog with 10 curated entries (docker-ce, tailscale, vscode, vscodium, cilium-cli, 1password-gui, kubernetes, netbird, cloud-hypervisor, glab). - internal/bakery/fcos_descriptions_test.go: catalog size gate (≥6), known-extension assertions, unknown-extension fallback. - Justfile: [fcos]=100 added to cover-check targets. Design decisions: - FCOSClient wraps *http.Client + FedoraVersion int and implements Client. Delegates to HTTPClient.FetchCatalogFCOS for the actual fetch. - Asset URLs in fedora-sysexts/community are all github.com URLs (not the extensions.fcos.fr CDN). Existing maxSysextURLLen and HTTPS enforcement in ignition.go are sufficient. - fcosMaxCatalogPages=20 covers 2000 releases (catalog had 1583+ as of 2025-06-04). Cap is a hard error, not silent truncation. - Wiring into wizard/headless (FetchSysexts) is scoped to issue projectbluefin#638. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Warning Review limit reached
More reviews will be available in 1 minute and 46 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #641.
What this PR does
Implements the FCOS sysext catalog client described in issue #641, fetching extensions from the fedora-sysexts/community GitHub Releases API.
New files
internal/fcos/streams.go(new package)FetchStreamFedoraVersion(ctx, stream) (int, error)— queries FCOS stream metadata JSON to derive the current Fedora major version (e.g. 44 from44.20260510.3.1). Prefersx86_64, falls back toaarch64.internal/bakery/fcos_tag.goParseFCOSTagName(tag) (name, version, fedoraVersion, arch, error)— parses tags in the form<name>-<version_components>-<fedoraVersion>-<arch>.internal/bakery/fcos.goFCOSCatalogURL,FetchCatalogFCOSon*HTTPClient,FCOSClientimplementingClient.fcosMaxCatalogPages=20), deduplicating, with SHA256 verification and curated metadata. Page cap is a hard error, not silent truncation.internal/bakery/fcos_descriptions.goFCOSLookupandfcosCatalogwith 10 curated entries: docker-ce, tailscale, vscode, vscodium, cilium-cli, 1password-gui, kubernetes, netbird, cloud-hypervisor, glab.Justfile[fcos]=100tocover-checktargets.Design notes
browser_download_urlvalues point togithub.com(notextensions.fcos.fr). ExistingmaxSysextURLLenand HTTPS enforcement are sufficient.internal/bakeryandinternal/fcoshit 100% statement coverage.