Add redis-cli static binary build & distribution tooling#1
Conversation
20d8cb5 to
b296cf1
Compare
b296cf1 to
f37fce2
Compare
| if dl "${URL}.sha256" "$TMP/redis-cli.sha256" 2>/dev/null; then | ||
| info "verifying checksum" | ||
| expected="$(awk '{print $1}' "$TMP/redis-cli.sha256")" | ||
| actual="$(sha256 "$TMP/redis-cli")" |
There was a problem hiding this comment.
This is maybe an error, there is no sha256 tool at least on Linux. Standard tool is named sha256sum it could calculate and check the sums at the same time
There was a problem hiding this comment.
This is actually a function defined in lines 59-65. But now I am actually thinking that its better to refactor this and rename it properly to avoid confusions.
| info "downloading $URL" | ||
| dl "$URL" "$TMP/redis-cli" || err "download failed: $URL" | ||
|
|
||
| if dl "${URL}.sha256" "$TMP/redis-cli.sha256" 2>/dev/null; then |
There was a problem hiding this comment.
In general installers are hard-coding sums into the script. For example astral uv installer or nix installer.
But there are examples of installers which doesn't check any sums, like rust installer or bun installer. Rust installer relies on TLS trying to force higher TLS versions and to prevent fallback to http, bun installer just doesn't care.
Rust is using commands like this: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
To be honest I don't know which is the best way to build a trust when using this form of installation. So just leaving this as a side-note.
| # producing <src-root>/src/redis-cli. Passes static flags to the upstream | ||
| # Redis Makefile (we don't own it, so there's no custom target). | ||
| compile() { | ||
| co_os="$1"; co_arch="$2"; co_src="$3" |
There was a problem hiding this comment.
co_arch variable is unused, I suggest using shellcheck to validate all the scripts
| # fetch_redis <ref> <dest>: download + extract the Redis source into <dest>. | ||
| fetch_redis() { | ||
| fr_ref="$1"; fr_dest="$2" | ||
| fr_url="https://github.com/redis/redis/archive/${fr_ref}.tar.gz" |
There was a problem hiding this comment.
Maybe worth hard-coding redis checksum as in docker and debian (but not rpm ha-ha, I should create a bug)
| install -m 0755 "$TMP/redis-cli" "$DEST/redis-cli" | ||
| elif command -v sudo >/dev/null 2>&1; then | ||
| info "$DEST is not writable, using sudo" | ||
| sudo install -m 0755 "$TMP/redis-cli" "$DEST/redis-cli" |
There was a problem hiding this comment.
If DEST it not writable it may have not been created by mkdir since it runs without sudo and the install would fail.
| @@ -0,0 +1,90 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
Maybe worth running this as a part of CI
Description
This repository builds and distributes standalone, statically linked
redis-clibinaries for Linux and macOS (amd64/arm64) and publishes them —together with a
curl | shinstaller — topackages.redis.io.redis-cliis frequently wanted on its own — on a laptop, a CI runner, an appcontainer, or a jump host — without installing or building the whole Redis
server, and without a package that also pulls in
redis-server. The existingoptions each have friction:
apt/dnf) are often outdated, tie the client versionto the server package, and require root.
A single static binary removes that friction: it has no runtime
dependencies. Runs on any Linux distro including minimal/distroless/container images, and
installs in one command. Versions are pinnable via a stable URL, matching how
Redis already ships source tarballs.
What's included
build.sh— fetch a Redis version and build one static target → raw strippedbinary +
.sha256.publish.sh— upload artifacts +install.shto S3, withstable/latestpointers.
install.sh— OS/arch-detecting installer; checksum-verified; needs onlycurl/wget(notar/gzip, so it works on the most minimal images);all logic wrapped in
main()forcurl | shtruncation safety.test-distros.sh— Docker smoke tests across many distros..github/workflows/—release_build_and_test.ymlandrelease_publish.ymlreusing
build-and-test.yml, matching theredis-debian/redis-rpmlayout.release_type: internalpublishes to the staging bucket at its S3 URL;release_type: publicpublishes to the production bucket served athttps://packages.redis.io.README.md,LICENSE,.editorconfig,.redis_version,.gitignore.Versioning
The version is the Redis version — this repo adds no numbering of its own.
Each build is published under an immutable, version-pinned path;
stableandlatestare moving pointers to the newest promoted stable release (stablematches the
download.redis.ionaming,latestthe Docker one). Pre-releases(e.g.
8.8-rc1) are installable by exact version but never movestable.Install examples: