Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ae0bf27
Initial plan
Copilot Aug 16, 2025
96ea680
Add script to determine when DSC resource integration tests should run
Copilot Aug 16, 2025
8974f5f
Implement conditional DSC resource integration tests based on changed…
Copilot Aug 16, 2025
b0ec675
Update CHANGELOG for DSC resource integration test optimization
Copilot Aug 16, 2025
ff30260
Implement dynamic discovery of public commands used by DSC resources …
Copilot Aug 16, 2025
6e5f20e
Simplify Deploy stage condition by removing complex DSC test logic
Copilot Aug 16, 2025
fe6818a
Fix formatting and style issues in Test-ShouldRunDscResourceIntegrati…
Copilot Aug 16, 2025
3237291
Revert unrelated changes
johlju Aug 16, 2025
3e8f0b1
Improve output formatting for better readability in Azure Pipelines logs
Copilot Aug 16, 2025
c15e72a
Add detection of private functions used by class-based DSC resources
Copilot Aug 16, 2025
caad18c
Add Azure DevOps logging commands for improved pipeline log readability
Copilot Aug 16, 2025
618ab65
Fix Azure DevOps logging commands and warning message formats
Copilot Aug 16, 2025
d89602a
Remove ##[warning] prefixes, add ##[endgroup] tags, and remove pipeli…
Copilot Aug 16, 2025
1ae4e34
Remove exit codes and set proper Azure DevOps output variable
Copilot Aug 16, 2025
a90f50a
Move output variable setting to azure-pipelines.yml inline script and…
Copilot Aug 16, 2025
61cd40b
Remove trailing whitespace from all blank lines in modified files
Copilot Aug 16, 2025
a9ca344
Merge branch 'main' into copilot/fix-fdccc632-9ffe-4f0e-8c81-5dba10fa…
johlju Aug 17, 2025
65f9220
Fix markdown formatting issues in .build/README.md
Copilot Aug 17, 2025
a2b9b7e
Update .build/Test-ShouldRunDscResourceIntegrationTests.ps1
johlju Aug 17, 2025
e02341a
Update .build/Test-ShouldRunDscResourceIntegrationTests.ps1
johlju Aug 17, 2025
a7db956
Update CHANGELOG.md
johlju Aug 17, 2025
2f29563
Update CHANGELOG.md
johlju Aug 17, 2025
ed6420b
Fix markdown formatting issues and remove trailing whitespace
Copilot Aug 17, 2025
6e80d8c
Fix README.md
johlju Aug 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# DSC Resource Integration Test Optimization

This document describes the script used to dynamically determine whether DSC
resource integration tests should run in Azure Pipelines.

## What the Script Does

The `Test-ShouldRunDscResourceIntegrationTests.ps1` script analyzes git
changes between two references and determines if DSC resource integration tests
need to run. It automatically discovers which public commands are used by DSC
resources and classes, then checks if any relevant files have been modified.

## How It Works

The script checks for changes to:

1. **DSC Resources**: Files under `source/DSCResources/`
1. **Classes**: Files under `source/Classes/`
1. **Public Commands**: Commands that are actually used by DSC resources or
classes (dynamically discovered)
1. **Private Functions**: Functions used by the monitored public commands or
class-based DSC resources
1. **Integration Tests**: DSC resource integration test files under
`tests/Integration/Resources/`

## Usage

### Azure Pipelines

The Azure Pipelines task sets an output variable that downstream stages can
use to conditionally run DSC resource integration tests. The script returns
a boolean value that the pipeline captures, e.g.:

```yaml
- powershell: |
$shouldRun = ./.build/Test-ShouldRunDscResourceIntegrationTests.ps1 -BaseBranch $targetBranch -CurrentBranch HEAD
Write-Host "##vso[task.setvariable variable=ShouldRunDscResourceIntegrationTests;isOutput=true]$shouldRun"
displayName: 'Determine if DSC resource tests should run'
```

Downstream stages reference this output variable using the pattern:
`dependencies.JobName.outputs['StepName.VariableName']` to gate their
execution based on whether DSC resource tests should run.

### Command Line

```powershell
# Basic usage (compares current HEAD with origin/main)
.build/Test-ShouldRunDscResourceIntegrationTests.ps1

# Custom branches
.build/Test-ShouldRunDscResourceIntegrationTests.ps1 -BaseBranch 'origin/dev' \
-CurrentBranch 'feature-branch'
```

## Dynamic Discovery

The script automatically discovers public commands used by DSC resources by
scanning source files, eliminating the need to maintain hardcoded lists.
This ensures accuracy and reduces maintenance overhead.
Loading
Loading