Add github_alpine metadata-only package type #115
Reference in New Issue
Block a user
Delete Branch "benvin/apk-github"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
github_alpineis the Alpine/apk analog of the existinggithub_deb/github_rpmmetadata-only remotes. It lets a plain GitHub-releases repo of.apkfiles be consumed as a real apk repository without artifactapi ever precaching the packages: it scans the repo's releases, derives each package's.PKGINFOfrom a ranged prefix fetch, synthesizes a per-archAPKINDEX.tar.gzfrom the cached metadata, and redirects the actual.apkdownloads to a backendreleases_remote. It stacks on the apk-local branch, reusing that work's alpine APKINDEX generator,.apk/.PKGINFOparser, Q1 pull-checksum, andAlpineMetadatastore.How
pkg/models: addPackageGitHubAlpineto the enum + validators (and test).internal/provider/alpine/github.go: thegithub_alpineprovider.ServeRemoteserves per-arch<arch>/APKINDEX.tar.gz(reusinggenerateAPKIndexover arch-filteredAlpineMetadatarows,normalizeIndexPathfor apk's./dot-segment), 302-redirects*.apkto{proxyBaseURL}/api/v1/remote/{releases_remote}/{path}, and cold-starts with a 503 +Retry-After.scanWithStatelists releases with ETag/If-None-Match and incrementally derives/prunes.deriveAssetdoes a ranged GET of just the front of the.apk— the control gzip stream carrying.PKGINFOsits near the front — doubling the range on truncation; it parses.PKGINFOand computes theC:Q1 checksum (Q1+base64(sha1(control stream))).FilePath= the github-relative asset path so the redirect resolves.internal/provider/alpine/syncer.go: a parallel backgroundSyncer(own worker pool, shared rate limiter, deduped queue, DB lease), separate from the deb/rpm syncers.internal/database/alpine_github_sync.go+github_alpine_sync_statetable:ListGitHubAlpineRemotes+ Claim/Release per-remote sync lease, kept separate from the deb/rpm tables.internal/server/server.go: construct +Runthe alpine syncer alongside deb/rpm and register it in thePackageType→Primermap (priming on create then flows through the existing genericremotes.gopath).The rpm/deb providers, syncers, and tables are untouched — this adds parallel alpine equivalents and reuses shared helpers already present in the alpine package.
Tests
Mirror the deb github tests: scan derives
.PKGINFO/Q1 from a ranged prefix of atestsupport.MinimalApkserved over an httptest range server (no full download); diff/prune; pattern filter; per-archServeRemoterouting (index served per-arch and grouped, dot-segment collapse,.apk→ 302, cold-start 503, warm 200, canceled-request-serves-cache); DB lease prevents a second replica; prime bypasses the recency window.go build/go vet/go mod tidyclean,make test(-race) green, pre-commit green.6c6ad3066etod1c3c2fb6c