Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7c86e37 to
284ff4c
Compare
fe4cd28 to
dd9af6f
Compare
When a compiled release omits compile-time-only packages, every shipped package whose dependency closure reaches an omitted package gets a new fingerprint and version: H(original fingerprint, original dependency key, sorted kept dependencies), where H is SHA-1 for 40-hex fingerprints and SHA-256 for 64-hex fingerprints. The dependency key matches the director's KeyGenerator, so the director stores each variant as a distinct compiled package. Table tests pin the dependency key format to the director's KeyGenerator, which has not changed since 2016. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the flag, the compiled release ships only the packages that some job's job.MF lists. Every other package is omitted, with its blob, and recorded under compile_time_packages. Shipped packages that depend on omitted packages lose those dependency edges and get rewritten identities that keep their original_fingerprint. The version gains a +trimmed suffix (.trimmed if it already contains +), and the output filename matches. When nothing is omitted, the version and output are the same as without the flag. Compilation fails when a job archive has a duplicate or non-regular job.MF, or when the release has packages but no job lists any of them. go.mod pins bosh-cli to the feature/compile-time-packages commit that adds the compile-time package fields to the release manifest types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dd9af6f to
9273047
Compare
| return | ||
| } | ||
|
|
||
| for _, fixture := range fixtures { |
There was a problem hiding this comment.
ginkgo has a native way of writing prameterised tests which may be worth using here. This isnt awful, its just a lot of code in a describe body
There was a problem hiding this comment.
Also we may hyst want to hard code the fixture names, i get it, but i dont imagine it changes so often as to be a problem
There was a problem hiding this comment.
🤖 Posted by Claude Code on behalf of @selzoc:
Good calls, both addressed in 1ae3a93:
- The glob/loop is now a
DescribeTable, with the oldItbody as the table function. - The four fixtures (routing, capi, embedded-kubernetes, os-conf) are hard-coded as
Entryrows.FIXTURESstill names the directory, since the tarballs are too big to check in. A missing env var or file fails that entry.
go test -tags fixtures compiles a fixed table of release tarballs (routing, capi, embedded-kubernetes, os-conf) found in $FIXTURES with and without --exclude-compile-time-packages, using a fake package compiler. The tarballs are too large to check in, so FIXTURES names the directory that holds them. The trimmed output must ship exactly the packages listed by job.MF files, record the rest under compile_time_packages without their blobs, and carry the trimmed version suffix. In both outputs, every compiled package has exactly one blob matching its manifest digest. When nothing is omitted, the trimmed output must be byte-identical to the output without the flag. FIXTURES_OUT keeps the compiled tarballs for inspection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9273047 to
1ae3a93
Compare
Compiled releases ship every package in the release, including toolchains like Go or Rust that are only needed to build other packages. No job uses them, and the director never installs them on a VM. They still take up space in every download, blobstore upload and export.
This adds an opt-in
--exclude-compile-time-packagesflag tobosh-agent compile. Everything is still compiled exactly as before; only the output tarball changes:release.MFdoesn't always include it.compile_time_packages, so you can see what was removed.+trimmedsuffix, or.trimmedif the version already has a+. If nothing is removed, the output is byte-for-byte the same as without the flag.Without the flag, nothing changes.
This depends on the bosh-cli
feature/compile-time-packagespr: cloudfoundry/bosh-cli#743, which adds the two new manifest fields and keeps them when releases are repacked or re-digested. go.mod points at that branch for now and should move to a bosh-cli release before this merges. Older CLIs and directors ignore the new fields.How much it saves
We trimmed the exact compiled releases that cf-deployment and bosh-deployment reference today:
About half of the releases have nothing to remove and come out unchanged.
create-envalso gets faster. Unlike the director, it installs every package a job depends on, not just the ones the job lists. For a base director that drops from 19 packages to 15, about 400 MB less to download and 1.29 GB less to unpack.Is it safe?
For normal deployments, yes: VMs only ever receive the packages their jobs list, and those are always kept.
create-envinstalls more than that, so we also checked every affected release in both deployments for files that need something from a removed package. Nothing a job uses was affected. The one thing we found was in backup-and-restore-sdk: a test helper that needs a library no job declares. It is already broken in the untrimmed release, and the backup job itself works fine.Testing
go test -tags fixtures ./releasetarball/) runs real release tarballs through the compiler with a fake package build. It checks that every kept package's blob is present and matches its checksum.To roll back, deploy the untrimmed version of the release.