snapcraft
snapcraft copied to clipboard
Modifying a part's `build-environment` doesn't trigger a rebuild
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
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
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