Conversation
… files Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
…and fix named parameter usage Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
…onTests.ps1 and update README.md Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the WalkthroughIntroduces a PowerShell script to decide when DSC resource integration tests should run based on git diffs, adds documentation, wires the decision into Azure Pipelines to conditionally run multiple integration-test stages, and updates the changelog to note the optimization. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant PR as PR Pipeline
participant Job as Determine_DSC_Resource_Test_Requirements
participant PS as Test-ShouldRunDscResourceIntegrationTests.ps1
participant Git as Git Repo
participant Stages as Integration_Test_Resources_* Stages
participant Deploy as Deploy Stage
PR->>Job: Start job
Job->>PS: Invoke with -BaseBranch/-CurrentBranch
PS->>Git: git diff to list changed files
PS-->>Job: Return boolean ShouldRun
Job-->>PR: Set output var ShouldRunDscResourceIntegrationTests
PR->>Stages: Evaluate condition on output var
alt ShouldRun == True
Stages->>Stages: Run integration tests
else ShouldRun == False
Stages->>Stages: Skip stages
end
PR->>Deploy: Run when dependencies satisfied (incl. updated dependsOn)
sequenceDiagram
autonumber
participant Main as Test-ShouldRunDscResourceIntegrationTests
participant Disc as Get-PublicCommandsUsedByDscResources
participant Diff as Get-ChangedFiles
participant DepCmd as Get-PrivateFunctionsUsedByCommand
participant DepClass as Get-PrivateFunctionsUsedByClassResources
Main->>Disc: Discover public commands used by DSC resources
Main->>Diff: Get changed files between Base and Current
alt No changes detected
Main-->>Main: Default: run tests
else Changes present
Main-->>Main: Check DSCResources/Classes changes
Main->>DepCmd: Resolve private functions for used commands
Main->>DepClass: Resolve private functions for class resources
Main-->>Main: Check if relevant public/private/test files changed
Main-->>Main: Return True/False
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Co-authored-by: johlju <7189721+johlju@users.noreply.github.com>
johlju
left a comment
There was a problem hiding this comment.
Reviewed 1 of 2 files at r14, 2 of 2 files at r16, 1 of 1 files at r17, all commit messages.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @copilot)
Problem
The current Azure Pipelines configuration runs all DSC resource integration tests for every change, regardless of whether the changes actually affect DSC resources. This leads to:
Solution
This PR implements intelligent conditional logic to skip DSC resource integration tests when changes don't affect DSC resources, while preserving full test coverage when needed.
Key Components
Dynamic Detection Script (
.build/Test-ShouldRunDscResourceIntegrationTests.ps1)[DscResource(...)]decoration)Pipeline Modifications (
azure-pipelines.yml)Determine_DSC_Resource_Test_Requirementsjob to detect if DSC tests should runIntegration_Test_Resources_SqlServerIntegration_Test_Resources_SqlServer_dbatoolsIntegration_Test_Resources_ReportingServicesIntegration_Test_Resources_PowerBIReportServerIntegration_Test_Resources_ReportingServices_dbatoolssucceeded()logic for handling skipped dependenciesWhat Always Runs
What Runs Conditionally
DSC resource integration tests only run when changes affect:
source/DSCResources/)source/Classes/)Benefits
Example Scenarios
Will skip DSC resource tests:
Will run DSC resource tests:
Dynamic Discovery
The solution automatically discovers which public commands and private functions are used by DSC resources and classes by scanning the actual source files. This approach:
Enhanced Logging
The detection script now uses Azure DevOps logging commands for improved pipeline readability:
##vso[section]for main sections##vso[task.logissue type=warning]for important decisions (yellow)##vso[task.logissue type=debug]for informational messages##vso[group]for collapsible file listsThis optimization maintains the existing dependency order and test quality while providing substantial performance improvements for common development workflows.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
This change is