From e8e2b2f17cf11feb30d2cfc6fd306d9dab1775c4 Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Tue, 26 May 2026 00:05:26 +0300 Subject: [PATCH] Add docs/index.html landing page; publish.yml substitutes build info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the inline 4-line index.html written in publish.yml with a proper text-mostly landing page under docs/index.html — sections for what it is, install, the loop it replaces, commands, why, and a 'this build' block populated at publish time from VERSION, SHA-256, and build timestamp via sed. Single-column, ~44rem max width, system fonts, monospace for code, dark-mode via prefers-color-scheme. No JS, no images, no remote assets. ~130 lines of HTML+CSS. --- .builds/publish.yml | 18 +++--- docs/index.html | 130 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 10 deletions(-) create mode 100644 docs/index.html diff --git a/.builds/publish.yml b/.builds/publish.yml index 7c339d02d54daf5b89390b29c5ff8087e08017c5..a3d9f3d7cb99f7fe3302b43ffac4c743bb2b8a62 100644 --- a/.builds/publish.yml +++ b/.builds/publish.yml @@ -56,20 +56,18 @@ tasks: # pages.sr.ht expects a tarball whose top-level contents map to the # publish path — so `tar -C dist .`, not `tar dist/`. With # `-s /ci-cacher` the binary lands at - # https://$PAGES_DOMAIN/ci-cacher/cacher-linux-amd64. A minimal - # index.html under /ci-cacher makes the project URL informative - # instead of a 404. + # https://$PAGES_DOMAIN/ci-cacher/cacher-linux-amd64. docs/index.html + # is the project landing page; the three {{PLACEHOLDERS}} get + # substituted at publish time with the values from this build. VERSION=$(cd ci-cacher && (git describe --tags --abbrev=0 2>/dev/null || cat VERSION)) SUM=$(sha256sum /home/build/cacher-linux-amd64 | awk '{print $1}') + BUILT=$(date -u +%Y-%m-%dT%H:%M:%SZ) mkdir -p /home/build/dist cp /home/build/cacher-linux-amd64 /home/build/dist/cacher-linux-amd64 - cat > /home/build/dist/index.html <cacher $VERSION -

cacher $VERSION

-

S3-backed CI cache helper. Source.

-
wget https://$PAGES_DOMAIN$PAGES_SUBPATH/cacher-linux-amd64
-      sha256sum cacher-linux-amd64  # expect: $SUM
- EOF + sed -e "s|{{VERSION}}|$VERSION|g" \ + -e "s|{{SHA256}}|$SUM|g" \ + -e "s|{{BUILT}}|$BUILT|g" \ + ci-cacher/docs/index.html > /home/build/dist/index.html cd /home/build/dist tar -czvf /home/build/site.tar.gz . - publish_pages: | diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000000000000000000000000000000000000..919087e96139edb6b4543e3213e7522ec4f05d66 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,130 @@ + + + + + +cacher — S3-backed CI cache helper + + + + +

cacher

+

S3-backed CI cache helper. A single static Go binary.

+ +

What it is

+

+ cacher is the build that the typical "check S3, fall back to + upstream, upload for next time" shell loop should have been. It downloads, + uploads, lists, and invalidates cached artifacts in any S3-compatible + bucket — single files, docker images (via streamed + save | zstd | s3), and whole directory trees keyed by lockfile + hash. Built for builds.sr.ht; works + anywhere you can run a binary and reach an S3 endpoint. +

+ +

Install

+
wget https://bigbes.pages.srht.bigb.es/ci-cacher/cacher-linux-amd64 \
+  -O ~/.local/bin/cacher
+chmod +x ~/.local/bin/cacher
+

+ Verify the binary against the sha256 below before using it. +

+ +

The loop it replaces

+
# before — install awscli, write ~/.aws/config, then in every task:
+if aws s3api head-object --bucket "$B" --key "$K" >/dev/null 2>&1; then
+  aws s3 cp "s3://$B/$K" "$out"
+else
+  curl -sSL "$url" -o "$out"
+  aws s3 cp "$out" "s3://$B/$K"
+fi
+ +
# after — one binary, one config, one command:
+cacher download "$key" "$out" --url "$url"
+ +

Commands

+ +

+ Run cacher --help for the full surface. Read + the + README for usage patterns, Garage compatibility notes, and exit-code semantics. +

+ +

Why

+

+ The shell version this replaced repeated five things in every CI task: + install AWS CLI v2 (≈50 MB per build), write a Garage-tuned + ~/.aws/config, compute cache keys from file content with + sha256sum | cut, branch HIT/MISS by hand, and for + docker images pipe docker save | zstd | aws s3 cp - (and the + inverse). cacher collapses all of that into one fetched binary + plus a config file. The directory caching is the genuinely new capability — + the shell version only ever handled single files. +

+ +

This build

+
+
Version
{{VERSION}}
+
SHA-256
{{SHA256}}
+
Built
{{BUILT}}
+
Source
git.srht.bigb.es/~bigbes/ci-cacher
+
License
BSD-2-Clause
+
+ + + + +