-
Notifications
You must be signed in to change notification settings - Fork 52
Enable specifying version for resource #1077
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
Conversation
285d43d
to
2c24b5b
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 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.
c2f7512
to
0d4b6ad
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.
LGTM
e78b945
to
001317a
Compare
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 anddsc resource
has a new--version
parameter.PR Context
Fix #543
Fix #942