feat(webid): HTTP API server — releases, resolver, and installer script renderer#1094
Open
coolaj86 wants to merge 5 commits into
Open
feat(webid): HTTP API server — releases, resolver, and installer script renderer#1094coolaj86 wants to merge 5 commits into
coolaj86 wants to merge 5 commits into
Conversation
50ca47c to
d6fd8ae
Compare
fd82a68 to
af93ac2
Compare
af93ac2 to
c229d2e
Compare
ffe4ea8 to
bf5cafa
Compare
Packages that produce no classifiable assets (e.g. mariadb-galera with the galera asset_filter) were being refetched every batch because !hasAssets marked them stale regardless of timestamp. The hasAssets condition was intended for the startup case (classified from empty rawcache), but those packages are already caught by t.IsZero() on first run. Respect the timestamp for 0-asset results as for any other package.
Serves the HTTP API for webinstall.dev:
- GET /api/releases/{pkg}.json — classified release list from fsstore
- GET /v1/resolve/{pkg} — resolve OS/arch/version to a specific asset
- GET /api/installers/{pkg}.sh — render installer shell script
- GET /api/installers/{pkg}.ps1 — render installer PowerShell script
Git-clone packages include git_tag and git_commit_hash in responses.
UA detection infers OS/arch from User-Agent when not query-specified.
c229d2e to
ac59e47
Compare
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.
Summary
Adds
cmd/webid, the Go HTTP API server, stacked on #1092 (webicached dynamic discovery).Core:
/api/releases/{pkg}.json— filtered, sorted release list for a package/api/releases/{pkg}.tab— TSV variant for tabular consumers/{pkg}and/api/installers/{pkg}.sh— rendered POSIX installer scriptsUser-Agent(uname -srmformat) to setWEBI_OS,WEBI_ARCH,WEBI_LIBC_webi/package-install.tpl.sh/.ps1Fixes included (squashed):
WEBI_GIT_COMMIT_HASHthrough render context*for universal entries)Deploy:
scripts/deploy-webid.sh beta.webi.shTest plan
go build ./cmd/webid— cleango test ./cmd/webid/...— passes./scripts/deploy-webid.sh beta.webi.shcurl -sSf https://beta.webi.sh/api/releases/bat.json | head -c 200curl -fsSA "$(uname -srm)" https://beta.webi.sh/bat | grep WEBI_PKG_URLcurl -fsSA "CYGWIN_NT-10.0 x86_64" https://beta.webi.sh/api/debug→"os":"windows"