feat(lib): add support for single-file bundler outputs - #464
Conversation
jsteinich
left a comment
There was a problem hiding this comment.
Closes the two items the bundler harness flagged as capability gaps — archive-shaped artifacts and the decline protocol — and ChainBundler is careful in the places that matter: folding every leg's key so identity cannot depend on which leg runs, rejecting conflicting outputFileName values at construction, and throwing when all legs decline. validateOutputShape checks the declared type against both the filesystem and the packaging on both branches. CI is green.
One blocker and a few smaller things, below. Two more that do not anchor anywhere in particular:
Validation moved entirely to synth time. The constructor guard is gone, so an incompatible bundler/packaging pair now fails inside stage() — after the bundler has run, which for a Docker build is minutes rather than milliseconds. Some of that is unavoidable, since the output shape is not known until bundle() returns. But outputFileName is declared statically: a bundler that sets it is announcing FILE output, so checking at construction that it pairs with file-accepting packaging would catch the common misconfiguration immediately and leave validateOutputShape as the backstop for the dynamic case. That is the same code site as the traversal fix below.
BundleResult.declined() reports outputType: DIRECTORY as a placeholder. Gated by isDeclined, so harmless today, but anyone reading outputType without checking it first gets a wrong answer.
78c9be8 to
abe2310
Compare
|
Thanks for the review. All addressed:
|
jsteinich
left a comment
There was a problem hiding this comment.
Previous round all landed — SAFE_OUTPUT_FILE_NAME (verified against traversal, absolute, separator and ./.. inputs), the construction-time packaging check, the ChainBundler error factories, the equivalence caveat in the docs, and hashOutput using catch rather than finally so the success path still hands its scratch to stage().
Two more, one blocking.
abe2310 to
c37671a
Compare
Related issue
Spin-off from #339, per the core split in #380.
Description
Lets a bundler produce a single-file artifact (a tarball, a deterministic
.zip) instead of only a directory tree, so a directory source can bundle into anAssetType.FILE.BundleResultas theIAssetBundler.bundle()return type (replacing the bare directorystring), carrying the artifact path and its shape via the newBundleOutputTypeenumBundleResult.declined()when it cannot run in the current environment, andChainBundlerfalls through to the next bundlerIAssetBundler.outputFileNameso a single-file artifact is staged under a declared name; thread it throughTerraformAsset.fileNameAssetStaging.validateOutputShape(), which checks the declared output type against the filesystem and against the packaging (file output needsAssetType.FILE, directory output needs directory-accepting packaging)Checklist