remote build: odd errors for certain `architectures:` setups
Metadata
Current evaluation
Remote-build architecture handling was improved; #4994 (5cd480725) fixed CLI validation and #5005 (ad3b54bbd) rejected unsupported duplicate build-on artifacts.
Resolution: closed resolved
Reason: Merged PR #4994 at commit 5cd480725 corrected --build-for parsing and validation, while PR #5005 at ad3b54bbd added an early error for multiple artifacts sharing a build-on architecture. The maintainer closed the report after confirming these improvements addressed the main failures.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
The new `remote-build` method will fail under particular configurations of the `architectures` section in a `snapcraft.yaml`.
### To Reproduce
```
dilyn@Ares:~/cross-test -> mkdir cross-test && cd cross-test
dilyn@Ares:~/cross-test -> snapcraft init
{add the below section to the snapcraft.yaml}
architectures:
- build-on: [amd64]
build-for: [arm64]
dilyn@Ares:~/cross-test -> snapcraft
dilyn@Ares:~/cross-test -> snapcraft remote-build
dilyn@Ares:~/cross-test -> snapcraft remote-build --build-for=arm64
```
### Environment
Ubuntu 23.04
snapcraft 8.x (rev. 10143)
### snapcraft.yaml
```shell
name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core22 # 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
architectures:
- build-on: [amd64]
build-for: [arm64]
parts:
my-part:
# See 'snapcraft plugins'
plugin: nil
```
### Relevant log output
Logs from three different attempts:
```shell
dilyn@Ares:~/cross-test -> snapcraft
Starting Snapcraft 8.0.0
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20231212-201938.403999.log'
Running on amd64 for arm64
Launching instance...
Starting Snapcraft 8.0.0
Logging execution to '/tmp/snapcraft.log'
Running on amd64 for arm64
Initializing parts lifecycle
Installing build-packages
Installing build-snaps
Pulling my-part
Building my-part
Staging my-part
Priming my-part
Extracting and updating metadata...
Copying snap assets...
Generating snap metadata...
Generated snap metadata
Generating snap manifest...
Generated snap manifest
Reading snap metadata...
Running linters...
Running linter: classic
Running linter: library
Creating snap package...
Created snap package my-snap-name_0.1_arm64.snap
dilyn@Ares:~/cross-test -> snapcraft remote-build
Starting Snapcraft 8.0.0
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20231212-202007.454275.log'
snapcraft remote-build is experimental and is subject to change - use with caution.
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Issues while validating snapcraft.yaml: The 'architectures[0]' property does not match the required schema: additional properties are not allowed ('build-for' was unexpected) or orderedDict([('build-on', ['amd64']), ('build-for', ['arm64'])]) is not of type 'string'
dilyn@Ares:~/cross-test -> snapcraft remote-build --build-for=arm64
Starting Snapcraft 8.0.0
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20231212-202017.786399.log'
snapcraft remote-build is experimental and is subject to change - use with caution.
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Issues while validating snapcraft.yaml: The 'architectures[0]' property does not match the required schema: additional properties are not allowed ('build-for' was unexpected) or orderedDict([('build-on', ['amd64']), ('build-for', ['arm64'])]) is not of type 'string'
```
### Additional context
Some additional behavior happens in case I expand the `architectures` section to include an additional architecture:
```
architectures:
- build-on: [amd64, arm64]
build-for: [arm64]
- build-on: [amd64, armhf]
build-for: [armhf]
```
Output:
```
dilyn@Ares:~/cross-test -> snapcraft remote-build
Starting Snapcraft 8.0.0
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20231212-202200.825177.log'
snapcraft remote-build is experimental and is subject to change - use with caution.
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Issues while validating snapcraft.yaml: The 'architectures' property does not match the required schema: multiple items will build snaps that claim to run on 'amd64'
dilyn@Ares:~/cross-test -> snapcraft remote-build --build-for=arm64
Starting Snapcraft 8.0.0
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20231212-202300.295288.log'
snapcraft remote-build is experimental and is subject to change - use with caution.
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Issues while validating snapcraft.yaml: The 'architectures' property does not match the required schema: multiple items will build snaps that claim to run on 'amd64'
```
Some extra odd behavior happens if I disable fallback with `SNAPCRAFT_REMOTE_BUILD_STRATEGY=disable-fallback` and expand the architectures stanza as above:
```
dilyn@Ares:~/cross-test -> SNAPCRAFT_REMOTE_BUILD_STRATEGY=disable-fallback snapcraft remote-build
Starting Snapcraft 8.0.0
Logging execution to '/home/dilyn/.local/state/snapcraft/log/snapcraft-20231212-202415.233506.log'
snapcraft remote-build is experimental and is subject to change - use with caution.
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Setting up launchpad environment
Looking for existing build
No existing build found
If interrupted, resume with: 'snapcraft remote-build --recover --build-id snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe'
Starting build
creating git repo: name=snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe, owner=/~dilyn-corner, target=/~dilyn-corner
Sending build data to Launchpad: https://dilyn-corner:<token>@git.launchpad.net/~dilyn-corner/+git/snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe/
Registering snap job on Launchpad...
Issuing build request on Launchpad...
Waiting on Launchpad build request...
Build request accepted: 84571241
Building
Building snap package for amd64, amd64, arm64, and armhf. This may take some time to finish.
Building...
amd64: Needs building, amd64: Needs building
amd64: Currently building, amd64: Currently building - (8.0s) amd64: Currently building, amd64: Currently building - (19.amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Currently building, amd64: Currently building
amd64: Gathering build output, amd64: Gathering build output
amd64: Uploading build, amd64: Uploading build
amd64: Successfully built, amd64: Successfully built
Downloading artifacts...
Downloading: https://launchpad.net/~dilyn-corner/+snap/snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe/+build/2326477/+files/my-snap-name_0.1_arm64.snap
Snapped my-snap-name_0.1_arm64.snap
Downloading: https://launchpad.net/~dilyn-corner/+snap/snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe/+build/2326477/+files/buildlog_snap_ubuntu_jammy_amd64_snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe_BUILDING.txt.gz
Build log available at 'my-snap-name_amd64.txt'.
Downloading: https://launchpad.net/~dilyn-corner/+snap/snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe/+build/2326478/+files/my-snap-name_0.1_arm64.snap
Snapped my-snap-name_0.1_arm64.snap
Downloading: https://launchpad.net/~dilyn-corner/+snap/snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe/+build/2326478/+files/my-snap-name_0.1_armhf.snap
Snapped my-snap-name_0.1_armhf.snap
Downloading: https://launchpad.net/~dilyn-corner/+snap/snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe/+build/2326478/+files/buildlog_snap_ubuntu_jammy_amd64_snapcraft-my-snap-name-78a0da0edb2a2b9b359107180b3914fe_BUILDING.txt.gz
Build log available at 'my-snap-name_amd64.1.txt'.
Build complete.
Cleaning
Cleaning existing builds and artefacts.
Removing snap job from Launchpad...
Deleting source repository from Launchpad...
Build completed
dilyn@Ares:~/cross-test -> ls
my-snap-name_0.1_arm64.snap my-snap-name_0.1_armhf.snap my-snap-name_amd64.1.txt my-snap-name_amd64.txt snap
```
Note the repetition of building for `amd64`; especially odd as I don't expect a snap to be built for AMD64 *at all* given my `architectures` listed.
The two AMD64 build logs indicate that the builds happened on AMD64 machines, with the first log reporting that one snap was successfully built (an ARM64 one), and the second log indicating that two snaps were successfully built (both ARM64 and ARMHF). Both the snap files seem to have all the correct information for being installed on their respective architectures. However, if I had built a non-trivial snap, I'm not convinced they would actually function properly (e.g. AMD64 libs might be inside them).
Setting `force-fallback` instead results in the same error message as I mentioned earlier in this section (as expected).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Remote-build architecture handling was improved; #4994 (5cd480725) fixed CLI validation and #5005 (ad3b54bbd) rejected unsupported duplicate build-on artifacts. | |
| stealth/space-bunny-alpha | — | closed superseded | Closed as addressed by the remote-builder rework: #5005 (early error for multiple artifacts per build-on), #4994 (parse/validate --build-for/--platform with friendly error), and later #5265/#5390. Tracked internally as CRAFT-3283. | |
| stealth/space-bunny-alpha | — | closed resolved | Remote-builder architecture handling was improved, and #4994 (5cd480725) now rejects conflicting --build-for usage with a clear error. Maintainer closed the report after the main issues were addressed or tracked separately. | |
| qwen/qwen3.6-35b-a3b | — | — | Remote build architecture validation errors and misleading logs were fixed via remote-builder improvements and PR 4994. Conflicting build-for flags now yield a user-friendly error, and Launchpad reporting was corrected. Closed. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Remote-builder improvements resolved Launchpad architecture reporting issues. Using --build-for with architectures now triggers a user-friendly error via PR #4994. Remaining concerns are tracked elsewhere. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Remote builder fixes resolved Launchpad architecture reporting, and PR #4994 added a user-friendly error for conflicting --build-for and architectures settings, addressing validation and log issues. | |
| qwen/qwen3.6-35b-a3b | — | — | Remote build architecture validation and Launchpad reporting issues were resolved via remote-builder improvements. Using --build-for with defined architectures is now explicitly disallowed with a user-friendly error via PR #4994. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Remote build architecture validation and logging bugs were fixed. Remote builder improvements corrected incorrect Launchpad architecture reporting. PR #4994 added a user-friendly error for conflicting --build-for and architectures settings. Closed. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/snapcraft#4994
(confidence 99%)
Merged as commit 5cd480725 to parse and validate remote-build architecture options.
-
Likely Fixed By:
canonical/snapcraft#4995
(confidence 98%)
Tracked duplicate build-on behavior and was fixed by merged PR #5005 at ad3b54bbd.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4995 remote build: error if multiple artefacts can be built on the same architecture | snapcraft | closed | Fixed by merged PR #5005 (commit ad3b54bbd): remote builds now fail early when multiple artifacts share a build-on architecture. | |
| #5005 fix(remotebuild): error early for multiple artifacts per build-on | snapcraft | merged | Merged PR #5005 as commit ad3b54bbd, adding preflight validation to reject remote builds with multiple artifacts on the same build-on architecture; fixes #4995. | |
| #2774 remote-build: architecture handling | snapcraft | merged | Merged PR #2774 via commit 8300281d6, cleaning up and fixing remote-build architecture handling. Missing CLI unit tests were acknowledged as follow-up work. | |
| #1870730 Architectures keyword incorrectly interpreted by remote-build | snapcraft (launchpad) | closed | Remote-build treated the combined build-on list as alternatives; maintainers acknowledged an artifact-detection bug, but no fix or closing reference was recorded before #1870730 went stale. | |
| #4793 fix(remote-build): don't fail with certain archs | snapcraft | merged | Merged into the hotfix branch as commit 53ec55cef, fixing architecture-specific remote-build failures from #4780, with companion support in craft-application#343. | |
| #4780 remote build: fails with some architecture definitions | snapcraft | closed | Remote-build architecture handling was fixed by merged PR canonical/snapcraft#4793 (commit 53ec55cef), with companion support in canonical/craft-application#343. | |
| #2042167 remote-build doesn't support shorthand architecture format | snapcraft (launchpad) | closed | Remote-build now handles shorthand architectures consistently; PR #4793 fixed the underlying bug in commit 53ec55cef. | |
| #4516 regression: remote-build doesn't accept comma-seperated architectures | snapcraft | closed | Comma-separated remote-build architectures were fixed by merged PR #4543 (b8eed87c0); a later regression was superseded by #4990 and fixed by merged PR #5028 (189edf429). | |
| #3021 remote-build: remove artifact sanity check | snapcraft | merged | Merged PR #3021 (commit e4a878561) removed remote-build's artifact arch sanity check, so Launchpad results with arch 'multi' from build-on are downloaded instead of rejected. Fixes LP bug #1870730. |