A Rust implementation of the Mina Protocol release manager script, providing comprehensive release management functionality for build artifacts.
This tool handles the complete lifecycle of build artifacts including publishing, promotion, verification, and maintenance of packages across different channels and platforms.
- PUBLISH: Put already-built
.debfiles into a Debian repository, unchanged, then check each one is really there - PUBLISH-FROM-CACHE: Legacy. Pull from the CI cache by Buildkite build id, re-versioning on the way
- PROMOTE: Promote artifacts from one channel/registry to another (e.g., unstable -> stable)
- VERIFY: Verify that artifacts are correctly published in target channels/registries
- FIX: Repair Debian repository manifests when needed
- PERSIST: Archive artifacts to long-term storage backends
- PULL: Download artifacts from cache to local directory
- Artifacts: mina-daemon, mina-archive, mina-rosetta, mina-logproc
- Networks: devnet, mainnet
- Platforms: Debian (bullseye, focal), Docker (GCR, Docker.io)
- Channels: unstable, alpha, beta, stable
- Storage Backends: Google Cloud Storage (gs), Hetzner, local filesystem
Make sure you have Rust installed. If not, install it from rustup.rs.
Additional tools required depending on operations:
gcloud(for Google Cloud Storage operations, viagcloud storage)docker(for Docker operations and verification)deb-s3(for Debian repository operations — the pinned fork, which unlike the rubygems release has theexistandshowsubcommandspublishuses)aws(for CloudFront invalidation, and forpublish's pool-object check — without it nothing breaks, but no package is ever skipped as unchanged)- SSH access and keys (for Hetzner operations)
cd buildkite/scripts/release/release-manager
cargo build --releaseThe binary will be available at target/release/release-manager.
The tool respects the following environment variables:
DEBIAN_CACHE_FOLDER: Directory for caching Debian packages (default:~/.release/debian/cache)HETZNER_USER: Hetzner storage user (default:u434410)HETZNER_HOST: Hetzner storage host (default:u434410-sub2.your-storagebox.de)HETZNER_KEY: Path to Hetzner SSH key (default:~/.ssh/id_rsa)RUST_LOG: Log level (default:info)
release-manager <COMMAND> [OPTIONS]Put .deb files that are already at their final version into a Debian
repository, exactly as they are, and then confirm they arrived.
release-manager publish \
--source-folder _debs \
--debian-repo stable.apt.packages.minaprotocol.com \
--channel stable \
--debian-sign-key 386E9DAC378726A48ED5CE56ADB30D9ACE02F414 \
--verify--source-folder holds a {codename}/*.deb tree — the layout pull and
reversion write, and the layout the Buildkite cache stores. Every codename
subfolder found is published, unless --codenames names a subset.
Publish rewrites nothing. There is no --source-version /
--target-version pair and no --buildkite-build-id:
| Not an argument | Because |
|---|---|
| version | It is already in the package and in the file name. A version argument could only agree with the package or contradict it, and contradicting it is a re-version — which is reversion, a separate and visible step. |
| architecture | deb-s3 reads Architecture from each package, so a folder holding both amd64 and arm64 publishes correctly in one call. |
| build id | Fetching from the CI cache is pull's job. Keeping the two apart means publish can be tested without a Buildkite build to point at. |
Use it when the build already produced the final version and the final suite,
which is the direct shape: build, test, publish. Use publish-from-cache when
the artifact has to change on its way to the repository, and promote when it
is already published and moving between channels.
One deb-s3 upload call is made per codename rather than per package:
deb-s3 takes the repository lock for a whole invocation, so uploading package
by package would take and release the lock, and rewrite the manifest, once per
package.
Before uploading, each package is compared against what the repository already
holds at that name, version and architecture, using deb-s3 show:
| Repository | What happens |
|---|---|
| absent | uploaded |
| present, same SHA256, pool object holds those bytes | skipped, and reported as already published (except Architecture: all, below) |
| present, same SHA256, pool object missing, different, or unconfirmed | uploaded again, saying why |
| present, different SHA256 | the command fails, naming both digests |
So a re-run over the same folder — the retry after a partial upload — converges and exits 0 without needing a human, while a second, different build at the same version is refused instead of quietly replacing what users install.
A skip needs the .deb, not just the index. deb-s3 writes the Packages
index, then Release, then releases the lock, and only then uploads the .deb
files themselves (cli.rb:254-283). A run killed in that tail — the long part,
the part no longer holding the lock — leaves an index advertising a package,
with the right SHA256, whose .deb is not there, or is still the previous
build. The first 404s on install; the second is worse, because apt calls it a
hash mismatch. So show reporting a matching digest is not enough to skip: the
Filename: it names is checked with aws s3api head-object: the object's
length is compared against the local package, and its MD5 — deb-s3 stamps the
file's MD5 into the object's metadata when it stores it — against the
MD5sum: in the same stanza. The stanza's own Size: is checked against the
local package too. Nothing is downloaded. Anything short of a match means
upload.
--verify cannot cover this gap for you: it asks deb-s3 exist, which reads
the same manifest show does, so for a skipped package it re-asserts what
show already said and never touches the pool.
An Architecture: all package — the mina-{network}-config ones — is never
skipped. deb-s3 merges those into every architecture manifest that exists at
the time of the upload, so skipping one would leave an architecture that has
appeared since it was first published without it.
If every package in a codename is already published, deb-s3 upload still runs
for it — with --skip-package-upload, so no package bytes move — and --verify
and the CDN invalidation still run too. That is not ceremony. dists/{codename}/Release
covers every component of a codename while the repository lock covers one
component of it, so a publish to a neighbouring channel can leave this
channel's Release holding stale hashes over a Packages index that is itself
correct, and apt then refuses the whole dist. Re-running the publish is what
repairs that, and it can only repair it by asking deb-s3 to write. The repair
is per channel: Release is rebuilt from the components this run touched plus
whatever the Release it just read says about the others, so a codename whose
focal and noble channels are both stale needs a re-run of each.
"No package bytes" is a claim about the network, not about the work: deb-s3
still reads and re-hashes every .deb it is given, inside the repository lock,
and this command has already hashed them itself. A re-publish of a large batch
is not free, it is only much cheaper than re-uploading.
Publishing without --debian-sign-key into a repository that is signed is
refused. Every upload rewrites Release, and with no key deb-s3 also deletes
Release.gpg and leaves the inline-signed InRelease in place over a
Release that no longer matches — so an unsigned re-run of a signed
repository would either unsign it or leave apt trusting a stale index.
Each codename is checked before any codename is uploaded, so a package that would be refused in the last codename fails the command before the first one is published.
This check is what makes the guarantee hold. deb-s3 --fail-if-exists is still
passed, but it does not do this job: it raises only when the same name and
version is in the manifest under a different pool file name, or when a
crashed run left a .deb-s3-temp object whose bytes differ. A re-publish of
the same file name matches neither, falls through, and replaces the pool
object, reporting success. Verified against the pinned fork and a real S3 API
(MinIO) — publishing different bytes at a published version exits 0 and
changes the SHA256: the repository serves. The flag is kept as a zero-cost
backstop for the cases it does cover.
Two limits are worth knowing. A pool key carries the codename but not the
component (pool/{codename}/…), so channels of one codename share it; the
pre-flight only reads the channel it is publishing to, and cannot see a
different channel publishing different bytes at the same version. And nothing
here recovers a stale dists/{codename}/{channel}/binary-/lockfile: a run
killed while holding the repository lock leaves one behind, and the next
publish — including the retry that would repair a missing pool object — waits
about ten minutes on it and then fails.
The digest of the local file is only computed once show says the package is
present, so a first publish pays for one deb-s3 show per package and nothing
else. That is not free: show reads and parses the whole Packages index for
the codename and architecture, and with --preserve-versions that index
carries every version ever published, so on an old channel the pre-flight can
be the slowest part of the command. It is still far cheaper than re-uploading
the packages, which is the alternative.
An output that cannot be read — a show that fails for any reason other than
No such package found., or a stanza with no usable SHA256: — fails the
command rather than being assumed to mean "absent", for the same reason
--verify refuses to read "no verdict" as "found". The exceptions are the two
questions whose answer only decides whether to skip: a head-object that
cannot run (no aws on PATH, no credentials, an unreadable answer) and a
stanza with no Filename: to check. Both upload instead, because at that
point the digests have already matched and uploading bytes that are already
there is safe and idempotent.
Two consequences worth stating plainly. The pre-flight needs a package's name,
version and architecture, so a .deb whose file name is not
{name}_{version}_{arch}.deb now fails the publish even without --verify —
before, only --verify was that strict. And the pre-flight reads the version
from the file name, while deb-s3 matches on the control file's Version:; the
two agree for every version Mina builds, but a package carrying an epoch
(1:3.0.0-…) would read as absent forever and the check would silently not
engage. --dry-run stays offline and does not run the pre-flight at all.
--verify asks the repository, package by package, whether it is now listed at
the version and architecture it was built with, and fails the command if any is
not. It is deb-s3 exist, not deb-s3 verify: the latter checks that the
manifest is internally consistent, which it can be while saying nothing about
the packages you just pushed.
Three details are worth knowing, because each one is a way this check could have passed without checking anything:
- The exit status is unusable. The pinned
deb-s3fork exits 0 whether a package is there or not and states the answer on stdout, so the output is parsed. - Two
deb-s3builds are in use and word it differently. The fork printsname : Found; the Debianruby-deb-s3gem prints>> name version arch: Found. They also disagree about the subcommand —existtaking one space-joined argument versusexiststaking separate ones — so exactly one package is asked about per call, the only shape both accept. - "No verdict" is not "found". A package the output never mentions fails the
command with
cannot tell whether …, and is not retried. Treating an unreadable answer as success is how a publish reports a package it never checked.
--verify-attempts (default 10) and --verify-interval-secs (default 30)
control the retry. The retry is not padding: the bucket sits behind a CDN and
the index is rewritten as a whole object, so a read straight after a write can
legitimately still serve the previous manifest. Only packages that have not
turned up yet are re-asked about.
--forceskips the pre-flight check above and drops--fail-if-exists, so an existing package at that version is overwritten. It is the way to say the published copy is the wrong one. Off by default.--skip-cache-invalidationleaves the CloudFront cache alone. By default thedists/{codename}/*prefix is invalidated, so readers are not served a stalePackagesindex.--dry-runlists what would be published and stops.--s3-endpointand--s3-force-path-stylepointdeb-s3at an S3-compatible server (a mirror, or a local MinIO) instead of AWS. Credentials are deliberately not options —deb-s3reads them from the environment, which is where CI keeps them and keeps them out of the process list.
An empty codename folder, or a source folder with no codename folders in it, is an error rather than a silent success: a pipeline that publishes nothing must not report that it published.
Publish build artifacts from cache to repositories and registries.
release-manager publish-from-cache \
--buildkite-build-id 12345 \
--source-version 1.0.0 \
--target-version 1.0.1 \
--channel stable \
--artifacts mina-daemon,mina-archive \
--networks devnet,mainnet \
--codenames bullseye,focal \
--verifyRequired options:
--buildkite-build-id: Buildkite build ID--source-version: Source version--target-version: Target version--channel: Target channel
Optional options:
--artifacts: Comma-separated artifact list (default: all)--networks: Comma-separated network list (default: devnet,mainnet)--codenames: Comma-separated codename list (default: bullseye,focal)--publish-to-docker-io: Publish to docker.io instead of gcr.io--only-dockers: Publish only Docker images--only-debians: Publish only Debian packages--verify: Verify published packages--dry-run: Show what would be done without executing--backend: Storage backend (gs/hetzner/local, default: gs)--debian-repo: Debian repository (default: packages.o1test.net)--debian-sign-key: Signing key for Debian packages--strip-network-from-archive: Remove network suffix from archive packages
Promote artifacts from one channel/registry to another.
release-manager promote \
--source-version 1.0.0 \
--target-version 1.0.1 \
--source-channel alpha \
--target-channel beta \
--artifacts mina-daemon,mina-archive \
--verifyRequired options:
--source-version: Source version--target-version: Target version--source-channel: Source channel (required unless --only-dockers)--target-channel: Target channel (required unless --only-dockers)
Verify that artifacts are correctly published.
release-manager verify \
--version 1.0.1 \
--channel stable \
--artifacts mina-daemon,mina-archive \
--networks devnet,mainnetRequired options:
--version: Version to verify
Copy and verify fully-named image references. The caller computes every tag; this command does not derive tags from artifact, network or profile.
# Pull once, then tag and push as each --target
release-manager docker promote \
--source europe-west3-docker.pkg.dev/o1labs-192920/euro-docker-repo/mina-daemon:4.0.1-bookworm-devnet \
--target docker.io/minaprotocol/mina-daemon:4.0.1-bookworm-devnet \
--arch amd64
# Run the package's check script inside the image. The directory must hold
# resolve-check-script.sh (mina's scripts/verify); it is mounted read-only.
release-manager docker verify \
--image docker.io/minaprotocol/mina-daemon:4.0.1-bookworm-devnet \
--package mina-daemon \
--check-scripts-dir ./scripts/verify \
[--no-pull]--no-pull checks the image already in the local daemon; --image may then
also be a local image ID (sha256:<hex>), which another job cannot re-point.
Repair Debian repository manifests.
release-manager fix \
--codenames bullseye,focal \
--channel stableRequired options:
--channel: Channel to fix
Archive artifacts to long-term storage.
release-manager persist \
--backend hetzner \
--buildkite-build-id 12345 \
--target /archive/2024 \
--codename bullseye \
--artifacts mina-daemonRequired options:
--buildkite-build-id: Build ID to persist--target: Target storage location--codename: Codename to persist
Download artifacts from cache to local directory.
release-manager pull \
--backend gs \
--buildkite-build-id 12345 \
--target ./downloads \
--artifacts mina-daemon,mina-archiveRequired options:
--buildkite-build-id: Build ID to pull
- Requires
gcloudto be installed and configured - Uses
gs://buildkite_k8s/coda/sharedas root path
- Requires SSH access with key authentication
- Configure via environment variables:
export HETZNER_USER=your-user export HETZNER_HOST=your-host export HETZNER_KEY=/path/to/key
- Uses local filesystem at
/var/storagebox/ - Useful for testing and development
Set log level with RUST_LOG environment variable:
export RUST_LOG=debug # trace, debug, info, warn, errorsrc/
├── main.rs # Main entry point
├── cli.rs # Command-line argument definitions
├── errors.rs # Error types and handling
├── storage.rs # Storage backend abstraction
├── artifacts.rs # Artifact handling functions
├── utils.rs # Utility functions
└── commands/ # Command implementations
├── mod.rs
├── publish.rs
├── promote.rs
├── verify.rs
├── fix.rs
├── persist.rs
└── pull.rs
cargo testcargo build --release
strip target/release/release-manager # Optional: reduce binary sizeThis Rust implementation preserves all functionality from the original bash script while providing:
- Better error handling and validation
- Improved performance and reliability
- Type safety and compile-time checks
- Better maintainability and testability
- Structured logging
- Cross-platform compatibility
All command-line options and behavior remain compatible with the original script.
This project follows the same license as the Mina Protocol project.