Repository navigation
feat(sources): Reproducible Golang Vendor Packaging - #424
Antonio Salinas (Tonisal-byte) wants to merge 18 commits into
Conversation
Preserve upstream packaging while converting supported Go application specs and generating vendor archives from prepared sources. Wire configuration, history, documentation, and regression coverage across preparation, builds, rendering, and source diffs. Validation: ./magefile.go check all passed, including Python lint and type checks. Build and unit phases passed. Full ./magefile.go all was attempted via Podman, but Docker-oriented scenario file-mount and network-isolation expectations fail in this environment; Docker WSL integration is unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve upstream Source entries, tool configuration, and reviewed licenses when regenerating already-vendored packages. Use a common spec plan and reusable Go-only generation backend. Keep command construction in Go, automatically clone component configuration while retaining shared back-references, and exclude payloads from rendered specs. Add regression coverage and document both workflows. Validation: unit tests, build, and all quality checks passed. All ten prepared containerd files are byte-for-byte identical to the pre-refactor baseline. Full Mage scenarios remain blocked by Docker provider initialization in this WSL environment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the inline tool-config option with config-file, resolved relative to its declaring component configuration. Explicit files replace upstream settings, including empty files, and missing or invalid files fail without fallback. Hash file contents rather than checkout paths for lock fingerprints and lock-free change detection. Preserve upstream settings when no file is selected, and update the schema, documentation, emitted guidance, and regression coverage. Validation: unit tests and all quality checks passed. The changed-code mutation audit killed all 16 mutations. Containerd source generation with a separate vendor config reproduced the prior outputs, and a file-only edit invalidated its isolated lock fingerprint. Docker scenario initialization remains unavailable in this environment. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues allow host-file disclosure through symlinks and can produce incorrect archive replacements, mismatched source filenames and checksums, and duplicate patch application.
8 open issues
Source-file replacement can publish an archive with a stale digest · New Release changes can desynchronize the vendor archive filename · New Symlinked chroot output can expose host files during publication · New Generated go test command ignores the selected module directory · New Regenerated archive can cause module patches to be applied twice · New Ambiguous tar extraction can replace the wrong source archive · New Upstream module directory is ignored when config-file is omitted · New Running the archive tool from the module breaks sidecar lookup · New
Review effort: Balanced
Address the eight unique findings in PR #424: reject source-file collisions, pin expanded archive names, snapshot regular chroot outputs without following symlinks, preserve module-aware checks, extract generated metadata after prep edits, reject ambiguous extraction layouts, honor native module subdirectories, and run archive hooks from staged dist-git. Add regression coverage and update user documentation and emitted agent guidance. Unit and quality checks pass; changed-code mutation audit kills all 37 mutations. The containerd update/prepare/render/build flow and isolated RPM daemon smoke test pass, including staged-sidecar hook checks. Ran ./magefile.go scenarioUpdate before pushing; the schema snapshot is current. Full Docker-dependent scenarios remain blocked by the unavailable Docker provider. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Critical defects can break history-dependent rpmautospec processing, misplace module-specific vendor and license paths, and leave replacement configurations with stale manifest checksums and subject to deletion during rendering.
3 open issues
16 resolved since last review
Ambiguous tar extraction can replace the wrong source archive Regenerated archive can cause module patches to be applied twice Generated go test command ignores the selected module directory Symlinked chroot output can expose host files during publication Release changes can desynchronize the vendor archive filename Source-file replacement can publish an archive with a stale digest Ambiguous tar extraction can replace the wrong source archive Regenerated archive can cause module patches to be applied twice Generated go test command ignores the selected module directory Symlinked chroot output can expose host files during publication Release changes can desynchronize the vendor archive filename Source-file replacement can publish an archive with a stale digest Running the archive tool from the module breaks sidecar lookup Upstream module directory is ignored when config-file is omitted Running the archive tool from the module breaks sidecar lookup Upstream module directory is ignored when config-file is omitted
Review effort: Balanced
The Go vendor configuration intentionally extends the schema, but scenarioUpdate refreshed only the local baseline when Docker was unavailable. CI reached the container schema check and failed on the missing 37 lines. Update the container baseline to match the actual generated CLI schema and document that incomplete Docker runs can leave this second snapshot stale. Both stdout snapshots and the checked-in schema match the rebuilt CLI output byte-for-byte. Local scenario/scenarioUpdate runs remain blocked by the unavailable Docker provider. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues in module-directory handling, shared configuration isolation, and Git-history preservation can break RPM builds, leak settings between components, and fail preparation for automatic-release specs.
4 open issues
Review effort: Balanced
reuben olinsky (reubeno)
left a comment
There was a problem hiding this comment.
(Antonio Salinas (@Tonisal-byte) and I are chatting offline around the interface here.)
The Go vendor configuration intentionally extends the schema, but scenarioUpdate refreshed only the local baseline when Docker was unavailable. CI reached the container schema check and failed on the missing 37 lines. Update the container baseline to match the actual generated CLI schema and document that incomplete Docker runs can leave this second snapshot stale. Both stdout snapshots and the checked-in schema match the rebuilt CLI output byte-for-byte. Local scenario/scenarioUpdate runs remain blocked by the unavailable Docker provider. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the go-vendor source origin with automatic vendor Source discovery, optional explicit filenames and expected hashes, declaration-relative native settings, and isolated generation after overlays. Keep generated output identity out of declarative fingerprints and reuse manifest replacement and render filtering. Prepare only a private spec copy to avoid consuming the archive being generated. Do not convert published packaging, rewrite licenses, remove dependencies, or add offline build settings. Support local and upstream inputs with private rpmautospec history and reject ambiguous prep layouts. Validated mage scenarioUpdate, mage all, mage check all, and targeted regression/mutation tests. A real mock-based fixture generated explicit and discovered archives, built and ran its offline RPM, rendered idempotently without the vendor payload, and rejected stale output hashes before publication. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tonisal-byte-special-lamp
Replace the earlier implementation with the source-files design on this PR, retaining the design history and avoiding automatic changes to published specs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues can make regenerated sources unavailable to downstream builds, redirect cleanup into shared build roots, and replace the wrong archive when extraction commands are macro-wrapped.
3 open issues
4 resolved since last review
Review effort: Balanced
Use the existing batched RPM metadata to resolve the selected Source. Generation remains part of prepare and build; require a reviewed digest for render rather than downloading sources and starting a private vendor root. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues remain: inherited vendor sources can bypass validation and omit a pin, while root-location overrides can cause generation to initialize and scrub the normal build root instead of its private scratch root.
3 open issues
1 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Vendor-source validation occurs before inherited defaults are merged, allowing multiple effective sources that preparation generates but rendering silently ignores after the first.
No open issues 🎉
3 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because a critical bypass involving locally redefined prep macros can overwrite an assets archive with vendor data while preparation still consumes the original vendor input.
No open issues 🎉
Review effort: Balanced
Use the declared basename for generation and manifest rendering. Require explicit replacement of an existing upstream entry and retain upstream native config selection independently of the archive name. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| if p.generatesVendor(vendor) { | ||
| component, err = p.prepareVendorSources(ctx, component, outputDir) |


Summary
origin.type = "go-vendor"generates a Go dependency archive from patched sources in mock without rewriting the published spec.filenameis required: TOML names the generated artifact; azldev never infers its name from an upstreamSource. The spec or its overlays must consume that filename. A collision with an upstreamsourcesentry is an error unless replacement is explicitly declared.Configuration
Containerd 2.3.5 deliberately replaces its existing vendor archive:
For a new archive, choose a distinct basename and omit both replacement fields.
prepare-sourcesand builds generate and verify the archive. To bootstrap the digest, runprepare-sourceswithouthash, review the result, then pin itshash-typeandhashin TOML.renderandrender --check-onlywrite that filename and pin tosourceswithout generating or downloading the archive.Vendor settings are optional and independent of the filename. By default, generation reuses the upstream vendor config when available, otherwise tool defaults. Set
origin.config-file = "vendor-tools.toml"to use a declaration-relative native TOML file instead. It replaces upstream settings for generation only; it does not publish a new config or change which file the RPM uses for licensing. A checksum inside a native license entry identifies the license text, not the tarball.