← Back to issue list

snapcraft leaks build-environment across parts

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1815658
Type
issue
State
closed
Author
~osomon
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by snapcore/snapcraft PR #2472 (commit 8ca7dd7f2), preventing a part's build-environment from leaking into subsequently processed parts.

Resolution: closed resolved

Reason: PR #2472 landed as commit 8ca7dd7f2, titled "project loader: do not leak a part's build-environment," directly resolving the cross-part environment contamination.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Just came across this while testing the build-environment keyword, here is a simple reproducer: name: test version: "1.0" summary: foo bar description: foo bar baz confinement: strict grade: stable base: core18 parts: first: plugin: nil build-environment: - FOO: bar second: plugin: nil after: [ first ] override-build: "echo FOO: $FOO" I would expect the build-environment for part "second" to be empty, but it looks like the build-environment for part "first" is leaked into other parts that are built afterward: $ SNAPCRAFT_BUILD_ENVIRONMENT=host snapcraft Pulling first 'second' has dependencies that need to be staged: first Skipping pull first (already ran) Building first Staging first Pulling second Skipping build first (already ran) Building second FOO: bar Skipping stage first (already ran) Staging second Priming first Priming second Snapping 'test' | Snapped test_1.0_amd64.snap

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by snapcore/snapcraft PR #2472 (commit 8ca7dd7f2), preventing a part's build-environment from leaking into subsequently processed parts.
stealth/space-bunny-alpha — closed resolved Fixed build-environment leakage between ordered parts by merging snapcraft PR #2472 in commit 8ca7dd7f2, isolating each part's environment and preventing unintended concatenation.
stealth/space-bunny-alpha — closed resolved Fixed in PR #2472: part-specific build-environment variables no longer leak into subsequently built parts.
qwen/qwen3.6-35b-a3b — — Closed without comments. Reports snapcraft build-environment variables leaking across parts. Likely abandoned due to inactivity, with no explicit resolution or fix noted.
qwen/qwen3.6-35b-a3b — — Reported snapcraft build-environment leakage across parts was closed with no comments or resolution details. The outcome remains unclear as no fix or rejection was documented.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#2472 (confidence 99%)

    The referenced PR is present in history as resolving commit 8ca7dd7f2.

Related issues

Issue Project State Summary Similarity
#1897337 snapcraft build <part> ignores the part snapcraft (launchpad) closed Selective part builds were restored by snapcore/snapcraft#3572, which passed named parts into lifecycle planning instead of building every defined part.
73%
#1778081 Snapcraft saves the fact that parts need to be rebuilt rather than discovering them snapcraft (launchpad) closed Fixed by snapcore/snapcraft PR #2165, replacing persisted dependency-dirty state with dependency rebuild discovery.
72%
#1876260 missing SNAPCRAFT_PART_* variables in override-prime snapcraft (launchpad) closed Missing SNAPCRAFT_PART_* env vars in override-prime fixed by merged PR snapcore/snapcraft#3122 (commit f1f127136), exposing plugin build env to all lifecycle steps while keeping build-environment scoped to build.
72%
#2744 project_loader: load build-environment after snapcraft environment snapcraft merged Merged PR #2744 (commit f3799a5dc) reordered project-loader evaluation so build-environment loads after Snapcraft's environment, enabling variables such as $SNAPCRAFT_PART_INSTALL.
71%
#5735 Modifying a part's `build-environment` doesn't trigger a rebuild snapcraft open Build-environment changes failed to invalidate cached part builds; craft-parts 2121e8ed fixed rebuild tracking, and current Snapcraft requires the fixed 2.37.1 release.
71%
#1537790 lifecycle: rebuild with snapcraft clean part1; snapcraft build part1 breaks if part1 has an 'after' field snapcraft (launchpad) closed Fixed by merged ubuntu-core/snapcraft PR #431 (commit 1e31959d1), which recognizes already-built prerequisite parts when building a selected part.
71%
#1720230 snapcraft fails in a directory with spaces snapcraft (launchpad) closed Fixed directory names with spaces by quoting environment-variable values in project_loader; merged as snapcore/snapcraft#1578 (commit d154224d7).
71%
#1805212 snapcraft try (integrated with build environments) snapcraft (launchpad) closed Merged snapcore/snapcraft#2524 as ec579eaa1, adding snapcraft try to expose the prime directory transparently in build environments.
70%