Modifying a part's `build-environment` doesn't trigger a rebuild
Metadata
Current evaluation
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.
Suggested action: close resolved
Reason: craft-parts PR #1686 added build-environment to the properties tracked by BuildState in commit 2121e8ed, with an integration test confirming that changing it reruns BUILD. The fix shipped in craft-parts 2.37.0, and Snapcraft's current pyproject.toml requires craft-parts>=2.37.1.
Evaluated by: mr-cal-bot
Impact:
58
Quick Win:
48
Complexity:
14
Confidence:
99
Actionability:
96
Issue body
### Bug Description
If the `build-environment` of a part is modified, a rebuild of the part will not be triggered.
### To Reproduce
Create a snap with a part declaring a build-environment as so:
```
build-environment:
- FOO: bar
```
Build the snap and then modify `bar` to some other value.
Rerun the build and notice that the build step for the part is not retriggered.
You can also add a key key to `build-environment` such as `- FIZZ: buzz` and no rebuild of the part will be triggered.
### Environment
Ubuntu 25.04, building with snapcraft 8.11.1 and LXD latest/edge.
### snapcraft.yaml
```yaml
name: test # you probably want to 'snapcraft register <name>'
base: core24 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
# adopt-info: my-part
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
parts:
my-part:
# See 'snapcraft plugins'
plugin: nil
build-environment:
# Run the build, change bar to baz, then rerun the build
- FOO: bar
# Run the build, add -FIZZ: buzz, then rerun the build
- FIZZ: buzz
```
### Relevant log output
```shell
snapcraft pack --shell
Starting snapcraft, version 8.11.1.post53
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20250828-142159.558898.log'
Launching managed ubuntu 24.04 instance...
Starting instance
Starting snapcraft, version 8.11.1.post53
Logging execution to '/tmp/snapcraft.log'
Initialising lifecycle
Installing build-packages
Installing build-snapsc
Skipping pull for my-part (already ran)
Skipping build for my-part (already ran)
Skipping stage for my-part (already ran)
Skipping prime for my-part (already ran)
Launching shell on build environment...
snapcraft-test-amd64-4235994 ../project# cd ../parts/my-part/build/
build environment set for part 'parts'
snapcraft-test-amd64-4235994 ../parts/my-part/build# echo $FOO
bar
snapcraft-test-amd64-4235994 ../parts/my-part/build# echo $FIZZ
snapcraft-test-amd64-4235994 ../parts/my-part/build# exit
```
### Additional context
_No response_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha |
Impact:
58
Quick Win:
48
Complexity:
14
Confidence:
99
Actionability:
96
|
close resolved | 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. | |
| qwen/qwen3.6-35b-a3b |
Impact:
70
Quick Win:
39
Complexity:
30
Confidence:
70
Actionability:
80
|
close resolved | Modifying a part's build-environment doesn't trigger a rebuild. Fixed by craft-parts PR #1686. | |
| qwen/qwen3.8-27b |
Impact:
50
Quick Win:
30
Staleness:
70
Complexity:
40
Confidence:
75
Support Request:
0
|
keep open | Bug report: modifying a part's build-environment in snapcraft.yaml does not trigger a rebuild. Maintainer mr-cal commented it is the same as #5734 and that craft-parts should manage this. Issue is open, unlabelled beyond Type: Bug, and inactive for ~1 year. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
85
Complexity:
40
Confidence:
90
Support Request:
10
|
close stale | Modifying a part's build-environment doesn't trigger a rebuild. Issue is 327 days old, last activity 322 days ago. Maintainer linked it to a duplicate issue in craft-parts, indicating it's a known limitation/bug in an upstream dependency. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
45
Confidence:
80
Support Request:
10
|
needs triage | Bug report stating that changing a part's build-environment variables in snapcraft.yaml does not trigger a rebuild. Issue is over 10 months old with one comment pointing to a related issue, awaiting maintainer triage. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-parts#1686
(confidence 100%)
Merged commit 2121e8ed implements the missing build-state tracking and regression test.
-
Related To:
canonical/snapcraft#5734
(confidence 94%)
The maintainer called this the same issue; #5734 concerns the analogous missing build-snaps state tracking.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1815658 snapcraft leaks build-environment across parts | snapcraft (launchpad) | closed | Fixed by snapcore/snapcraft PR #2472 (commit 8ca7dd7f2), preventing a part's build-environment from leaking into subsequently processed parts. |