Skip to content

Conversation

@chewi
Copy link
Contributor

@chewi chewi commented Jan 27, 2026

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 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.

@github-actions github-actions bot added the components This pull request updates cached components on Linux or Windows VHDs label Jan 27, 2026
@chewi chewi force-pushed the chewi/simplify-components branch from b43d562 to 33c1e10 Compare January 27, 2026 16:14
@chewi chewi force-pushed the chewi/simplify-components branch from 33c1e10 to 2422aa9 Compare January 27, 2026 17:03
@chewi chewi force-pushed the chewi/simplify-components branch from 2422aa9 to 09b286b Compare January 28, 2026 18:36
Copilot AI review requested due to automatic review settings January 28, 2026 18:36
@chewi chewi force-pushed the chewi/simplify-components branch from 09b286b to ae35d90 Compare January 28, 2026 18:40
Copy link
Contributor

Copilot AI left a 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 versions and multiArchVersions fields 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/DEFAULT and azurelinux/OSGUARD variants 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.
chewi added 3 commits January 30, 2026 15:39
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>
Copilot AI review requested due to automatic review settings January 30, 2026 15:55
@chewi chewi force-pushed the chewi/simplify-components branch from 862f2f6 to 6949174 Compare January 30, 2026 15:55
Copy link
Contributor

Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

components This pull request updates cached components on Linux or Windows VHDs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants