KEMBAR78
Add `Copy` support for resources by SteveL-MSFT · Pull Request #1099 · PowerShell/DSC · GitHub
Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Sep 10, 2025

PR Summary

Add copy support for resources. This PR does not include copy support for variables nor properties which will come later. The mode and batchSize properties for copy are not supported.

Symbolic names aren't supported, that'll be added as part of ARM Language 2.0 work

PR Context

Fix #496

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 adds copy support for resources to enable looping functionality in DSC configurations. It introduces a new copyIndex() function that can be used within copy loops to generate dynamic resource names and properties based on the current iteration index.

  • Introduces copy loop functionality for resources with unrolling during configuration validation
  • Adds the copyIndex() function for accessing loop indices with support for offsets and named loops
  • Restricts usage of reference() function within copy loops to prevent invalid state dependencies

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
dsc_lib/src/functions/reference.rs Prevents reference() function usage in copy mode
dsc_lib/src/functions/mod.rs Registers the new copyIndex function
dsc_lib/src/functions/copy_index.rs Implements the copyIndex() function with loop index access
dsc_lib/src/configure/mod.rs Adds copy loop unrolling logic during configuration validation
dsc_lib/src/configure/context.rs Extends context with copy-related state tracking
dsc_lib/src/configure/config_doc.rs Changes copy count and batch size fields from i32 to i64
dsc_lib/locales/en-us.toml Adds localized error messages for copy functionality
dsc/tests/dsc_copy.tests.ps1 Comprehensive test coverage for copy loop functionality

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

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Sep 12, 2025
Merged via the queue into PowerShell:main with commit 1cc08d6 Sep 12, 2025
4 checks passed
@SteveL-MSFT SteveL-MSFT deleted the copy-loop branch September 12, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy loop iteration

2 participants