Skip to content

Commit b0ab2c3

Browse files
authored
feat: extend TOML schema to support build hints + known failures (#500)
1 parent 850bb4c commit b0ab2c3

File tree

4 files changed

+133
-0
lines changed

4 files changed

+133
-0
lines changed

internal/projectconfig/build.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@ type ComponentBuildConfig struct {
4242
Undefines []string `toml:"undefines,omitempty" json:"undefines,omitempty" jsonschema:"title=Undefined macros,description=Macro names to undefine when passing to the builder."`
4343
// Check section configuration.
4444
Check CheckConfig `toml:"check,omitempty" json:"check,omitempty" jsonschema:"title=Check configuration,description=Configuration for the %check section"`
45+
// Failure configuration and policy for this component's build.
46+
Failure ComponentBuildFailureConfig `toml:"failure,omitempty" json:"failure,omitempty" jsonschema:"title=Build failure configuration,description=Configuration and policy regarding build failures for this component."`
47+
// Hints for how or when to build the component; must not be required for correctness of builds.
48+
Hints ComponentBuildHints `toml:"hints,omitempty" json:"hints,omitempty" jsonschema:"title=Build hints,description=Non-essential hints for how or when to build the component."`
49+
}
50+
51+
// ComponentBuildFailureConfig encapsulates configuration and policy regarding a component's
52+
// build failure.
53+
type ComponentBuildFailureConfig struct {
54+
// Expected indicates that this component is expected to fail building. This is intended to be used as a temporary
55+
// marker for components that are expected to fail until they can be fixed.
56+
Expected bool `toml:"expected,omitempty" json:"expected,omitempty" jsonschema:"title=Expected failure,description=Indicates that this component is expected to fail building."`
57+
// ExpectedReason provides a required justification when Expected is true.
58+
ExpectedReason string `toml:"expected-reason,omitempty" json:"expectedReason,omitempty" jsonschema:"title=Expected failure reason,description=Required justification for why this component is expected to fail building."`
59+
}
60+
61+
// ComponentBuildHints encapsulates non-essential hints for how or when to build a component.
62+
// These are not required for correctness of builds, but may be used by tools to provide guidance
63+
// or optimizations.
64+
type ComponentBuildHints struct {
65+
// Expensive indicates that building this component is relatively expensive compared to the rest of the distro.
66+
Expensive bool `toml:"expensive,omitempty" json:"expensive,omitempty" jsonschema:"title=Expensive to build,description=Indicates that building this component is expensive and should be carefully considered when scheduling."`
4567
}
4668

4769
// Validate checks that the build configuration is valid.

scenario/__snapshots__/TestSnapshotsContainer_config_generate-schema_stdout_1.snap

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,43 @@
5757
"$ref": "#/$defs/CheckConfig",
5858
"title": "Check configuration",
5959
"description": "Configuration for the %check section"
60+
},
61+
"failure": {
62+
"$ref": "#/$defs/ComponentBuildFailureConfig",
63+
"title": "Build failure configuration",
64+
"description": "Configuration and policy regarding build failures for this component."
65+
},
66+
"hints": {
67+
"$ref": "#/$defs/ComponentBuildHints",
68+
"title": "Build hints",
69+
"description": "Non-essential hints for how or when to build the component."
70+
}
71+
},
72+
"additionalProperties": false,
73+
"type": "object"
74+
},
75+
"ComponentBuildFailureConfig": {
76+
"properties": {
77+
"expected": {
78+
"type": "boolean",
79+
"title": "Expected failure",
80+
"description": "Indicates that this component is expected to fail building."
81+
},
82+
"expected-reason": {
83+
"type": "string",
84+
"title": "Expected failure reason",
85+
"description": "Required justification for why this component is expected to fail building."
86+
}
87+
},
88+
"additionalProperties": false,
89+
"type": "object"
90+
},
91+
"ComponentBuildHints": {
92+
"properties": {
93+
"expensive": {
94+
"type": "boolean",
95+
"title": "Expensive to build",
96+
"description": "Indicates that building this component is expensive and should be carefully considered when scheduling."
6097
}
6198
},
6299
"additionalProperties": false,

scenario/__snapshots__/TestSnapshots_config_generate-schema_stdout_1.snap

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,43 @@
5757
"$ref": "#/$defs/CheckConfig",
5858
"title": "Check configuration",
5959
"description": "Configuration for the %check section"
60+
},
61+
"failure": {
62+
"$ref": "#/$defs/ComponentBuildFailureConfig",
63+
"title": "Build failure configuration",
64+
"description": "Configuration and policy regarding build failures for this component."
65+
},
66+
"hints": {
67+
"$ref": "#/$defs/ComponentBuildHints",
68+
"title": "Build hints",
69+
"description": "Non-essential hints for how or when to build the component."
70+
}
71+
},
72+
"additionalProperties": false,
73+
"type": "object"
74+
},
75+
"ComponentBuildFailureConfig": {
76+
"properties": {
77+
"expected": {
78+
"type": "boolean",
79+
"title": "Expected failure",
80+
"description": "Indicates that this component is expected to fail building."
81+
},
82+
"expected-reason": {
83+
"type": "string",
84+
"title": "Expected failure reason",
85+
"description": "Required justification for why this component is expected to fail building."
86+
}
87+
},
88+
"additionalProperties": false,
89+
"type": "object"
90+
},
91+
"ComponentBuildHints": {
92+
"properties": {
93+
"expensive": {
94+
"type": "boolean",
95+
"title": "Expensive to build",
96+
"description": "Indicates that building this component is expensive and should be carefully considered when scheduling."
6097
}
6198
},
6299
"additionalProperties": false,

schemas/azldev.schema.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,43 @@
5757
"$ref": "#/$defs/CheckConfig",
5858
"title": "Check configuration",
5959
"description": "Configuration for the %check section"
60+
},
61+
"failure": {
62+
"$ref": "#/$defs/ComponentBuildFailureConfig",
63+
"title": "Build failure configuration",
64+
"description": "Configuration and policy regarding build failures for this component."
65+
},
66+
"hints": {
67+
"$ref": "#/$defs/ComponentBuildHints",
68+
"title": "Build hints",
69+
"description": "Non-essential hints for how or when to build the component."
70+
}
71+
},
72+
"additionalProperties": false,
73+
"type": "object"
74+
},
75+
"ComponentBuildFailureConfig": {
76+
"properties": {
77+
"expected": {
78+
"type": "boolean",
79+
"title": "Expected failure",
80+
"description": "Indicates that this component is expected to fail building."
81+
},
82+
"expected-reason": {
83+
"type": "string",
84+
"title": "Expected failure reason",
85+
"description": "Required justification for why this component is expected to fail building."
86+
}
87+
},
88+
"additionalProperties": false,
89+
"type": "object"
90+
},
91+
"ComponentBuildHints": {
92+
"properties": {
93+
"expensive": {
94+
"type": "boolean",
95+
"title": "Expensive to build",
96+
"description": "Indicates that building this component is expensive and should be carefully considered when scheduling."
6097
}
6198
},
6299
"additionalProperties": false,

0 commit comments

Comments
 (0)