Repository navigation
fix(build, stapel, import): stop imports failing with sbom enabled - #470
Draft
reyreavman wants to merge 1 commit into
Draft
reyreavman wants to merge 1 commit into
reyreavman wants to merge 1 commit into
Conversation
Collaborator
Author
Verification
Review focus
Follow-up
|
With build.sbom.enable: true the SBOM network isolation marks every stage except packages as network-less, the dependencies* stages that carry import: included. Until 09f22e7 ("feat(build, stapel): sign files inside the image with a key the build container never sees") that mark never reached the import container: only BaseStage.PrepareImage applied it, and DependenciesStage.PrepareImage bypasses it. stageBuildOptions now forwards the stage's network override into the builder for every stage, so the import container started with --network=none. Under the Docker backend an import is an rsync from the import-server container over the bridge network, so the stage failed with "rsync: failed to connect ... Network unreachable (101)" and the build stopped. Mark the dependencies stages as needing network, exactly as the packages stage already is, so the SBOM isolation skips them. The stage carries no shell: commands and copies files out of an image that import: already declares and the SBOM already accounts for, so shell stages stay offline and the guarantee is unchanged. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
reyreavman
force-pushed
the
fix/build/sbom-import-network
branch
from
October 23, 2026 10:08
1869480 to
ba8d6ef
Compare
Collaborator
Author
Code Review ReportBase: Verdict
DoD Criteria
Issues
Tests as evidence (mutation loop)
The tree was restored from a copy after every mutation, Risks
Not verified
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A stapel image with
import:fails to build underbuild.sbom.enable: truewith the Docker backend: thedependencies*stage dies withrsync: failed to connect to <import-server ip>: Network unreachable (101), is retried once "in a clean container after a transport failure" and fails again withcontainer run failed: exit code 10. Repro from a clean checkout:What
build.sbom.enable: truewith the Docker backend thedependencies*(import) stages run with the backend's default network again and the import completes; previously they ran with--network=none.beforeInstall,install,beforeSetup,setup) still run with--network=noneunderbuild.sbom.enable: true, and--backend-network/ werf.yamlnetwork:still cannot open them.packagesstage is unchanged: it keeps the network it had.build.sbom.enable: falseis unchanged: no stage gets a network override.Why
With
build.sbom.enable: truethe isolation code marks every stage exceptpackagesas network-less,dependencies*included. Until 09f22e7 that mark never reached the import container: onlyBaseStage.PrepareImageapplied it andDependenciesStage.PrepareImagebypasses that path, so the write was dead and imports worked. 09f22e7 made the build phase forward a stage's own network override into the builder for every stage — to keep the sign stages closed against--backend-network— which turned the dead write live. Under the Docker backend an import is an rsync from the import-server container over the bridge network, so a network-less import stage cannot succeed.Leaving the import stage network-less buys nothing for the SBOM: the stage carries no
shell:commands and copies files out of an image thatimport:already declares and whose BOM the importing image already inherits. Marking thedependencies*stages as needing network, the waypackagesalready is, keeps shell stages offline and lets imports work.Rejected: special-casing the import stages inside the build phase's option merge — the exemption belongs where
packagesis exempted, so one rule decides which stages the SBOM isolation leaves alone.Fixes: 09f22e7 ("feat(build, stapel): sign files inside the image with a key the build container never sees")