feat(image): support per-image architecture overrides for aarch64 builds - #346
feat(image): support per-image architecture overrides for aarch64 builds#346binujp wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness and consistency issues (a failing string assertion in the new build-architecture test, plus a schema description mismatch with current runtime behavior) that should be resolved before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces an explicit per-image architectures configuration for images, validates it during project config validation, and enforces it in azldev image build while surfacing it in azldev image list, with accompanying docs/schema/snapshot updates.
Changes:
- Add
architecturestoImageConfigand validate that each image declares a non-empty, supported architecture list. - Enforce image architecture support during
azldev image build(defaulting--archto host arch) and include architectures inazldev image listoutput. - Regenerate docs/schema/snapshots and update tests/config fixtures for the new required field.
File summaries
| File | Description |
|---|---|
| schemas/azldev.schema.json | Schema updated to require images.*.architectures and reflects regenerated descriptions. |
| scenario/snapshots/TestSnapshotsContainer_config_generate-schema_stdout_1.snap | Snapshot updated for new schema output. |
| scenario/snapshots/TestSnapshots_config_generate-schema_stdout_1.snap | Snapshot updated for new schema output. |
| internal/projectconfig/testsuite_test.go | Update test fixtures to include required image architectures. |
| internal/projectconfig/project.go | Add validateImageArchitectures / validateArchitectureList and wire into ProjectConfig.Validate(). |
| internal/projectconfig/loader.go | Use NewProjectConfig() for default initialization before merging config files. |
| internal/projectconfig/loader_test.go | Update config fixtures for required architectures; add an image-architectures loader test. |
| internal/projectconfig/image.go | Add architectures field + helpers/constants and SupportsArchitecture. |
| internal/projectconfig/configfile_test.go | Add validation coverage for image architectures; update other validation tests for required field. |
| internal/app/azldev/cmds/image/list.go | Include architectures in list output and table summary. |
| internal/app/azldev/cmds/image/list_test.go | Assert architectures + summary in list results; add per-image architectures test. |
| internal/app/azldev/cmds/image/build.go | Validate target arch against image-supported architectures before building. |
| internal/app/azldev/cmds/image/build_internal_test.go | Add unit test coverage for build-architecture validation. |
| internal/app/azldev/agentskill/content/image.md.tmpl | Document required architectures in the image skill content. |
| docs/user/reference/config/images.md | Document the new required architectures field and supported values. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "script": { | ||
| "type": "string", | ||
| "title": "Script", | ||
| "description": "Plain shell script filename with no path separators. Relative to the declaring config file for upstream components or the component spec directory for local components. Required when origin type is 'custom'." | ||
| "description": "Shell script filename (relative to the component spec directory) to run in mock to generate this source file. Required when origin type is 'custom'." | ||
| }, |
3967acb to
40d0545
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new build-architecture validation tests contain failing assertions (and host-arch defaulting logic is currently inconsistent with its intended unsupported-host handling).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
internal/projectconfig/project.go:389
- validateArchitectureList formats the supported architecture list without quoting the literal tokens, which is inconsistent with the rest of the repo’s error-string quoting for string values. Using
%qfor the slice keeps values quoted and avoids ambiguous output.
internal/app/azldev/cmds/image/build_internal_test.go:138
- The test assertions expect backtick-quoted strings, but validateBuildArchitecture uses
%#qfor image/arch, so the error contains double-quoted Go string literals (e.g.image "gen1" ... "aarch64"). As written, these ErrorContains checks will fail.
err := validateBuildArchitecture(imageConfig, ImageArchAarch64, "amd64")
require.ErrorContains(t, err, "image `gen1` does not support architecture `aarch64`")
err = validateBuildArchitecture(imageConfig, ImageArchDefault, "arm64")
require.ErrorContains(t, err, "image `gen1` does not support architecture `aarch64`")
- Files reviewed: 15/15 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The new build-architecture error path uses an invalid format verb for a string slice (%q), which will produce broken error output and makes the added unit test assertions incorrect.
Review details
Suppressed comments (2)
internal/app/azldev/cmds/image/build.go:268
- Using %q to format a []string will produce a Go formatting error (e.g., %!q([]string=...)) in the returned message. Use %v (or join the slice) so the error is readable and tests don’t depend on undefined formatting output.
"image %#q does not support architecture %#q; supported architectures: %q",
internal/app/azldev/cmds/image/build_internal_test.go:138
- The test asserts backtick-quoted values, but validateBuildArchitecture formats with %#q, which yields double-quoted strings (e.g., "gen1"). Update the assertions to match the actual quoting so the test will pass consistently.
require.ErrorContains(t, err, "image `gen1` does not support architecture `aarch64`")
err = validateBuildArchitecture(imageConfig, ImageArchDefault, "arm64")
require.ErrorContains(t, err, "image `gen1` does not support architecture `aarch64`")
- Files reviewed: 15/15 changed files
- Comments generated: 0 new
- Review effort level: Lite
Gen1 images cannot build for aarch64, so images.toml is the only place that can convey per-image architecture metadata to CT and, downstream, to koji so it can control which architectures an image is built for. azldev does not inspect kiwi XML or other embedded image metadata to infer this, so without an explicit override in images.toml an aarch64 build for a gen1-only image fails and takes down sibling builds in the same batch. Add architecture add/remove overrides to the image config schema, loader, and validation, wire them through build and list commands, and regenerate the schema, agent skill docs, and config reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
40d0545 to
a1f1b86
Compare
There was a problem hiding this comment.
🟡 Changes recommended
There’s a confirmed runtime formatting bug in the new build-arch validation error and the new unit test assertions currently won’t match the function’s actual quoting behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
internal/app/azldev/cmds/image/build_internal_test.go:141
- These assertions expect backtick-quoted values, but
validateBuildArchitectureformats values with%#q(double-quoted strings). As written, the test will fail even when the function is behaving correctly.
err := validateBuildArchitecture(imageConfig, ImageArchAarch64, "amd64")
require.ErrorContains(t, err, "image `gen1` does not support architecture `aarch64`")
err = validateBuildArchitecture(imageConfig, ImageArchDefault, "arm64")
require.ErrorContains(t, err, "image `gen1` does not support architecture `aarch64`")
err = validateBuildArchitecture(imageConfig, ImageArchDefault, "riscv64")
require.ErrorContains(t, err, "unsupported host architecture `riscv64`")
- Files reviewed: 15/15 changed files
- Comments generated: 1
- Review effort level: Lite
Summary
Gen1 images cannot build for aarch64.
images.tomlis the only place that can convey per-image architecture metadata to CT and, downstream, to koji so it can control which architectures an image is built for — azldev does not inspect kiwi XML or other embedded image metadata to infer this. Without an explicit override, an aarch64 build for a gen1-only image fails and takes down sibling builds in the same batch.This PR adds architecture add/remove overrides to the image config schema, loader, and validation, wires them through the
buildandlistcommands, and regenerates the schema, agent skill docs, and config reference.Changes
internal/projectconfig/image.go,project.go,loader.go: add/validate per-image architecture overridesinternal/app/azldev/cmds/image/build.go,list.go: apply overrides during build/listdocs/user/reference/config/images.md,internal/app/azldev/agentskill/content/image.md.tmpl: document the new configschemas/azldev.schema.json, scenario snapshots: regenerated viamage docs/mage scenarioUpdateCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com