remote build: odd errors for certain `architectures:` setups
Metadata
Current evaluation
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.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Remote build architecture validation and logging issues were resolved through remote-builder improvements and user-friendly error handling introduced in PR #4994. The issue is closed as the core problems have been addressed. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4996 remote build: fix cross-compiling errors and `build-for: all` errors | snapcraft | closed | Fixed by passing build-on architectures to Launchpad instead of build-for, enabling cross-compiling and correct architecture selection for build-for: all. | |
| #4780 remote build: fails with some architecture definitions | snapcraft | closed | Remote build failures with specific architecture definitions or comma-separated --build-for flags were fixed via PR #4793 and craft-application#343. | |
| #5005 fix(remotebuild): error early for multiple artifacts per build-on | snapcraft | merged | Merged. Adds early validation to prevent Launchpad build failures when multiple artifacts share the same build-on architecture. Replaces cryptic errors with a clear message, resolving issue #4995. Approved and passed CI. | |
| #4793 fix(remote-build): don't fail with certain archs | snapcraft | merged | Merged a fix for remote-build architecture failures. The changes were retargeted to the hotfix branch per reviewer request before approval and merge. | |
| #3021 remote-build: remove artifact sanity check | snapcraft | merged | Merged removal of the artifact sanity check in remote-build. The validation incorrectly failed on multi-architecture builds from Launchpad. Removing it enables direct artifact downloads without unnecessary checks. Approved and passed CI. | |
| #5265 fix(remotebuild): don't fail when cross-compiling | snapcraft | merged | Merged fix resolving remote build cross-compilation failures. Snapcraft now passes build-on architectures to Launchpad instead of build-for, enabling correct cross-compilation and addressing issue #4996. Approved by reviewers and passed CI. | |
| #2774 remote-build: architecture handling | snapcraft | merged | Merged architecture handling updates for remote-build. Modified one file with 36 additions and 30 deletions. Approved by one reviewer. Author noted missing CLI unit tests and plans a follow-up PR to address them. | |
| #989 remote-build does not exit with error upon partially successful builds | craft-application | open | remote-build exits 0 even when some architectures fail on Launchpad, because _monitor_and_complete unconditionally returns 0. Unlabeled, no maintainer response, 227 days old; bug still present in current code. | |
| #2642 remote-build: detect early build errors | snapcraft | merged | Merged. Improved remote build error detection to distinguish between pending builders and actual failures like missing config or timeouts. Approved by reviewer, passed CI, and modified 3 files (+131/-47 lines). Minor import fix applied. | |
| #5819 fix(legacy): accept --build-for on long-form architecture remote build | snapcraft | closed | Superseded by PR #6090. This PR attempted to fix legacy remote build handling of the --build-for flag with long-form architectures. Testing revealed it still failed, so the maintainer closed it in favor of a newer fix. |