Repository navigation
feat(sources): Reproducible Golang Vendor Packaging - #424
Antonio Salinas (Tonisal-byte) wants to merge 5 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
| for name, contents := range map[string][]byte{specName: finalSpec, plan.ConfigName: []byte(toolConfig)} { | ||
| if err := fileutils.WriteFile(p.fs, filepath.Join(outputDir, name), contents, fileperms.PublicFile); err != nil { | ||
| return fmt.Errorf("publishing Go vendor file %#q:\n%w", name, err) |
| "cd " + sourceMount, | ||
| "mkdir -p " + topDir + "/BUILD", | ||
| quote("git", "config", "--global", "--add", "safe.directory", sourceMount), | ||
| quote("rpmautospec", "process-distgit", request.SpecName, request.SpecName), |
| if configSource != "" { | ||
| return prepareExistingGoVendor(tree, configSource) |
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
| if other.GoVendor != nil && other.GoVendor.Enabled != nil { | ||
| config := *c.GoVendor |


Summary
Adds per-component Go vendoring while preserving upstream packaging. Custom settings live in a separate TOML file, whose contents are included in change detection.
Configuration
The file replaces upstream settings without merging. Omit
config-fileto reuse upstream settings when available. Missing or invalid configured files fail explicitly.Workflow
prepare-sourcesruns%prepand generates the vendor archive—not a full RPM build.