Skip to content

Commit d384706

Browse files
authored
Merge pull request #69 from NeilBird/users/nebird/development
v0.8.0: Step.7 form-defaults + Pii-Guard + Publish-Module + Step.2 UX fixes + historical-version cleanup
2 parents f69c4d5 + 63f1c66 commit d384706

32 files changed

Lines changed: 406 additions & 134 deletions

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.0_authentication-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ variables:
5959
# log if the YAML appears stale - prompting you to refresh via
6060
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
6161
- name: GENERATED_AGAINST_MODULE_VERSION
62-
value: '0.7.99'
62+
value: '0.8.0'
6363
# Resolution order for the module version pin (leave all unset to install the latest,
6464
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
6565
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.1_inventory-clusters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ variables:
4242
# log if the YAML appears stale - prompting you to refresh via
4343
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
4444
- name: GENERATED_AGAINST_MODULE_VERSION
45-
value: '0.7.99'
45+
value: '0.8.0'
4646
# Resolution order for the module version pin (leave all unset to install the latest,
4747
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
4848
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.2_manage-updatering-tags.yml

Lines changed: 87 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ variables:
4545
# log if the YAML appears stale - prompting you to refresh via
4646
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
4747
- name: GENERATED_AGAINST_MODULE_VERSION
48-
value: '0.7.99'
48+
value: '0.8.0'
4949
# Resolution order for the module version pin (leave all unset to install the latest,
5050
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
5151
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).
@@ -243,10 +243,24 @@ stages:
243243
Write-Host "========================================" -ForegroundColor Cyan
244244
Write-Host "Applying UpdateRing Tags" -ForegroundColor Cyan
245245
Write-Host "========================================" -ForegroundColor Cyan
246-
247-
# Run tag management
248-
Set-AzLocalClusterUpdateRingTag @params
249-
246+
247+
# Run tag management. -PassThru returns the per-cluster results so
248+
# the Summary task can build a breakdown table rather than parroting
249+
# only the pipeline inputs back at the operator.
250+
$results = Set-AzLocalClusterUpdateRingTag @params -PassThru
251+
252+
# Persist results to a JSON sidecar so the Summary task (separate
253+
# PowerShell process) can read them. Lives in the artifact staging
254+
# dir that gets published.
255+
$resultsJsonPath = Join-Path $outputDir 'UpdateRingTag_Results.json'
256+
if ($null -ne $results) {
257+
@($results) | ConvertTo-Json -Depth 5 | Out-File -FilePath $resultsJsonPath -Encoding utf8
258+
Write-Host "Wrote $($results.Count) per-cluster result row(s) to: $resultsJsonPath"
259+
} else {
260+
'[]' | Out-File -FilePath $resultsJsonPath -Encoding utf8
261+
Write-Host "No per-cluster results returned (empty CSV?). Wrote empty array to: $resultsJsonPath"
262+
}
263+
250264
Write-Host ""
251265
Write-Host "Tag management complete"
252266
@@ -273,21 +287,74 @@ stages:
273287
script: |
274288
$dryRun = [System.Convert]::ToBoolean("${{ parameters.dryRun }}")
275289
$forceOverwrite = [System.Convert]::ToBoolean("${{ parameters.forceOverwrite }}")
276-
277-
$summary = @"
278-
# UpdateRing Tag Management Summary
279-
280-
| Setting | Value |
281-
|---------|-------|
282-
| Dry Run | $dryRun |
283-
| Force Overwrite | $forceOverwrite |
284-
"@
285-
290+
291+
$lines = New-Object System.Collections.Generic.List[string]
292+
[void]$lines.Add('# UpdateRing Tag Management Summary')
293+
[void]$lines.Add('')
294+
[void]$lines.Add('| Setting | Value |')
295+
[void]$lines.Add('|---------|-------|')
296+
[void]$lines.Add("| Dry Run | $dryRun |")
297+
[void]$lines.Add("| Force Overwrite | $forceOverwrite |")
298+
299+
# Per-cluster results breakdown - read the JSON sidecar the apply task wrote.
300+
# See AzLocal.UpdateManagement Set-AzLocalClusterUpdateRingTag -PassThru schema.
301+
$resultsJsonPath = Join-Path '$(Build.ArtifactStagingDirectory)' 'UpdateRingTag_Results.json'
302+
if (Test-Path $resultsJsonPath) {
303+
$results = @(Get-Content -Raw -Path $resultsJsonPath | ConvertFrom-Json)
304+
$total = $results.Count
305+
$created = @($results | Where-Object { $_.Action -eq 'Created' -and $_.Status -eq 'Success' }).Count
306+
$updated = @($results | Where-Object { $_.Action -eq 'Updated' -and $_.Status -eq 'Success' }).Count
307+
$alreadyInSync = @($results | Where-Object { $_.Status -eq 'AlreadyInSync' }).Count
308+
$skipped = @($results | Where-Object { $_.Status -eq 'Skipped' }).Count
309+
$failed = @($results | Where-Object { $_.Status -eq 'Failed' }).Count
310+
$whatIf = @($results | Where-Object { $_.Status -eq 'WhatIf' }).Count
311+
312+
[void]$lines.Add('')
313+
[void]$lines.Add('## Result breakdown')
314+
[void]$lines.Add('')
315+
[void]$lines.Add('| Outcome | Count |')
316+
[void]$lines.Add('|---------|------:|')
317+
[void]$lines.Add("| Total clusters processed | $total |")
318+
[void]$lines.Add("| Tags created | $created |")
319+
[void]$lines.Add("| Tags updated | $updated |")
320+
[void]$lines.Add("| Already in sync (no-op) | $alreadyInSync |")
321+
[void]$lines.Add("| Skipped (UpdateRing differs, no -Force) | $skipped |")
322+
if ($whatIf -gt 0) {
323+
[void]$lines.Add("| WhatIf (dry-run preview) | $whatIf |")
324+
}
325+
[void]$lines.Add("| Failed | $failed |")
326+
327+
if ($total -gt 0) {
328+
[void]$lines.Add('')
329+
[void]$lines.Add("<details><summary>Per-cluster results ($total rows)</summary>")
330+
[void]$lines.Add('')
331+
[void]$lines.Add('| Cluster | Action | Previous | New | Status | Message |')
332+
[void]$lines.Add('|---------|--------|----------|-----|--------|---------|')
333+
foreach ($r in $results) {
334+
$cn = ("$($r.ClusterName)") -replace '\|','\|'
335+
$act = ("$($r.Action)") -replace '\|','\|'
336+
$pv = ("$($r.PreviousTagValue)") -replace '\|','\|'
337+
$nv = ("$($r.NewTagValue)") -replace '\|','\|'
338+
$st = ("$($r.Status)") -replace '\|','\|'
339+
$msg = ("$($r.Message)") -replace '\|','\|' -replace '\r?\n',' '
340+
[void]$lines.Add("| $cn | $act | $pv | $nv | $st | $msg |")
341+
}
342+
[void]$lines.Add('')
343+
[void]$lines.Add('</details>')
344+
}
345+
} else {
346+
[void]$lines.Add('')
347+
[void]$lines.Add("_No per-cluster results JSON found at $resultsJsonPath - apply step may have failed before producing results._")
348+
}
349+
286350
if ($dryRun) {
287-
$summary += "`n`n**This was a dry run. No changes were applied.**"
288-
$summary += "`n`nRe-run the pipeline with 'Preview changes' set to false to apply changes."
351+
[void]$lines.Add('')
352+
[void]$lines.Add('**This was a dry run. No changes were applied.**')
353+
[void]$lines.Add('')
354+
[void]$lines.Add("Re-run the pipeline with 'Preview changes' set to false to apply changes.")
289355
}
290-
291-
$summary | Out-File "$(Build.ArtifactStagingDirectory)/summary.md" -Encoding UTF8
292-
Write-Host "##vso[task.uploadsummary]$(Build.ArtifactStagingDirectory)/summary.md"
356+
357+
$summaryPath = '$(Build.ArtifactStagingDirectory)/summary.md'
358+
$lines -join [Environment]::NewLine | Out-File $summaryPath -Encoding UTF8
359+
Write-Host "##vso[task.uploadsummary]$summaryPath"
293360

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.3_apply-updates-schedule-audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ parameters:
8181
default: false
8282

8383
variables:
84-
GENERATED_AGAINST_MODULE_VERSION: '0.7.99'
84+
GENERATED_AGAINST_MODULE_VERSION: '0.8.0'
8585
REQUIRED_MODULE_VERSION: '${{ parameters.moduleVersion }}'
8686
reportsPath: '$(Build.ArtifactStagingDirectory)/reports'
8787

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.4_fleet-connectivity-status.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ variables:
102102
# the version actually installed and to the latest on PSGallery, and emits a warning
103103
# log if the YAML appears stale - prompting you to refresh via
104104
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
105-
GENERATED_AGAINST_MODULE_VERSION: '0.7.99'
105+
GENERATED_AGAINST_MODULE_VERSION: '0.8.0'
106106
# Resolution order for the module version pin (leave all unset to install the latest,
107107
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
108108
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.5_assess-update-readiness.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ variables:
6363
# the version actually installed and to the latest on PSGallery, and emits a warning
6464
# log if the YAML appears stale - prompting you to refresh via
6565
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
66-
GENERATED_AGAINST_MODULE_VERSION: '0.7.99'
66+
GENERATED_AGAINST_MODULE_VERSION: '0.8.0'
6767
# Resolution order for the module version pin (leave all unset to install the latest,
6868
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
6969
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.6_apply-updates.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ variables:
9898
# log if the YAML appears stale - prompting you to refresh via
9999
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
100100
- name: GENERATED_AGAINST_MODULE_VERSION
101-
value: '0.7.99'
101+
value: '0.8.0'
102102
# Resolution order for the module version pin (leave all unset to install the latest,
103103
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
104104
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.7_monitor-updates.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ parameters:
5555
# accepts single ring, 'Prod;Ring2' list, or '***' wildcard (three stars - deliberate).
5656
displayName: "UpdateRing tag value (only used when scope=by-update-ring). Single, 'Prod;Ring2', or '***'."
5757
type: string
58-
default: 'Wave1'
58+
default: ''
5959

6060
- name: longRunningStepHours
61-
displayName: 'PRIMARY signal (v0.7.96+). Flag in-flight runs whose CURRENT STEP has been running longer than this many hours.'
61+
displayName: 'PRIMARY stuck-step signal. Flag in-flight runs whose CURRENT STEP has been running longer than this many hours.'
6262
type: string
6363
default: '2'
6464

6565
- name: longRunningThresholdHours
66-
displayName: 'Belt-and-braces overall-elapsed flag (default 24, demoted from 6 in v0.7.96).'
66+
displayName: 'Belt-and-braces overall-elapsed flag (default 24h).'
6767
type: string
6868
default: '24'
6969

@@ -73,17 +73,17 @@ parameters:
7373
default: '24'
7474

7575
- name: criticalElapsedDays
76-
displayName: 'CRITICAL tier for overall-elapsed (v0.7.99+, default 3 days). Runs older than this get a :rotating_light: chip; older than 2x get a :skull: chip - strongest visual signal that human intervention is needed.'
76+
displayName: 'CRITICAL tier for overall-elapsed (default 3 days). Runs older than this get a :rotating_light: chip; older than 2x get a :skull: chip - strongest visual signal that human intervention is needed.'
7777
type: string
78-
default: '7'
78+
default: '3'
7979

8080
- name: moduleVersion
8181
displayName: 'Pin AzLocal.UpdateManagement version (empty = latest from PSGallery). See Automation-Pipeline-Examples/README.md section 5 "Optional configuration".'
8282
type: string
8383
default: ''
8484

8585
variables:
86-
GENERATED_AGAINST_MODULE_VERSION: '0.7.99'
86+
GENERATED_AGAINST_MODULE_VERSION: '0.8.0'
8787
REQUIRED_MODULE_VERSION: '${{ parameters.moduleVersion }}'
8888
reportsPath: '$(Build.ArtifactStagingDirectory)/reports'
8989

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.8_fleet-update-status.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ variables:
9292
# the version actually installed and to the latest on PSGallery, and emits a warning
9393
# log if the YAML appears stale - prompting you to refresh via
9494
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
95-
GENERATED_AGAINST_MODULE_VERSION: '0.7.99'
95+
GENERATED_AGAINST_MODULE_VERSION: '0.8.0'
9696
# Resolution order for the module version pin (leave all unset to install the latest,
9797
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
9898
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).

AzLocal.UpdateManagement/Automation-Pipeline-Examples/azure-devops/Step.9_fleet-health-status.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ variables:
104104
# the version actually installed and to the latest on PSGallery, and emits a warning
105105
# log if the YAML appears stale - prompting you to refresh via
106106
# Copy-AzLocalPipelineExample -Update. See Automation-Pipeline-Examples/README.md section 5.
107-
GENERATED_AGAINST_MODULE_VERSION: '0.7.99'
107+
GENERATED_AGAINST_MODULE_VERSION: '0.8.0'
108108
# Resolution order for the module version pin (leave all unset to install the latest,
109109
# which is the default "fix-forward" behaviour): queue-time parameter > pipeline variable
110110
# 'REQUIRED_MODULE_VERSION' overridden at queue time > empty (latest).

0 commit comments

Comments
 (0)