Skip to content

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Aug 24, 2025

PR Summary

Allows specifying semver requirements via the apiVersion property. Uses the https://docs.rs/semver/latest/semver/struct.VersionReq.html syntax, some examples:

  • 1.1
  • 1.1.*
  • *
  • >1.1.2
  • <=1.3.2
  • >1.1.2, <2.0.0
  • ~1.1
  • ^1.1
  • =1.1

This PR also allows for arbitrary strings for the version to support date format. However, if using this there is a warning that the version isn't semver and the requested version (via apiVersion) must be an exact match to the resource declared version.

The version isn't passed to the resource, but resources can have multiple manifests if it implements multiple versions and decide for itself how to inform the resource the version being requested.

Note that if the version requirement is semver and doesn't start with a number, then an = operator is prefixed indicating exact version. Implicit adapted resource versioning is supported since that's handled by the engine, but explicit adapter resources aren't supported in this PR as it requires changes in the adapter to handle it.

dsc resource list will now show multiple versions of a resource and dsc resource has a new --version parameter.

PR Context

Fix #543
Fix #942

@SteveL-MSFT SteveL-MSFT force-pushed the resource-versioning branch 3 times, most recently from 285d43d to 2c24b5b Compare August 27, 2025 23:58
@SteveL-MSFT SteveL-MSFT requested a review from Copilot August 28, 2025 14:41
Copy link
Contributor

@Copilot 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 enables specifying version requirements for resources in DSC configurations via the apiVersion property. It supports semver requirements using standard semver operators and syntax, as well as arbitrary strings for date-based versioning with exact matching.

Key changes:

  • Added version filtering support throughout the resource discovery and invocation pipeline
  • Modified resource resolution to handle version requirements using semver matching
  • Added command-line version parameter support for dsc resource commands

Reviewed Changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/dsctest/*.dsc.resource.json Test resource manifests for multiple versions of Test/Version resource
tools/dsctest/src/version.rs New version struct for test resource
tools/dsctest/src/main.rs Added version subcommand support
tools/dsctest/src/args.rs Added version command line arguments
extensions/bicep/bicep.tests.ps1 Test setup for date-format versioning
dsc_lib/src/lib.rs Updated find_resource API to accept version parameter
dsc_lib/src/dscerror.rs Added version-related error types
dsc_lib/src/discovery/mod.rs Core version filtering logic and resource storage changes
dsc_lib/src/discovery/discovery_trait.rs DiscoveryFilter struct for version-aware resource filtering
dsc_lib/src/discovery/command_discovery.rs Updated resource discovery to handle versioning
dsc_lib/src/configure/mod.rs Updated configurator to use versioned resource lookup
dsc_lib/locales/en-us.toml Updated localization strings
dsc/tests/*.tests.ps1 Test cases for version functionality
dsc/src/subcommand.rs Updated resource commands to support version parameter
dsc/src/resource_command.rs Modified resource operations to handle versioning
dsc/src/args.rs Added version parameter to resource command arguments
dsc/locales/en-us.toml Added version parameter localization
dsc/examples/hello_world.dsc.bicep Updated example to use new date version
dsc/Cargo.toml Added semver dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@SteveL-MSFT SteveL-MSFT marked this pull request as ready for review August 28, 2025 18:07
@SteveL-MSFT SteveL-MSFT requested a review from tgauth August 28, 2025 18:07
@SteveL-MSFT SteveL-MSFT added Doc-Impact Schema-Impact Change requires updating a canonical schema for configs or manifests labels Aug 29, 2025
Steve Lee (POWERSHELL HE/HIM) (from Dev Box) and others added 3 commits September 2, 2025 08:21
Copy link
Collaborator

@tgauth tgauth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Sep 2, 2025
Merged via the queue into PowerShell:main with commit bd569d9 Sep 2, 2025
4 checks passed
@SteveL-MSFT SteveL-MSFT deleted the resource-versioning branch September 2, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Doc-Impact Schema-Impact Change requires updating a canonical schema for configs or manifests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ARM consistent API version behavior Support version pinning in a configuration document
3 participants