-
Notifications
You must be signed in to change notification settings - Fork 244
refactor: simplify components.json code #7742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b43d562 to
33c1e10
Compare
33c1e10 to
2422aa9
Compare
2422aa9 to
09b286b
Compare
09b286b to
ae35d90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the components.json handling to simplify the code and add support for OS variants (specifically OS Guard). The changes eliminate fallback compatibility code for deprecated versions and multiArchVersions fields, streamline jq-based JSON parsing, and enable OS variant-specific package configurations.
Changes:
- Removed fallback support for deprecated
versionsandmultiArchVersionsfields in components.json - Simplified package version and URL retrieval using more efficient jq filters
- Added OS variant support to distinguish between standard Azure Linux and Azure Linux OS Guard configurations
- Updated components.json to use
azurelinux/DEFAULTandazurelinux/OSGUARDvariants for GPU-related packages - Removed OS Guard-specific conditional logic from installation scripts by using
<SKIP>markers in components.json
Reviewed changes
Copilot reviewed 24 out of 80 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| parts/linux/cloud-init/artifacts/cse_helpers.sh | Core refactor: replaced updateRelease() with getPackageJSON(), simplified version/URL extraction with jq |
| parts/linux/cloud-init/artifacts/cse_install.sh | Added OS_VARIANT parameter to package lookup functions |
| parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh | Pass OS_VARIANT to credential provider installation |
| parts/linux/cloud-init/artifacts/mariner/cse_install_mariner.sh | Pass OS_VARIANT to credential provider installation |
| parts/linux/cloud-init/artifacts/azlosguard/cse_install_osguard.sh | Pass OS_VARIANT to credential provider installation |
| vhdbuilder/packer/install-dependencies.sh | Removed OS Guard conditional checks for containerd, oras, and GPU packages |
| vhdbuilder/packer/test/linux-vhd-content-test.sh | Added OS Guard SKU detection and OS_VARIANT initialization |
| parts/common/components.json | Added OSGUARD variant with SKIP markers, changed 3 azurelinux entries to azurelinux/DEFAULT |
| schemas/components.cue | Added azurelinux/DEFAULT and azurelinux/OSGUARD to schema |
| pkg/vhdbuilder/datamodel/component_configs.go | Changed MultiArchVersions from string array to struct array |
| pkg/vhdbuilder/datamodel/component_configs_test.go | Updated test expectations for new multiArchVersionsV2 structure |
| e2e/components/components.go | Updated to check for DEFAULT variant when reading package versions |
| spec/parts/linux/cloud-init/artifacts/test_components.json | Removed deprecated multiArchVersions and versions test data |
| spec/parts/linux/cloud-init/artifacts/cse_helpers_spec.sh | Updated tests to use new getPackageJSON function, fixed typo |
| parts/linux/cloud-init/artifacts/README-COMPONENTS.md | Added documentation about OS variant support |
We almost always pass `${OS}` so make this the default.
ae35d90 to
862f2f6
Compare
jq is very powerful, you know. :) Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
testPackagesInstalled() was not testing OS Guard properly because OS and OS_VERSION were being set to Ubuntu and 3.0, matching nothing from components.json. Several components are not installed for OS Guard, but rather than add yet more shell code to handle this, simplify things by making it possible to use the OS variant in components.json. OS Guard's VARIANT_ID is osguard, but this is upper-cased by our scripts. Use DEFAULT to match an OS without VARIANT_ID. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
862f2f6 to
6949174
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 24 out of 77 changed files in this pull request and generated 1 comment.
What this PR does / why we need it:
This massively simplifies the associated code involving
jq. It's a powerful tool. 🙂This also allows the OS variant to be used in components.json for OS Guard.
testPackagesInstalled()was not testing OS Guard properly becauseOSandOS_VERSIONwere being set toUbuntuand3.0, matching nothing from components.json.Several components are not installed for OS Guard, but rather than add yet more shell code to handle this, simplify things by making it possible to use the OS variant in components.json. OS Guard's
VARIANT_IDisosguard, but this is upper-cased by our scripts. UseDEFAULTto match an OS withoutVARIANT_ID.