remote build: fails if `--platform` or `--build-for` are passed with no `platforms` or `architectures` defined
Metadata
Current evaluation
Closed without implementation after CRAFT-3070 recorded the intended scope; no resolving PR or commit was linked.
Resolution: closed stale
Reason: The issue was closed with no implementation or maintainer resolution comment; the only maintainer update recorded CRAFT-3070's planned scope. Later remote-build work changed the relevant behavior but was not identified as this issue's resolution.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
1. If `--platform` or `--build-for` are passed and the target is not in the build plan, snapcraft will fail
2. Snapcraft accepts `--platform` for remote building core22 snaps, which shouldn't be allowed
### To Reproduce
snapcraft remote-build --launchpad-accept-public-upload --platform arm64 --verbosity verbose
### Environment
snapcraft 8.2.12
### snapcraft.yaml
```shell
name: test-snap
base: core22
version: "1.0"
summary: test snap
description: test snap
confinement: strict
parts:
my-part:
plugin: nil
```
### Relevant log output
```shell
2024-06-27 07:38:50.651 Starting snapcraft, version 8.2.12
2024-06-27 07:38:50.651 Log verbosity level set to BRIEF
2024-06-27 07:38:50.651 Configuring application...
2024-06-27 07:38:50.651 Preparing application...
2024-06-27 07:38:50.652 Build plan: platform=arm64, build_for=None
2024-06-27 07:38:50.652 Loading project file '/tmp/bar/snapcraft.yaml'
2024-06-27 07:38:50.660 Platform 'arm64' not found in the project definition.
2024-06-27 07:38:50.660 Detailed information: Valid platforms are: amd64.
2024-06-27 07:38:50.660 Full execution log: '/home/developer/.local/state/snapcraft/log/snapcraft-20240627-073850.650481.log'
```
### Additional context
Reported by @tomponline in https://chat.canonical.com/canonical/pl/um8c4px4qbdw9j498gzsu68itw
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed stale | Closed without implementation after CRAFT-3070 recorded the intended scope; no resolving PR or commit was linked. | |
| stealth/space-bunny-alpha | — | closed stale | Closed without implementation; CRAFT-3070 only defined a planned scope to restrict --platform/--build-for and reject their use with core22. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed pending implementation per defined scope: restrict --platform/--build-for flags to projects without explicit platform definitions and block their use for core22 snaps. Tracked in Jira CRAFT-3070. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed by implementing validation to restrict --platform and --build-for flags to projects without predefined architectures, and blocking their use for core22 snaps. Resolved via CRAFT-3070. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed with a defined scope to restrict --platform and --build-for flags to projects lacking build plan definitions, and to block --platform for core22 snaps. Tracked via Jira CRAFT-3070. No implementation or merge documented. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed after implementing validation to restrict --platform and --build-for flags to projects without predefined platforms or architectures. The fix also blocks --platform usage for core22 snaps, resolving the remote build failures. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/snapcraft#5216
(confidence 95%)
Later reworked remote builds by dropping --platform and making --build-for filter the build plan.
-
Related To:
canonical/snapcraft#5351
(confidence 90%)
Later added early errors for invalid platform usage.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #6453 fix(remote-build): error with a resolution when '--platform' is used | snapcraft | closed | PR #6453 proposed clearer remote-build --platform guidance pointing to --build-for, but was closed unmerged after no review; issue #5387 remains open. | |
| #5351 fix(remote): error early for invalid platform usage | snapcraft | merged | PR #5351 merged as commit 0c224fc7d, adding an early, friendlier error when --build-for is used with shorthand project platforms instead of failing at Launchpad. Fixes #5270 (CRAFT-4186); restriction later lifted by #5687. | |
| #5387 Warn if `--platform` is used for remote builds | snapcraft | open | Remote-build still rejects removed --platform input without clear migration guidance; triaged issue remains open because PR #6453 was closed unmerged. |