From bef1f0982e5c2477317795c30e5ff9683b8efc72 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 19 Sep 2023 13:46:07 -0400 Subject: [PATCH 01/26] add stage to publish symbols to symbol server --- .ci/ci_release.yml | 6 ++++++ .ci/publishsymbols.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .ci/publishsymbols.yml diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index 388d48ecf..20f22b084 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -407,6 +407,12 @@ stages: displayName: PowerShell Core on macOS imageName: macOS-latest +- stage: PublishSymbols + displayName: Publish Symbols + condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), eq(variables['Publish'], 'True')) + jobs: + - template: publishsymbols.yml + - stage: Release displayName: Publish Package to PSGallery condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), eq(variables['Publish'], 'True')) diff --git a/.ci/publishsymbols.yml b/.ci/publishsymbols.yml new file mode 100644 index 000000000..cdb97cc48 --- /dev/null +++ b/.ci/publishsymbols.yml @@ -0,0 +1,33 @@ +steps: +- task: DownloadPipelineArtifact@2 + displayName: 'Download and publish symbols' + inputs: + # source: specific + # project: PowerShellCore + # pipeline: '696' + # preferTriggeringPipeline: true + # runVersion: latestFromBranch + # runBranch: '$(Build.SourceBranch)' + artifact: $(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.pdb + path: '$(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet' + +- pwsh: | + Write-Verbose -Verbose "Enumerating $(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet" + $symbolsRoot = New-Item -Path "$(Pipeline.Workspace)/symbols" -ItemType Directory -Verbose + Copy-Item -Path "$(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.pdb" -Destination $symbolsRoot + + Write-Verbose -Verbose "Enumerating $symbolsRoot" + Get-ChildItem -Path $symbolsRoot -Recurse + $vstsCommandString = "vso[task.setvariable variable=SymbolsPath]$symbolsRoot" + Write-Verbose -Message "$vstsCommandString" -Verbose + Write-Host -Object "##$vstsCommandString" + displayName: Copy symbol file + +- task: PublishSymbols@2 + inputs: + symbolsFolder: '$(SymbolsPath)' + searchPattern: '*.pdb' + indexSources: false + publishSymbols: true + symbolServerType: teamServices + detailedLog: true \ No newline at end of file From 21e2ba16aaa93c30bb30739f13c9c4852b9bba92 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 19 Sep 2023 13:47:39 -0400 Subject: [PATCH 02/26] add newline --- .ci/publishsymbols.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/publishsymbols.yml b/.ci/publishsymbols.yml index cdb97cc48..17ea3fc4e 100644 --- a/.ci/publishsymbols.yml +++ b/.ci/publishsymbols.yml @@ -30,4 +30,4 @@ steps: indexSources: false publishSymbols: true symbolServerType: teamServices - detailedLog: true \ No newline at end of file + detailedLog: true From 2443cf5486832acefca456c5f3fbd832c5e64196 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Wed, 20 Sep 2023 13:41:54 -0400 Subject: [PATCH 03/26] add logging command to upload pdb file --- .ci/ci_release.yml | 6 ++++++ .ci/publishsymbols.yml | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index 20f22b084..175db1791 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -235,6 +235,12 @@ stages: $vstsCommandString = "vso[task.setvariable variable=signOutPathCreated]${signOutPath}" Write-Host "sending " + $vstsCommandString Write-Host "##$vstsCommandString" + + # Upload symbol pdb file + $moduleName = "$($config.ModuleName)" + $symbolFileName = "$moduleName.pdb" + $symbolFilePath = Join-Path -Path $srcPath -ChildPath $symbolFileName + Write-Host "##vso[artifact.upload containerfolder=$moduleName;artifactname=$symbolFileName]$symbolFilePath" displayName: Set up for module created files code signing condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), ne(variables['SkipSigning'], 'True')) diff --git a/.ci/publishsymbols.yml b/.ci/publishsymbols.yml index 17ea3fc4e..38162284f 100644 --- a/.ci/publishsymbols.yml +++ b/.ci/publishsymbols.yml @@ -2,12 +2,6 @@ steps: - task: DownloadPipelineArtifact@2 displayName: 'Download and publish symbols' inputs: - # source: specific - # project: PowerShellCore - # pipeline: '696' - # preferTriggeringPipeline: true - # runVersion: latestFromBranch - # runBranch: '$(Build.SourceBranch)' artifact: $(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.pdb path: '$(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet' From df55b074df33d8972df51ca83ce0c9f7c4361c79 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 14:40:03 -0400 Subject: [PATCH 04/26] reference symbol file name --- .ci/ci_release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index 175db1791..578ced2c7 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -238,7 +238,9 @@ stages: # Upload symbol pdb file $moduleName = "$($config.ModuleName)" - $symbolFileName = "$moduleName.pdb" + # $symbolFileName = "$moduleName.pdb" + $symbolFileName = "Microsoft.PowerShell.PSResourceGet.pdb" + $symbolFilePath = Join-Path -Path $srcPath -ChildPath $symbolFileName Write-Host "##vso[artifact.upload containerfolder=$moduleName;artifactname=$symbolFileName]$symbolFilePath" displayName: Set up for module created files code signing From 53784f6f7502e295651224aaf00c1a43809a74a8 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 15:03:18 -0400 Subject: [PATCH 05/26] remove code from ci_release --- .ci/ci_release.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index 578ced2c7..20f22b084 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -235,14 +235,6 @@ stages: $vstsCommandString = "vso[task.setvariable variable=signOutPathCreated]${signOutPath}" Write-Host "sending " + $vstsCommandString Write-Host "##$vstsCommandString" - - # Upload symbol pdb file - $moduleName = "$($config.ModuleName)" - # $symbolFileName = "$moduleName.pdb" - $symbolFileName = "Microsoft.PowerShell.PSResourceGet.pdb" - - $symbolFilePath = Join-Path -Path $srcPath -ChildPath $symbolFileName - Write-Host "##vso[artifact.upload containerfolder=$moduleName;artifactname=$symbolFileName]$symbolFilePath" displayName: Set up for module created files code signing condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), ne(variables['SkipSigning'], 'True')) From 981801c88fcd5502bef52b91a8ece88a3f7bc4f0 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 15:26:31 -0400 Subject: [PATCH 06/26] use Microsoft.Powershell.PSResourceGet in CI as we released a new PowerShellGet preview that gets pulled in but doesnt match used cmdlets anymore --- .ci/ci.yml | 4 ++-- .ci/ci_auto.yml | 4 ++-- .ci/ci_release.yml | 4 ++-- .ci/test.yml | 4 ++-- .github/ISSUE_TEMPLATE/Bug_Report.yaml | 2 +- buildtools.psm1 | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.ci/ci.yml b/.ci/ci.yml index 2e69371ed..8d6c431ac 100644 --- a/.ci/ci.yml +++ b/.ci/ci.yml @@ -51,8 +51,8 @@ stages: - pwsh: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' Write-Verbose -Verbose "Install PSResourceGet to temp module path" - Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force - displayName: Install PowerShellGet v3 + Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force + displayName: Install Microsoft.PowerShell.PSResourceGet v3 - pwsh: | Get-ChildItem -Path $(Build.SourcesDirectory)/src/code -Recurse diff --git a/.ci/ci_auto.yml b/.ci/ci_auto.yml index 07fc6e6cd..440d4753f 100644 --- a/.ci/ci_auto.yml +++ b/.ci/ci_auto.yml @@ -59,8 +59,8 @@ stages: - pwsh: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' Write-Verbose -Verbose "Install PSResourceGet to temp module path" - Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force - displayName: Install PowerShellGet v3 + Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force + displayName: Install Microsoft.PowerShell.PSResourceGet v3 - pwsh: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index 20f22b084..8f53035ab 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -49,8 +49,8 @@ stages: - pwsh: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' Write-Verbose -Verbose "Install PSResourceGet to temp module path" - Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force - displayName: Install PowerShellGet v3 + Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force + displayName: Install Microsoft.PowerShell.PSResourceGet v3 - pwsh: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' diff --git a/.ci/test.yml b/.ci/test.yml index 69892e3df..a07acf9d1 100644 --- a/.ci/test.yml +++ b/.ci/test.yml @@ -38,10 +38,10 @@ jobs: - ${{ parameters.powershellExecutable }}: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' Write-Verbose -Verbose "Install PSResourceGet to temp module path" - Save-Module -Name PowerShellGet -MinimumVersion 3.0.18-beta18 -Path $modulePath -AllowPrerelease -Force + Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force Write-Verbose -Verbose "Install Pester 4.X to temp module path" Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force - displayName: Install PowerShellGetV3 and Pester + displayName: Install Microsoft.PowerShell.PSResourceGet and Pester - ${{ parameters.powershellExecutable }}: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' diff --git a/.github/ISSUE_TEMPLATE/Bug_Report.yaml b/.github/ISSUE_TEMPLATE/Bug_Report.yaml index b9a2aac83..d9fb2a2dd 100644 --- a/.github/ISSUE_TEMPLATE/Bug_Report.yaml +++ b/.github/ISSUE_TEMPLATE/Bug_Report.yaml @@ -10,7 +10,7 @@ body: For PowerShellGet v2 issues, please use [PowerShellGetv2 repo](https://github.com/PowerShell/PowerShellGetv2). - This repository is **ONLY** for PSResourceGet issues. + This repository is **ONLY** for Microsoft.PowerShell.PSResourceGet issues. - type: checkboxes attributes: label: Prerequisites diff --git a/buildtools.psm1 b/buildtools.psm1 index 2d5b22563..e9317f048 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -2,7 +2,7 @@ # Licensed under the MIT License. $ConfigurationFileName = 'package.config.json' -Import-Module -Name PowerShellGet -MinimumVersion 3.0.18 +Import-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0 function Get-BuildConfiguration { [CmdletBinding()] From fa6fd103a44009ad59a0f857905422ab23024e99 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 15:48:54 -0400 Subject: [PATCH 07/26] debug test.yml --- .ci/test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.ci/test.yml b/.ci/test.yml index a07acf9d1..53232f99a 100644 --- a/.ci/test.yml +++ b/.ci/test.yml @@ -37,7 +37,7 @@ jobs: - ${{ parameters.powershellExecutable }}: | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' - Write-Verbose -Verbose "Install PSResourceGet to temp module path" + Write-Verbose -Verbose "Install Microsoft.PowerShell.PSResourceGet to temp module path" Save-Module -Name Microsoft.PowerShell.PSResourceGet -MinimumVersion 0.9.0-rc1 -Path $modulePath -AllowPrerelease -Force Write-Verbose -Verbose "Install Pester 4.X to temp module path" Save-Module -Name "Pester" -MaximumVersion 4.99 -Path $modulePath -Force @@ -57,8 +57,11 @@ jobs: $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules' $env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)" - Import-Module -Name (Join-Path -Path '${{ parameters.buildDirectory }}' -ChildPath 'buildtools.psd1') -Force + $impPath = Join-Path -Path '${{ parameters.buildDirectory }}' -ChildPath 'buildtools.psd1' + Write-Verbose -Verbose "path to improt from: $impPath" + Import-Module -Name $impPath -Force # + Write-Verbose -Verbose "about to call Invoke-ModuleTests" Invoke-ModuleTests -Type Functional env: MAPPED_GITHUB_PAT: $(github_pat) From f774aecf131ad39df847acedcb2a9bd09a21b421 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 16:01:06 -0400 Subject: [PATCH 08/26] debug config name --- buildtools.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index e9317f048..3790f95cb 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -139,7 +139,8 @@ function Invoke-ModuleTests { $excludeTag = 'ManualValidationOnly' $testResultFileName = 'result.pester.xml' $testPath = $config.TestPath - $moduleToTest = Join-Path -Path $config.BuildOutputPath -ChildPath $config.ModuleName + Write-Verbose -Verbose $config.ModuleName + $moduleToTest = Join-Path -Path $config.BuildOutputPath -ChildPath "Microsoft.PowerShell.PSResourceGet" $command = "Import-Module -Name ${moduleToTest} -Force -Verbose; Set-Location -Path ${testPath}; Invoke-Pester -Path . -OutputFile ${testResultFileName} -Tags '${tags}' -ExcludeTag '${excludeTag}'" $pwshExePath = (Get-Process -Id $pid).Path From af62a229895126319d79ca7694a71dccb6c49a35 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 16:20:54 -0400 Subject: [PATCH 09/26] check what local repo contains --- buildtools.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/buildtools.psm1 b/buildtools.psm1 index 3790f95cb..e68f9c680 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -111,6 +111,7 @@ function Install-ModulePackageForTest { $localRepoName = 'packagebuild-local-repo' Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $PackagePath" Register-PSResourceRepository -Name $localRepoName -Uri $PackagePath -Trusted -Force + Get-ChildItem -Path $PackagePath $installationPath = $config.BuildOutputPath if ( !(Test-Path $installationPath)) { From 4999fd45e60fd0f40025caf978f06fed1f697a9f Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 16:34:01 -0400 Subject: [PATCH 10/26] add recurse --- buildtools.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index e68f9c680..6906ec0f1 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -111,7 +111,7 @@ function Install-ModulePackageForTest { $localRepoName = 'packagebuild-local-repo' Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $PackagePath" Register-PSResourceRepository -Name $localRepoName -Uri $PackagePath -Trusted -Force - Get-ChildItem -Path $PackagePath + Get-ChildItem -Path $PackagePath -Recurse $installationPath = $config.BuildOutputPath if ( !(Test-Path $installationPath)) { From 7822717cf416c3430ef5d6750afeeb856e41193b Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 16:36:41 -0400 Subject: [PATCH 11/26] perform find --- buildtools.psm1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildtools.psm1 b/buildtools.psm1 index 6906ec0f1..8a14326be 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -119,6 +119,8 @@ function Install-ModulePackageForTest { $null = New-Item -Path $installationPath -ItemType Directory -Verbose } Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" + $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName + Write-Verbose -Verbose $res.Name Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false Write-Verbose -Verbose -Message "Unregistering local package repo: $localRepoName" From 36a95ba1e0ba5e0bcc362560a0b3fc7b783336df Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 16:57:26 -0400 Subject: [PATCH 12/26] add prerelease param --- buildtools.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index 8a14326be..b16da27da 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -119,7 +119,7 @@ function Install-ModulePackageForTest { $null = New-Item -Path $installationPath -ItemType Directory -Verbose } Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" - $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName + $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease Write-Verbose -Verbose $res.Name Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false From b463dad92bb438f2ae0da41ae09682f239e44b73 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 21:27:39 -0400 Subject: [PATCH 13/26] add verbose statements --- buildtools.psm1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index b16da27da..6956241d6 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -111,6 +111,8 @@ function Install-ModulePackageForTest { $localRepoName = 'packagebuild-local-repo' Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $PackagePath" Register-PSResourceRepository -Name $localRepoName -Uri $PackagePath -Trusted -Force + $repo = Get-PSResourceRepository -Name $localRepoName + Write-Verbose $repo.Name $repo.Uri $repo.ApiVersion Get-ChildItem -Path $PackagePath -Recurse $installationPath = $config.BuildOutputPath @@ -121,7 +123,7 @@ function Install-ModulePackageForTest { Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease Write-Verbose -Verbose $res.Name - Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false + Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false -Verbose Write-Verbose -Verbose -Message "Unregistering local package repo: $localRepoName" Unregister-PSResourceRepository -Name $localRepoName -Confirm:$false From e644b634a9c0eba18c6bdf6f04aacd0899e31736 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Sun, 24 Sep 2023 23:07:52 -0400 Subject: [PATCH 14/26] PackagePath is a URI --- .ci/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test.yml b/.ci/test.yml index 53232f99a..47a5fb103 100644 --- a/.ci/test.yml +++ b/.ci/test.yml @@ -49,7 +49,7 @@ jobs: Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)" Import-Module -Name (Join-Path -Path '${{ parameters.buildDirectory }}' -ChildPath 'buildtools.psd1') -Force # - Install-ModulePackageForTest -PackagePath "$(System.ArtifactsDirectory)" + Install-ModulePackageForTest -PackagePath "$(System.ArtifactsDirectory)".ToString() displayName: Install module for test from downloaded artifact workingDirectory: ${{ parameters.buildDirectory }} From 9f9dfce33061e3381fdbcbf7f79f9f166b78e903 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 00:34:39 -0400 Subject: [PATCH 15/26] rmeove verbose statements --- buildtools.psm1 | 3 --- 1 file changed, 3 deletions(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index 6956241d6..b06cb2eae 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -111,9 +111,6 @@ function Install-ModulePackageForTest { $localRepoName = 'packagebuild-local-repo' Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $PackagePath" Register-PSResourceRepository -Name $localRepoName -Uri $PackagePath -Trusted -Force - $repo = Get-PSResourceRepository -Name $localRepoName - Write-Verbose $repo.Name $repo.Uri $repo.ApiVersion - Get-ChildItem -Path $PackagePath -Recurse $installationPath = $config.BuildOutputPath if ( !(Test-Path $installationPath)) { From bd46ade3736bacdc48070d054a86ad7b7ca5f960 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 00:42:23 -0400 Subject: [PATCH 16/26] add verbose to find --- buildtools.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index b06cb2eae..a209e0dd9 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -118,7 +118,7 @@ function Install-ModulePackageForTest { $null = New-Item -Path $installationPath -ItemType Directory -Verbose } Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" - $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease + $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease -Verbose Write-Verbose -Verbose $res.Name Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false -Verbose From f4dd62eb741e7b6709b3f5985e5a1fc5652b6333 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 00:46:43 -0400 Subject: [PATCH 17/26] add verbose to find --- buildtools.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index a209e0dd9..36e6dee7b 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -118,9 +118,9 @@ function Install-ModulePackageForTest { $null = New-Item -Path $installationPath -ItemType Directory -Verbose } Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" - $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease -Verbose + $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease -Verbose -Debug Write-Verbose -Verbose $res.Name - Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false -Verbose + Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false -Verbose -Debug Write-Verbose -Verbose -Message "Unregistering local package repo: $localRepoName" Unregister-PSResourceRepository -Name $localRepoName -Confirm:$false From 3a583e95b859770dbdd4958b3b6e902abdb298aa Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 01:01:44 -0400 Subject: [PATCH 18/26] add debug and try nupkg folder --- buildtools.psm1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/buildtools.psm1 b/buildtools.psm1 index 36e6dee7b..e204405f3 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -112,11 +112,22 @@ function Install-ModulePackageForTest { Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $PackagePath" Register-PSResourceRepository -Name $localRepoName -Uri $PackagePath -Trusted -Force + $repo2Path = Join-Path -Path $PackagePath -ChildPath "nupkg" + Register-PSResourceRepository -Name "localRepo2" -Uri $repo2Path -Trusted -Force + + $repo = Get-PSResourceRepository -Name $localRepoName + $repoPathWithoutFile = $repo.Uri.ToString().TrimStart("file:///") + Get-ChildItem -Path $repoPathWithoutFile -Recurse + $installationPath = $config.BuildOutputPath if ( !(Test-Path $installationPath)) { Write-Verbose -Verbose -Message "Creating module directory location for tests: $installationPath" $null = New-Item -Path $installationPath -ItemType Directory -Verbose } + + Write-Verbose -Verbose "locate package from repo 2" + $res2 = Find-PSResource -Name $config.ModuleName -Repository "localRepo2" -Prerelease -Verbose -Debug + Write-Verbose -Verbose $res2.Name Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease -Verbose -Debug Write-Verbose -Verbose $res.Name From 4a3d9a582787e2b97d5c3ef07a7a70fc157b6f55 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 11:04:52 -0400 Subject: [PATCH 19/26] specify nupkg folder in repo URI --- buildtools.psm1 | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index e204405f3..08536805f 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -109,15 +109,9 @@ function Install-ModulePackageForTest { $config = Get-BuildConfiguration $localRepoName = 'packagebuild-local-repo' - Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $PackagePath" - Register-PSResourceRepository -Name $localRepoName -Uri $PackagePath -Trusted -Force - - $repo2Path = Join-Path -Path $PackagePath -ChildPath "nupkg" - Register-PSResourceRepository -Name "localRepo2" -Uri $repo2Path -Trusted -Force - - $repo = Get-PSResourceRepository -Name $localRepoName - $repoPathWithoutFile = $repo.Uri.ToString().TrimStart("file:///") - Get-ChildItem -Path $repoPathWithoutFile -Recurse + $packagePathWithNupkg = Join-Path -Path $PackagePath -ChildPath "nupkg" + Write-Verbose -Verbose -Message "Registering local package repo: $localRepoName to path: $packagePathWithNupkg" + Register-PSResourceRepository -Name $localRepoName -Uri $packagePathWithNupkg -Trusted -Force $installationPath = $config.BuildOutputPath if ( !(Test-Path $installationPath)) { @@ -125,9 +119,6 @@ function Install-ModulePackageForTest { $null = New-Item -Path $installationPath -ItemType Directory -Verbose } - Write-Verbose -Verbose "locate package from repo 2" - $res2 = Find-PSResource -Name $config.ModuleName -Repository "localRepo2" -Prerelease -Verbose -Debug - Write-Verbose -Verbose $res2.Name Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease -Verbose -Debug Write-Verbose -Verbose $res.Name From 5e331efc47fc2b8204807e59aaa65ebc2720a2df Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 13:09:01 -0400 Subject: [PATCH 20/26] remove find code --- buildtools.psm1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index 08536805f..aa531059a 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -120,9 +120,7 @@ function Install-ModulePackageForTest { } Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" - $res = Find-PSResource -Name $config.ModuleName -Repository $localRepoName -Prerelease -Verbose -Debug - Write-Verbose -Verbose $res.Name - Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false -Verbose -Debug + Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false Write-Verbose -Verbose -Message "Unregistering local package repo: $localRepoName" Unregister-PSResourceRepository -Name $localRepoName -Confirm:$false From d1687f1d761efc69486407bc38dbffa339803395 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 13:11:02 -0400 Subject: [PATCH 21/26] add TrustRepository --- buildtools.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools.psm1 b/buildtools.psm1 index aa531059a..9ad5ed352 100644 --- a/buildtools.psm1 +++ b/buildtools.psm1 @@ -120,7 +120,7 @@ function Install-ModulePackageForTest { } Write-Verbose -Verbose -Message "Installing module $($config.ModuleName) to build output path $installationPath" - Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false + Save-PSResource -Name $config.ModuleName -Repository $localRepoName -Path $installationPath -SkipDependencyCheck -Prerelease -Confirm:$false -TrustRepository Write-Verbose -Verbose -Message "Unregistering local package repo: $localRepoName" Unregister-PSResourceRepository -Name $localRepoName -Confirm:$false From c2f24b06a310168bad70d1e1f36e775c5aaf5252 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 13:13:39 -0400 Subject: [PATCH 22/26] add code to upload pdb --- .ci/ci_release.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.ci/ci_release.yml b/.ci/ci_release.yml index 8f53035ab..343e2b8f8 100644 --- a/.ci/ci_release.yml +++ b/.ci/ci_release.yml @@ -235,6 +235,12 @@ stages: $vstsCommandString = "vso[task.setvariable variable=signOutPathCreated]${signOutPath}" Write-Host "sending " + $vstsCommandString Write-Host "##$vstsCommandString" + + # Upload symbol pdb file + $moduleName = "$($config.ModuleName)" + $symbolFileName = "$moduleName.pdb" + $symbolFilePath = Join-Path -Path $srcPath -ChildPath $symbolFileName + Write-Host "##vso[artifact.upload containerfolder=$moduleName;artifactname=$symbolFileName]$symbolFilePath" displayName: Set up for module created files code signing condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')), ne(variables['SkipSigning'], 'True')) From 6dfb5725d50a0f8997a9c93a1b8ec36ce14f8612 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 16:11:29 -0400 Subject: [PATCH 23/26] update ADO error code --- .../PublishPSResourceTests/PublishPSResourceADOServer.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/PublishPSResourceTests/PublishPSResourceADOServer.Tests.ps1 b/test/PublishPSResourceTests/PublishPSResourceADOServer.Tests.ps1 index 4d3437185..10e6b2f23 100644 --- a/test/PublishPSResourceTests/PublishPSResourceADOServer.Tests.ps1 +++ b/test/PublishPSResourceTests/PublishPSResourceADOServer.Tests.ps1 @@ -97,7 +97,7 @@ Describe "Test Publish-PSResource" -tags 'CI' { Publish-PSResource -Path $script:PublishModuleBase -Repository $ADOPublicRepoName -Credential $correctPublicRepoCred -ErrorAction SilentlyContinue - $Error[0].FullyQualifiedErrorId | Should -be "400ApiKeyError,Microsoft.PowerShell.PSResourceGet.Cmdlets.PublishPSResource" + $Error[0].FullyQualifiedErrorId | Should -be "401Error,Microsoft.PowerShell.PSResourceGet.Cmdlets.PublishPSResource" } It "Should not publish module to ADO repository feed (private) when Credentials are incorrect" { From 080907f1c3cfe81e8e02d1baabeb2fa97fade6f6 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 18:09:13 -0400 Subject: [PATCH 24/26] fix publish symbols job --- .ci/publishsymbols.yml | 57 ++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/.ci/publishsymbols.yml b/.ci/publishsymbols.yml index 38162284f..43521bd4d 100644 --- a/.ci/publishsymbols.yml +++ b/.ci/publishsymbols.yml @@ -1,27 +1,36 @@ -steps: -- task: DownloadPipelineArtifact@2 - displayName: 'Download and publish symbols' - inputs: - artifact: $(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.pdb - path: '$(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet' +parameters: + jobName1: publish_symbols_job + displayValidationJob1: 'Publish symbol to Microsoft symbol server' -- pwsh: | - Write-Verbose -Verbose "Enumerating $(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet" - $symbolsRoot = New-Item -Path "$(Pipeline.Workspace)/symbols" -ItemType Directory -Verbose - Copy-Item -Path "$(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.pdb" -Destination $symbolsRoot +jobs: +- job: ${{ parameters.jobName1 }} + displayName: ${{ parameters.displayValidationJob1 }} + pool: server + timeoutInMinutes: 2880 # job times out in 2 days + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download and publish symbols' + inputs: + artifact: $(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.pdb + path: '$(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet' - Write-Verbose -Verbose "Enumerating $symbolsRoot" - Get-ChildItem -Path $symbolsRoot -Recurse - $vstsCommandString = "vso[task.setvariable variable=SymbolsPath]$symbolsRoot" - Write-Verbose -Message "$vstsCommandString" -Verbose - Write-Host -Object "##$vstsCommandString" - displayName: Copy symbol file + - pwsh: | + Write-Verbose -Verbose "Enumerating $(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet" + $symbolsRoot = New-Item -Path "$(Pipeline.Workspace)/symbols" -ItemType Directory -Verbose + Copy-Item -Path "$(Pipeline.Workspace)\Microsoft.PowerShell.PSResourceGet\Microsoft.PowerShell.PSResourceGet.pdb" -Destination $symbolsRoot -- task: PublishSymbols@2 - inputs: - symbolsFolder: '$(SymbolsPath)' - searchPattern: '*.pdb' - indexSources: false - publishSymbols: true - symbolServerType: teamServices - detailedLog: true + Write-Verbose -Verbose "Enumerating $symbolsRoot" + Get-ChildItem -Path $symbolsRoot -Recurse + $vstsCommandString = "vso[task.setvariable variable=SymbolsPath]$symbolsRoot" + Write-Verbose -Message "$vstsCommandString" -Verbose + Write-Host -Object "##$vstsCommandString" + displayName: Copy symbol file + + - task: PublishSymbols@2 + inputs: + symbolsFolder: '$(SymbolsPath)' + searchPattern: '*.pdb' + indexSources: false + publishSymbols: true + symbolServerType: teamServices + detailedLog: true From c14f33b35410f5adec62fc1c6563ed12b5824451 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 25 Sep 2023 18:16:10 -0400 Subject: [PATCH 25/26] fix publish symbols job --- .ci/publishsymbols.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/publishsymbols.yml b/.ci/publishsymbols.yml index 43521bd4d..2c6f1865d 100644 --- a/.ci/publishsymbols.yml +++ b/.ci/publishsymbols.yml @@ -5,7 +5,10 @@ parameters: jobs: - job: ${{ parameters.jobName1 }} displayName: ${{ parameters.displayValidationJob1 }} - pool: server + pool: + name: 1ES + demands: + - ImageOverride -equals PSMMS2019-Secure timeoutInMinutes: 2880 # job times out in 2 days steps: - task: DownloadPipelineArtifact@2 From 2c37f42c9371ab59f6712a9a6c6e7bfe915616d5 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Tue, 26 Sep 2023 15:26:37 -0400 Subject: [PATCH 26/26] remove ToString() call --- .ci/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/test.yml b/.ci/test.yml index b62b3dff5..541d72542 100644 --- a/.ci/test.yml +++ b/.ci/test.yml @@ -49,7 +49,7 @@ jobs: Write-Verbose -Verbose "Importing build utilities (buildtools.psd1)" Import-Module -Name (Join-Path -Path '${{ parameters.buildDirectory }}' -ChildPath 'buildtools.psd1') -Force # - Install-ModulePackageForTest -PackagePath "$(System.ArtifactsDirectory)".ToString() + Install-ModulePackageForTest -PackagePath "$(System.ArtifactsDirectory)" displayName: Install module for test from downloaded artifact workingDirectory: ${{ parameters.buildDirectory }}