← Back to issue list

Raise an error for unfiltered build plans

View original Github issue

Metadata

Project
craft-application
Number
#719
Type
issue
State
open
Author
mr-cal
Labels
Created
2025-04-03 17:10:55+00:00
Updated
2025-05-23 17:26:43+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Overview [`create_build_plan()`](https://github.com/canonical/craft-application/blob/5cf3d4071569e281cf06f07a119e45659d00d3fb/craft_application/services/buildplan.py#L119) has undefined behavior when no filters are provided. ### Example With the following platforms snippet: ```yaml platforms: riscv64: build-on: [riscv64, amd64] s390x: build-on: s390x ``` and a call to `create_build_plan(platforms=None, build_for=None, build_on=None)` will create the following plan: ```python [ BuildInfo( platform='s390x', build_on=DebianArchitecture('s390x'), build_for=DebianArchitecture('s390x'), build_base=DistroBase(distribution='ubuntu', series='24.04'), ), BuildInfo( platform='riscv64', build_on=DebianArchitecture('amd64'), build_for=DebianArchitecture('riscv64'), build_base=DistroBase( distribution='ubuntu', series='24.04'), ), ] ``` This build plan has a subtle problem - only the first of the two `build-on`s for the `riscv64` platform is added to the plan. ### Problem Passing `None` for all three parameters is undefined. This is because `create_build_plan()` is designed to generate an actionable build plan that will create no more than one build item per platform. It isn't made to generate an unfiltered build plan, but that's not obvious and therefore it's easy to misuse this function. ### Solution Craft-application should raise an error if `platforms`, `build-on`, and `build-for` are all `None`.

Evaluation history

No evaluation history available.