Skip to content

Ci/build once reuse binaries - #269

Merged
vsilent merged 3 commits into
devfrom
ci/build-once-reuse-binaries
Sep 23, 2026
Merged

vsilent merged 3 commits into
devfrom
ci/build-once-reuse-binaries

Conversation

@vsilent

@vsilent vsilent commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

robotizeit and others added 2 commits September 23, 2026 15:53
A run takes 47 minutes, and the release binaries are compiled twice in
it: once by the test job, then again from scratch inside the Docker
build. The first set was already being packed into `app.tar.gz` and
uploaded — nothing ever downloaded it.

The reason it could not simply be reused is the one that has to be got
right: the binaries are dynamically linked against glibc, and glibc is
forward- but not backward-compatible. Built on the runner (Ubuntu 24.04,
glibc 2.39) they would not start on debian:bookworm-slim (glibc 2.36).

So the test job now runs inside `rust:bookworm` — the same image the
Dockerfile builds in, and the one the runtime stage is derived from. The
environments match exactly, and the Docker job copies the artifact
instead of recompiling.

The Dockerfile keeps both paths. `BINARIES=prebuilt` takes them from a
build context; the default still compiles from source, so a local
`docker build` works unchanged. Both were verified to parse, and the
prebuilt path was built end to end: the four binaries, the config files
and the sqlx CLI all land in the image with no compilation.

Two things fell out along the way. The job now builds all four binaries
the image needs — `console` and `backfill_field_policy` were missing from
the artifact, which is part of why it could not be used. And `cargo
install sqlx-cli` moved to its own small stage with only the postgres and
rustls features, so the prebuilt path no longer pays 110 seconds of it to
fetch two YAML files.

Inside a job container, service containers resolve by name rather than
127.0.0.1, so PGHOST changes accordingly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The reference documented `required_env:` under `config_contract`. No such
field exists — the parser knows `required`, and since every contract type
denies unknown fields, anyone following the example would have had their
submission rejected. Removing it was right.

It took the whole section with it, though, leaving the reference with no
description of field policy at all: only the volume subsection added last
week remained. An author reading this file would not learn that
`mutability` exists. The design document in config/docs covers it, but
that is not where someone writing a stacker.yml looks.

Restored with the four mutabilities, the keys that apply to each, the
legacy three-list shorthand, and a note that publishing is refused until
secret-shaped fields carry a policy.

Every example here was run through the parser, including the removed
`required_env`, which is confirmed to be rejected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented Sep 23, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 6 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
37456823 Triggered Generic Password 27017fa src/helpers/bake_finalize.rs View secret
37449298 Triggered Generic Password 4b1e286 src/cli/generator/compose.rs View secret
37449299 Triggered Generic High Entropy Secret 4b1e286 src/cli/generator/compose.rs View secret
37456824 Triggered Generic High Entropy Secret 13a65d3 src/cli/generator/compose.rs View secret
37490585 Triggered Generic High Entropy Secret 51d5ff1 src/cli/generator/compose.rs View secret
37490586 Triggered Generic Password 51d5ff1 src/cli/generator/compose.rs View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

The run failed on `sudo: not found`. The container runs as root and does
not ship sudo, and it does not need to: `rust:bookworm` already has
pkg-config, libssl-dev and a C toolchain, and protoc never comes from the
system — `build.rs` points PROTOC at a vendored binary unless one is set.
Verified against the image. The step is gone.

The error that was actually reported was `no such command: nextest`,
which is not what went wrong. Both test steps carried `if: always()`, so
they ran after the setup step failed and the nextest install had been
skipped. Dropped on the first, narrowed to `success() || failure()` on
the second, which is what was wanted: run both suites even if one fails,
without reporting on an environment that was never built.

Two more, found while looking rather than by the next 47-minute run:

`--features explain` applies to the whole `cargo build`, not to the
`--bin` it follows, so folding four binaries into one invocation was
quietly shipping `server` with explain-logging on — a different binary
from the one the image has always carried. Split in two; only `console`
and the re-featured casbin dependency recompile.

`.dockerignore` is empty, so the unpacked binaries and `app.tar.gz` were
being sent to buildkit as part of `context: .` — hundreds of megabytes,
twice, eating back the time this change exists to save. They now unpack
to `runner.temp`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vsilent
vsilent merged commit c7cf9c4 into dev Sep 23, 2026
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants