Modifying a build-snap doesn't trigger a change
Bug Description
If the channel of a specific build snap is modified, a rebuild of the specific part will not be triggered.
To Reproduce
Create a snap with a part declaring a build-snap as so:
build-snaps: [foo/bar/baz]
Build the snap and then modify bar/baz to some other valid track/risk for the foo snap.
Rerun the build and notice that the build step for the part is not retriggered.
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'
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:
- FOO: bar
# Get past the point where build-snaps are installed in the env and change 12 to e.g. 22, do another build
build-snaps: [node/12/stable]
Relevant log output
snapcraft pull --shell
Starting snapcraft, version 8.11.1.post53
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20250828-141221.610376.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-snapssn
Launching shell on build environment...
snapcraft-test-amd64-4235994 ../project# snap list
Name Version Rev Tracking Publisher Notes
core 16-2.61.4-20250626 17247 latest/stable canonical✓ core
core24 20250618 1055 - canonical✓ base
node 12.22.12 6195 12/stable iojs✓ classic
snapcraft 8.11.1.post53 x1 - - classic
snapd 2.71 25202 latest/stable canonical✓ snapd
snapcraft-test-amd64-4235994 ../project# exit
Additional context
Noticed this when working around an issue where I needed to update the version of node in my build environment. I was using node from 12/stable but needed at least node from 18/stable. s/12/18/ was insufficienet to resolve the issue, because the modified snap channel was not considered when validating the build environment.