Skip to content

Commit 1692fbc

Browse files
Microsoft Graph DevX ToolingMicrosoft Graph DevX Tooling
authored andcommitted
fix: use valid CI prerelease suffix
Use the alphanumeric ci<BuildId> format accepted by Update-ModuleManifest and cover it with a real manifest validation test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: af247b04-ecf8-4873-a78c-33d6437bb0d0
1 parent 026e72f commit 1692fbc

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

tools/AcrPipelineHelpers.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Set-CiModulePrerelease {
1414
)
1515

1616
$metadata = Get-Content -Path $MetadataPath -Raw | ConvertFrom-Json -AsHashtable
17-
$prerelease = "ci.$BuildId"
17+
$prerelease = "ci$BuildId"
1818

1919
foreach ($versionMetadata in $metadata.versions.Values) {
2020
$versionMetadata.prerelease = $prerelease

tools/Tests/AcrPipelineHelpers.Tests.ps1

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ Describe 'Set-CiModulePrerelease' {
1616
}
1717
} | ConvertTo-Json -Depth 10 | Set-Content -Path $metadataPath
1818

19-
Set-CiModulePrerelease -MetadataPath $metadataPath -BuildId '12345' | Should -Be 'ci.12345'
19+
$prerelease = Set-CiModulePrerelease -MetadataPath $metadataPath -BuildId '12345'
20+
$prerelease | Should -Be 'ci12345'
2021

2122
$metadata = Get-Content -Path $metadataPath -Raw | ConvertFrom-Json
22-
$metadata.versions.authentication.prerelease | Should -Be 'ci.12345'
23-
$metadata.versions.beta.prerelease | Should -Be 'ci.12345'
24-
$metadata.versions.'v1.0'.prerelease | Should -Be 'ci.12345'
23+
$metadata.versions.authentication.prerelease | Should -Be 'ci12345'
24+
$metadata.versions.beta.prerelease | Should -Be 'ci12345'
25+
$metadata.versions.'v1.0'.prerelease | Should -Be 'ci12345'
26+
27+
$manifestPath = Join-Path $TestDrive 'TestModule.psd1'
28+
Set-Content -Path (Join-Path $TestDrive 'TestModule.psm1') -Value ''
29+
New-ModuleManifest -Path $manifestPath -RootModule 'TestModule.psm1' -ModuleVersion '1.0.0'
30+
{ Update-ModuleManifest -Path $manifestPath -Prerelease $prerelease } | Should -Not -Throw
2531
}
2632
}
2733

0 commit comments

Comments
 (0)