Skip to content

Commit f02ef17

Browse files
authored
Fix doc generation (#91)
1 parent 6ada95e commit f02ef17

12 files changed

Lines changed: 157 additions & 123 deletions

File tree

.codecov.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
codecov:
2-
notify:
3-
require_ci_to_pass: no
2+
require_ci_to_pass: no
3+
# main should be the baseline for reporting
4+
branch: main
45

56
comment:
6-
layout: "reach, diff"
7+
layout: "reach, diff, flags, files"
78
behavior: default
89

910
coverage:
@@ -22,3 +23,6 @@ coverage:
2223
# and let codecov.io set the goal for the code changed in the patch.
2324
target: auto
2425
threshold: 5
26+
27+
fixes:
28+
- '^\d+\.\d+\.\d+::source' # move path "X.Y.Z" => "source"

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
- Rename `Tests` directory to `tests`.
3131
- Updated Unit tests to Pester 5 DscCommunity format.
3232
- Update references of `master` branch to `main`.
33+
- Fix Doc Generation.
34+
- Update `azure-pipelines` to use latest pattern.
3335

3436
### Added
3537

README.md

Lines changed: 10 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Azure DevOps tests](https://img.shields.io/azure-devops/tests/dsccommunity/UpdateServicesDsc/21/main)](https://dsccommunity.visualstudio.com/UpdateServicesDsc/_test/analytics?definitionId=21&contextType=build)
66
[![PowerShell Gallery (with prereleases)](https://img.shields.io/powershellgallery/vpre/UpdateServicesDsc?label=UpdateServicesDsc%20Preview)](https://www.powershellgallery.com/packages/UpdateServicesDsc/)
77
[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/UpdateServicesDsc?label=UpdateServicesDsc)](https://www.powershellgallery.com/packages/UpdateServicesDsc/)
8+
[![codecov](https://codecov.io/gh/dsccommunity/UpdateServicesDsc/branch/main/graph/badge.svg)](https://codecov.io/gh/dsccommunity/UpdateServicesDsc)
89

910
The **UpdateServicesDsc** module contains DSC resources
1011
for deployment and configuration of Windows Server Update Services.
@@ -29,87 +30,15 @@ full release to [PowerShell Gallery](https://www.powershellgallery.com/).
2930

3031
Please check out common DSC Community [contributing guidelines](https://dsccommunity.org/guidelines/contributing).
3132

32-
## Installation
33-
34-
### From GitHub source code
35-
36-
To manually install the module, download the source code from GitHub and unzip
37-
the contents to the '$env:ProgramFiles\WindowsPowerShell\Modules' folder.
38-
39-
### From PowerShell Gallery
40-
41-
To install from the PowerShell gallery using PowerShellGet (in PowerShell 5.0)
42-
run the following command:
43-
44-
```powershell
45-
Find-Module -Name UpdateServicesDsc | Install-Module
46-
```
47-
48-
To confirm installation, run the below command and ensure you see the SQL Server
49-
DSC resources available:
50-
51-
```powershell
52-
Get-DscResource -Module UpdateServicesDsc
53-
```
54-
55-
## Requirements
56-
57-
The minimum Windows Management Framework (PowerShell) version required is 5.0
58-
or higher, which ships with Windows 10 or Windows Server 2016,
59-
but can also be installed on Windows 7 SP1, Windows 8.1,
60-
Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2.
61-
62-
## Details
63-
64-
**UpdateServicesApprovalRule** resource has following properties
65-
66-
* **Ensure**: An enumerated value that describes if the ApprovalRule is available
67-
* **Name**: Name of the approval rule.
68-
* **Classifications**: Classifications in the approval rule.
69-
* **Products**: Products in the approval rule.
70-
* **ComputerGroups**: Computer groups the approval rule applies to.
71-
* **Enabled**: Whether the approval rule is enabled.
72-
* **Synchronize**: Synchronize after creating or updating the approval rule.
73-
74-
**UpdateServicesCleanup** resource has following properties:
75-
76-
* **Ensure**: An enumerated value that describes if the WSUS cleanup task exists.
77-
* **DeclineSupersededUpdates**: Decline updates that have not been approved for
78-
30 days or more, are not currently needed by any clients, and are superseded by an approved update.
79-
* **DeclineExpiredUpdates**: Decline updates that aren't approved and have been expired by Microsoft.
80-
* **CleanupObsoleteUpdates**: Delete updates that are expired and have not been
81-
approved for 30 days or more, and delete older update revisions that have not
82-
been approved for 30 days or more.
83-
* **CompressUpdates**: Compress updates.
84-
* **CleanupObsoleteComputers**: Delete computers that have not contacted the server in 30 days or more.
85-
* **CleanupUnneededContentFiles**: Delete update files that aren't needed by updates or downstream servers.
86-
* **CleanupLocalPublishedContentFiles**: Cleanup local published content files.
87-
* **TimeOfDay** Time of day to start cleanup.
88-
89-
**UpdateServicesServer** resource has following properties:
90-
91-
* **Ensure**: An enumerated value that describes if WSUS is configured.
92-
* **SetupCredential**: Credential to be used to perform the initial configuration.
93-
* **SQLServer**: SQL Server for the WSUS database, omit for Windows Internal Database.
94-
* **ContentDir**: Folder for WSUS update files.
95-
* **UpdateImprovementProgram**: Join the Microsoft Update Improvement Program.
96-
* **UpstreamServerName**: Upstream WSUS server, omit for Microsoft Update.
97-
* **UpstreamServerPort**: Port of upstream WSUS server.
98-
* **UpstreamServerSSL**: Use SSL with upstream WSUS server.
99-
* **UpstreamServerReplica**: Replica of upstream WSUS server.
100-
* **ProxyServerName**: Proxy server to use when synchronizing, omit for no proxy.
101-
* **ProxyServerPort**: Proxy server port.
102-
* **ProxyServerCredential**: Proxy server credential, omit for anonymous.
103-
* **ProxyServerCredentialUsername**: Proxy server credential username.
104-
* **ProxyServerBasicAuthentication**: Allow proxy server basic authentication.
105-
* **Languages**: Update languages, * for all.
106-
* **Products**: Update products, * for all.
107-
* **Classifications**: Update classifications, * for all.
108-
* **SynchronizeAutomatically**: Synchronize automatically.
109-
* **SynchronizeAutomaticallyTimeOfDay**: First synchronization.
110-
* **SynchronizationsPerDay**: Synchronizations per day.
111-
* **Synchronize**: Begin initial synchronization.
112-
* **ClientTargetingMode**: An enumerated value that describes if how the Target Groups are populated.
33+
## Change log
34+
35+
A full list of changes in each version can be found in the [change log](CHANGELOG.md).
36+
37+
## Documentation
38+
39+
The documentation can be found in the [UpdateServicesDsc Wiki](https://github.com/dsccommunity/UpdateServicesDsc/wiki).
40+
The DSC resources schema files are used to automatically update the
41+
documentation on each PR merge.
11342

11443
## Versions
11544

azure-pipelines.yml

Lines changed: 80 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
trigger:
22
branches:
33
include:
4-
- main
4+
- main
55
paths:
6-
exclude:
7-
- CHANGELOG.md
6+
include:
7+
- source/*
88
tags:
99
include:
10-
- "v*"
10+
- 'v*'
1111
exclude:
12-
- "*-*"
12+
- '*-*'
1313

1414
variables:
1515
buildFolderName: output
1616
buildArtifactName: output
1717
testResultFolderName: testResults
18+
testArtifactName: testResults
19+
sourceFolderName: source
1820
defaultBranch: main
1921

2022
stages:
@@ -53,79 +55,121 @@ stages:
5355
publishLocation: 'pipeline'
5456
parallel: true
5557

56-
- stage: Test
58+
- stage: Quality_Test_and_Unit_Test
59+
displayName: 'Quality Test and Unit Test'
5760
dependsOn: Build
5861
jobs:
5962
- job: Test_HQRM
6063
displayName: 'HQRM'
6164
pool:
6265
vmImage: 'windows-latest'
63-
timeoutInMinutes: 0
66+
timeoutInMinutes: '0'
6467
steps:
6568
- task: DownloadPipelineArtifact@2
66-
displayName: 'Download Build Artifact'
69+
displayName: 'Download Pipeline Artifact'
6770
inputs:
6871
buildType: 'current'
6972
artifactName: $(buildArtifactName)
7073
targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'
74+
7175
- task: PowerShell@2
7276
name: test
7377
displayName: 'Run HQRM Test'
7478
inputs:
7579
filePath: './build.ps1'
7680
arguments: '-Tasks hqrmtest'
7781
pwsh: false
82+
7883
- task: PublishTestResults@2
7984
displayName: 'Publish Test Results'
80-
condition: succeededOrFailed()
8185
inputs:
8286
testResultsFormat: 'NUnit'
8387
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
8488
testRunTitle: 'HQRM'
89+
condition: succeededOrFailed()
8590

8691
- job: Test_Unit
8792
displayName: 'Unit'
93+
strategy:
94+
matrix:
95+
Windows Server 2022:
96+
vmImage: 'windows-2022'
97+
Windows Server 2025:
98+
vmImage: 'windows-2025'
8899
pool:
89-
vmImage: 'windows-latest'
90-
timeoutInMinutes: 0
100+
vmImage: $(vmImage)
101+
timeoutInMinutes: '0'
91102
steps:
92-
- powershell: |
93-
$repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/'
94-
95-
echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner"
96-
echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName"
97-
name: dscBuildVariable
98-
displayName: 'Set Environment Variables'
99103
- task: DownloadPipelineArtifact@2
100-
displayName: 'Download Build Artifact'
104+
displayName: 'Download Pipeline Artifact'
101105
inputs:
102106
buildType: 'current'
103107
artifactName: $(buildArtifactName)
104-
targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'
108+
targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'
109+
105110
- task: PowerShell@2
106111
name: test
107112
displayName: 'Run Unit Test'
108113
inputs:
109114
filePath: './build.ps1'
110115
arguments: "-Tasks test -PesterScript 'tests/Unit'"
111-
pwsh: false
116+
pwsh: true
117+
112118
- task: PublishTestResults@2
113119
displayName: 'Publish Test Results'
114-
condition: succeededOrFailed()
115120
inputs:
116121
testResultsFormat: 'NUnit'
117122
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
118-
testRunTitle: 'Unit (Windows Server Core)'
119-
- task: PublishCodeCoverageResults@1
120-
displayName: 'Publish Code Coverage'
123+
testRunTitle: 'Unit $(vmImage)'
121124
condition: succeededOrFailed()
125+
126+
- task: PublishPipelineArtifact@1
127+
displayName: 'Publish Test Artifact'
128+
inputs:
129+
targetPath: '$(buildFolderName)/$(testResultFolderName)/'
130+
artifactName: '$(testArtifactName)_$(vmImage)'
131+
132+
- job: Code_Coverage
133+
displayName: 'Publish Code Coverage'
134+
dependsOn: Test_Unit
135+
pool:
136+
vmImage: 'ubuntu-latest'
137+
timeoutInMinutes: '0'
138+
steps:
139+
- task: DownloadPipelineArtifact@2
140+
displayName: 'Download Pipeline Artifact'
141+
inputs:
142+
buildType: 'current'
143+
artifactName: $(buildArtifactName)
144+
targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'
145+
146+
- task: DownloadPipelineArtifact@2
147+
displayName: 'Download Test Artifact'
148+
inputs:
149+
buildType: 'current'
150+
targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'
151+
152+
- task: PowerShell@2
153+
name: merge
154+
displayName: 'Merge Code Coverage files'
155+
inputs:
156+
filePath: './build.ps1'
157+
arguments: '-tasks merge'
158+
pwsh: true
159+
160+
- task: PublishCodeCoverageResults@1
161+
displayName: 'Publish Code Coverage to Azure DevOps'
122162
inputs:
123163
codeCoverageTool: 'JaCoCo'
124-
summaryFileLocation: 'output/testResults/CodeCov*.xml'
125-
pathToSources: '$(Build.SourcesDirectory)/output/$(dscBuildVariable.RepositoryName)'
164+
summaryFileLocation: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml'
165+
pathToSources: '$(Build.SourcesDirectory)/$(sourceFolderName)/'
166+
167+
- script: |
168+
bash <(curl -s https://codecov.io/bash) -f "./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml"
169+
displayName: 'Publish Code Coverage to Codecov.io'
126170
127171
- stage: Deploy
128-
dependsOn: Test
172+
dependsOn: Quality_Test_and_Unit_Test
129173
# Only execute deploy stage if we're on main and previous stage succeeded
130174
condition: |
131175
and(
@@ -143,11 +187,12 @@ stages:
143187
vmImage: 'ubuntu-latest'
144188
steps:
145189
- task: DownloadPipelineArtifact@2
146-
displayName: 'Download Build Artifact'
190+
displayName: 'Download Pipeline Artifact'
147191
inputs:
148192
buildType: 'current'
149193
artifactName: $(buildArtifactName)
150-
targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'
194+
targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'
195+
151196
- task: PowerShell@2
152197
name: publishRelease
153198
displayName: 'Publish Release'
@@ -158,8 +203,9 @@ stages:
158203
env:
159204
GitHubToken: $(GitHubToken)
160205
GalleryApiToken: $(GalleryApiToken)
161-
ReleaseBranch: $(defaultBranch)
162-
MainGitBranch: $(defaultBranch)
206+
ReleaseBranch: main
207+
MainGitBranch: main
208+
163209
- task: PowerShell@2
164210
name: sendChangelogPR
165211
displayName: 'Send Changelog PR'
@@ -169,5 +215,5 @@ stages:
169215
pwsh: true
170216
env:
171217
GitHubToken: $(GitHubToken)
172-
ReleaseBranch: $(defaultBranch)
173-
MainGitBranch: $(defaultBranch)
218+
ReleaseBranch: main
219+
MainGitBranch: main

build.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ Pester:
7676
CIFormat: Auto
7777
CodeCoverage:
7878
CoveragePercentTarget: 50
79-
OutputPath: JaCoCo_coverage.xml
8079
OutputEncoding: ascii
8180
# There is a bug in Pester when running unit tests for classes when 'UseBreakpoints' is turned off.
8281
# See error in gist: https://gist.github.com/johlju/c16dfd9587c7e066e8825fc54b33a703
@@ -87,6 +86,16 @@ Pester:
8786
ExcludeFromCodeCoverage:
8887
- Modules/DscResource.Common
8988

89+
####################################################
90+
# Code Coverage Configuration #
91+
####################################################
92+
CodeCoverage:
93+
# Filename of the file that will be outputted by the task Merge_CodeCoverage_Files.
94+
CodeCoverageMergedOutputFile: JaCoCo_coverage.xml
95+
# File pattern used to search for files under the ./output/testResults folder
96+
# by task Merge_CodeCoverage_Files.
97+
CodeCoverageFilePattern: Codecov*.xml
98+
9099
####################################################
91100
# Pester Configuration (DscResource.Test) #
92101
####################################################

source/DSCResources/MSFT_UpdateServicesApprovalRule/MSFT_UpdateServicesApprovalRule.schema.mof

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[ClassVersion("1.0.0.0"), FriendlyName("UpdateServicesApprovalRule")]
22
class MSFT_UpdateServicesApprovalRule : OMI_BaseResource
33
{
4-
[Write, Description("An enumerated value that describes if WSUS is configured.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
4+
[Write, Description("An enumerated value that describes if WSUS is configured. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
55
[Key, Description("Name of the approval rule.")] String Name;
66
[Write, Description("Classifications in the approval rule.")] String Classifications[];
77
[Write, Description("Products in the approval rule.")] String Products[];
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Description
2+
3+
This resource is used to configure the Update Services Approval Rule.

source/DSCResources/MSFT_UpdateServicesCleanup/MSFT_UpdateServicesCleanup.schema.mof

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[ClassVersion("1.0.0.0"), FriendlyName("UpdateServicesCleanup")]
22
class MSFT_UpdateServicesCleanup : OMI_BaseResource
33
{
4-
[Key, Description("An enumerated value that describes if the WSUS cleanup task exists.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
4+
[Key, Description("An enumerated value that describes if the WSUS cleanup task exists. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
55
[Write, Description("Decline updates that have not been approved for 30 days or more, are not currently needed by any clients, and are superseded by an approved update.")] Boolean DeclineSupersededUpdates;
66
[Write, Description("Decline updates that aren't approved and have been expired by Microsoft.")] Boolean DeclineExpiredUpdates;
77
[Write, Description("Delete updates that are expired and have not been approved for 30 days or more, and delete older update revisions that have not been approved for 30 days or more.")] Boolean CleanupObsoleteUpdates;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Description
2+
3+
This resource is used to configure the Update Services Cleanup Task.

0 commit comments

Comments
 (0)