From 5e4eb86a8141ee9cabdcac35888892dd24a5dc72 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 16 Mar 2022 15:55:27 -0700 Subject: [PATCH 01/10] Update `AzureFileCopy` task and fix the syntax for specifying `pool` (#17013) --- .../azureDevOps/templates/release-BuildJson.yml | 6 +++--- .../azureDevOps/templates/release-UpdateDepsJson.yml | 2 +- tools/releaseBuild/azureDevOps/vpackRelease.yml | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/releaseBuild/azureDevOps/templates/release-BuildJson.yml b/tools/releaseBuild/azureDevOps/templates/release-BuildJson.yml index 7b9d4cd329f..2dc6bc92b44 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-BuildJson.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-BuildJson.yml @@ -64,7 +64,7 @@ steps: } displayName: Download and Capture NuPkgs -- task: AzureFileCopy@2 +- task: AzureFileCopy@4 displayName: 'AzureBlob build info JSON file Copy' inputs: SourcePath: '$(BuildInfoJsonFile)' @@ -74,7 +74,7 @@ steps: ContainerName: BuildInfo condition: and(succeeded(), eq(variables['CopyMainBuildInfo'], 'YES')) -- task: AzureFileCopy@2 +- task: AzureFileCopy@4 displayName: 'AzureBlob build info ''lts.json'' Copy when needed' inputs: SourcePath: '$(LtsBuildInfoJsonFile)' @@ -84,7 +84,7 @@ steps: ContainerName: BuildInfo condition: and(succeeded(), eq(variables['CopyLTSBuildInfo'], 'YES')) -- task: AzureFileCopy@2 +- task: AzureFileCopy@4 displayName: 'AzureBlob build info ''Major-Minor.json'' Copy when needed' inputs: SourcePath: '$(VersionBuildInfoJsonFile)' diff --git a/tools/releaseBuild/azureDevOps/templates/release-UpdateDepsJson.yml b/tools/releaseBuild/azureDevOps/templates/release-UpdateDepsJson.yml index 8f52bcb358f..769ccf3feaa 100644 --- a/tools/releaseBuild/azureDevOps/templates/release-UpdateDepsJson.yml +++ b/tools/releaseBuild/azureDevOps/templates/release-UpdateDepsJson.yml @@ -58,7 +58,7 @@ jobs: Write-Host "##$vstsCommand" displayName: Determine file to upload - - task: AzureFileCopy@2 + - task: AzureFileCopy@4 displayName: 'AzureBlob pwsh.deps.json file Copy' inputs: SourcePath: '$(FileToUpload)' diff --git a/tools/releaseBuild/azureDevOps/vpackRelease.yml b/tools/releaseBuild/azureDevOps/vpackRelease.yml index 875e2d25c3c..11b93b25899 100644 --- a/tools/releaseBuild/azureDevOps/vpackRelease.yml +++ b/tools/releaseBuild/azureDevOps/vpackRelease.yml @@ -25,7 +25,8 @@ stages: displayName: Name the build condition: succeeded() - pool: PowerShell1ES + pool: + name: PowerShell1ES demands: - ImageOverride -equals PSMMS2019-Secure From abbe2f56453f7f4d2d4ca8aa3ff7d3c44286e04f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 May 2022 15:19:51 -0700 Subject: [PATCH 02/10] Make sure we execute tests on LTS package for older LTS releases (#17429) --- tools/releaseBuild/azureDevOps/releaseBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/releaseBuild.yml b/tools/releaseBuild/azureDevOps/releaseBuild.yml index 8bcb7b3c134..33193ebd6f1 100644 --- a/tools/releaseBuild/azureDevOps/releaseBuild.yml +++ b/tools/releaseBuild/azureDevOps/releaseBuild.yml @@ -192,7 +192,7 @@ stages: - powershell: | $metadata = Get-Content '$(Build.SourcesDirectory)/tools/metadata.json' -Raw | ConvertFrom-Json - $LTS = $metadata.LTSRelease.Latest + $LTS = $metadata.LTSRelease.Package @{ ReleaseVersion = "$(Version)"; LTSRelease = $LTS } | ConvertTo-Json | Out-File "$(Build.StagingDirectory)\release.json" Get-Content "$(Build.StagingDirectory)\release.json" Write-Host "##vso[artifact.upload containerfolder=metadata;artifactname=metadata]$(Build.StagingDirectory)\release.json" From ea8a74c4b2e1773fc6f7a7c8b5e73bbd3276587a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 May 2022 15:20:12 -0700 Subject: [PATCH 03/10] Add win-x86 test package to the build (#17431) --- tools/releaseBuild/azureDevOps/templates/testartifacts.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml index 9cef7bd909a..38d9ee0d158 100644 --- a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml +++ b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml @@ -35,7 +35,8 @@ jobs: switch ($runtime) { - win7-x64 { $packageName = "TestPackage-win.zip" } + win7-x64 { $packageName = "TestPackage-win-x64.zip" } + win7-x86 { $packageName = "TestPackage-win-x86.zip" } linux-x64 { $packageName = "TestPackage-linux-x64.zip" } linux-arm { $packageName = "TestPackage-linux-arm.zip" } linux-arm64 { $packageName = "TestPackage-linux-arm64.zip" } @@ -48,6 +49,7 @@ jobs: } BuildTestPackage -runtime win7-x64 + BuildTestPackage -runtime win7-x86 BuildTestPackage -runtime linux-x64 BuildTestPackage -runtime linux-arm BuildTestPackage -runtime linux-arm64 From 2c5bc67deaa114ba6fc76659bcf98263037886c7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 9 May 2022 11:42:15 -0700 Subject: [PATCH 04/10] Switch to using GitHub action to verify markdown links for PRs (#17281) --- .github/workflows/markdown-link/config.json | 3 + .github/workflows/markdownLink.yml | 20 ++++ .vsts-ci/misc-analysis.yml | 106 +++++--------------- README.md | 10 +- 4 files changed, 58 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/markdown-link/config.json create mode 100644 .github/workflows/markdownLink.yml diff --git a/.github/workflows/markdown-link/config.json b/.github/workflows/markdown-link/config.json new file mode 100644 index 00000000000..ff00be38b45 --- /dev/null +++ b/.github/workflows/markdown-link/config.json @@ -0,0 +1,3 @@ +{ + "aliveStatusCodes": [504, 503, 403, 200] +} diff --git a/.github/workflows/markdownLink.yml b/.github/workflows/markdownLink.yml new file mode 100644 index 00000000000..732ab5d4159 --- /dev/null +++ b/.github/workflows/markdownLink.yml @@ -0,0 +1,20 @@ +on: + pull_request: + branches: + - master + - 'release/**' + paths: + - '**.md' + +name: Check links for modified files +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + check-modified-files-only: 'yes' + config-file: .github/workflows/markdown-link/config.json diff --git a/.vsts-ci/misc-analysis.yml b/.vsts-ci/misc-analysis.yml index 6137ce95aec..c70a2d68dc6 100644 --- a/.vsts-ci/misc-analysis.yml +++ b/.vsts-ci/misc-analysis.yml @@ -27,83 +27,29 @@ variables: - name: repoFolder value: PowerShell -jobs: -- job: CI_Compliance - displayName: CI Compliance - - pool: - vmImage: windows-latest - - variables: - - name: repoPath - value: $(Agent.BuildDirectory)\$(repoFolder) - - steps: - - checkout: self - clean: true - path: $(repoFolder) - - - checkout: ComplianceRepo - - - template: ci-compliance.yml@ComplianceRepo - -- job: Linux_CI - displayName: Markdown and Common Tests - - pool: - vmImage: ubuntu-20.04 - - variables: - - name: repoPath - value: $(Agent.BuildDirectory)/$(repoFolder) - - steps: - - checkout: self - clean: true - path: $(repoFolder) - - - checkout: ComplianceRepo - - - powershell: | - Get-ChildItem -Path env: - displayName: Capture Environment - condition: succeededOrFailed() - - - powershell: | - Install-module Pester -Scope CurrentUser -Force -MaximumVersion 4.99 - displayName: Install Pester - condition: succeededOrFailed() - - - bash: | - curl -o- --progress-bar -L https://yarnpkg.com/install.sh | bash - displayName: Bootstrap Yarn - condition: succeededOrFailed() - - - bash: | - sudo yarn global add markdown-spellcheck@0.11.0 - displayName: Install mdspell - condition: succeededOrFailed() - - - bash: | - mdspell '**/*.md' '!**/Pester/**/*.md' --ignore-numbers --ignore-acronyms --report --en-us; - displayName: Test Spelling in Markdown - condition: succeededOrFailed() - workingDirectory: '$(repoPath)' - - - ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}: - - pwsh: | - Import-module ./build.psm1 - $path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml' - $results = invoke-pester -Script ./test/common -OutputFile $path -OutputFormat NUnitXml -PassThru - Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Common Tests;publishRunAttachments=true;resultFiles=$path;]" - if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0) - { - throw "Markdown tests failed" - } - displayName: Run Common Tests - condition: succeededOrFailed() - workingDirectory: '$(repoPath)' - - - template: dailyBuildCompliance.yml@ComplianceRepo - parameters: - sourceScanPath: '$(repoPath)' +stages: +- stage: Compliance + jobs: + - job: CI_Compliance + displayName: CI Compliance + + pool: + vmImage: windows-latest + + variables: + - name: repoPath + value: $(Agent.BuildDirectory)\$(repoFolder) + + steps: + - checkout: self + clean: true + path: $(repoFolder) + + - checkout: ComplianceRepo + + - template: ci-compliance.yml@ComplianceRepo +- stage: markdown_spelling_lint + displayName: Markdown Spelling and Lint + dependsOn: [] + jobs: + - template: ./misc-analysis/mdSpell.yml diff --git a/README.md b/README.md index 3315a3f44a8..b95e1342ae1 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,15 @@ For more information on how and why we built this dashboard, check out this [blo ## Chat Room -Want to chat with other members of the PowerShell community? +[GitHub Discussions](https://docs.github.com/discussions/quickstart) is a feature to enable fluid and open discussions within the community +for topics that are not related to code, unlike issues. + +This is an experiment we are trying in our repositories to see if it helps move discussions out of issues so that issues remain actionable by the team or members of the community. +There should be no expectation that PowerShell team members are regular participants in the discussions. +Individual PowerShell team members may choose to participate in discussions, but the expectation is that community members help drive discussions so that team members +can focus on issues. + +Create or join a [discussion](https://github.com/PowerShell/PowerShell/discussions). We have a Gitter Room which you can join below. From dfe8163eabc89b8570e43d340141a948b7b985e5 Mon Sep 17 00:00:00 2001 From: "James Truher [MSFT]" Date: Wed, 11 May 2022 12:30:22 -0700 Subject: [PATCH 05/10] Enable more tests to be run in a container. (#17294) --- .../commands/utility/SetDateCommand.cs | 35 +++++++++++---- .../engine/Utils.cs | 2 + .../NativeCommandProcessor.Tests.ps1 | 8 ++++ .../Test-Connection.Tests.ps1 | 6 +-- .../Set-Date.Tests.ps1 | 22 +++++++--- .../Help/HelpSystem.OnlineHelp.Tests.ps1 | 43 +------------------ .../engine/Help/HelpSystem.Tests.ps1 | 4 +- 7 files changed, 58 insertions(+), 62 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs index 3382ec5cdb0..0b6e3e36d64 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs @@ -71,7 +71,13 @@ protected override void ProcessRecord() if (ShouldProcess(dateToUse.ToString())) { #if UNIX - if (!Platform.NonWindowsSetDate(dateToUse)) + // We are not validating the native call here. + // We just want to be sure that we're using the value the user provided us. + if (Dbg.Internal.InternalTestHooks.SetDate) + { + WriteObject(dateToUse); + } + else if (!Platform.NonWindowsSetDate(dateToUse)) { throw new Win32Exception(Marshal.GetLastWin32Error()); } @@ -86,16 +92,23 @@ protected override void ProcessRecord() systemTime.Second = (UInt16)dateToUse.Second; systemTime.Milliseconds = (UInt16)dateToUse.Millisecond; #pragma warning disable 56523 - if (!NativeMethods.SetLocalTime(ref systemTime)) + if (Dbg.Internal.InternalTestHooks.SetDate) { - throw new Win32Exception(Marshal.GetLastWin32Error()); + WriteObject(systemTime); } - - // MSDN says to call this twice to account for changes - // between DST - if (!NativeMethods.SetLocalTime(ref systemTime)) + else { - throw new Win32Exception(Marshal.GetLastWin32Error()); + if (!NativeMethods.SetLocalTime(ref systemTime)) + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } + + // MSDN says to call this twice to account for changes + // between DST + if (!NativeMethods.SetLocalTime(ref systemTime)) + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } } #pragma warning restore 56523 #endif @@ -106,7 +119,11 @@ protected override void ProcessRecord() PSNoteProperty note = new PSNoteProperty("DisplayHint", DisplayHint); outputObj.Properties.Add(note); - WriteObject(outputObj); + // If we've turned on the SetDate test hook, don't emit the output object here because we emitted it earlier. + if (!Dbg.Internal.InternalTestHooks.SetDate) + { + WriteObject(outputObj); + } } #endregion diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 4cc21116de8..d43eaca6584 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -2069,6 +2069,8 @@ public static class InternalTestHooks internal static bool SetConsoleWidthToZero; internal static bool SetConsoleHeightToZero; + internal static bool SetDate; + // A location to test PSEdition compatibility functionality for Windows PowerShell modules with // since we can't manipulate the System32 directory in a test internal static string TestWindowsPowerShellPSHomeLocation; diff --git a/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 b/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 index dbc0a074695..93d51429b89 100644 --- a/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 +++ b/test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1 @@ -43,6 +43,14 @@ Describe 'native commands with pipeline' -tags 'Feature' { $result[0] | Should -Match "pwsh" } } + + It 'native command should be killed when pipeline is disposed' -Skip:($IsWindows) { + $yes = (Get-Process 'yes' -ErrorAction Ignore).Count + yes | Select-Object -First 2 + # wait a little to be sure that the process is ended + Start-Sleep -Milliseconds 500 + (Get-Process 'yes' -ErrorAction Ignore).Count | Should -Be $yes + } } Describe "Native Command Processor" -tags "Feature" { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 index 672fe29067a..f346c3514d0 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Test-Connection.Tests.ps1 @@ -256,9 +256,7 @@ Describe "Test-Connection" -tags "CI" { } Context "MTUSizeDetect" { - # We skip the MtuSize detection tests when in containers, as the environments throw raw exceptions - # instead of returning a PacketTooBig response cleanly. - It "MTUSizeDetect works" -Pending:($env:__INCONTAINER -eq 1) { + It "MTUSizeDetect works" { $result = Test-Connection $testAddress -MtuSize $result | Should -BeOfType Microsoft.PowerShell.Commands.TestConnectionCommand+PingMtuStatus @@ -267,7 +265,7 @@ Describe "Test-Connection" -tags "CI" { $result.MtuSize | Should -BeGreaterThan 0 } - It "Quiet works" -Pending:($env:__INCONTAINER -eq 1) { + It "Quiet works" { $result = Test-Connection $gatewayAddress -MtuSize -Quiet $result | Should -BeOfType Int32 diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-Date.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-Date.Tests.ps1 index 79faacc1028..71963c193a0 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-Date.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Set-Date.Tests.ps1 @@ -5,18 +5,28 @@ Import-Module HelpersCommon Describe "Set-Date for admin" -Tag @('CI', 'RequireAdminOnWindows', 'RequireSudoOnUnix') { BeforeAll { - $skipTest = (Test-IsVstsLinux) -or ($env:__INCONTAINER -eq 1) + [System.Management.Automation.Internal.InternalTestHooks]::SetTestHook("SetDate", $true) } - # Fails in VSTS Linux with Operation not permitted - It "Set-Date should be able to set the date in an elevated context" -Skip:$skipTest { + AfterAll { + [System.Management.Automation.Internal.InternalTestHooks]::SetTestHook("SetDate", $false) + } + + It "Set-Date should be able to set the date in an elevated context" { { Get-Date | Set-Date } | Should -Not -Throw } - # Fails in VSTS Linux with Operation not permitted - It "Set-Date should be able to set the date with -Date parameter" -Skip:$skipTest { + # Check the individual properties as the types may be different + It "Set-Date should be able to set the date with -Date parameter" { $target = Get-Date $expected = $target - Set-Date -Date $target | Should -Be $expected + $observed = Set-Date -Date $target + # do not test dayofweek because the number of the day is different between native and managed + $observed.Day | Should -Be $expected.Day + $observed.Hour | Should -Be $expected.Hour + $observed.Minutes | Should -Be $expected.Minutes + $observed.Month | Should -Be $expected.Month + $observed.Second | Should -Be $expected.Second + $observed.Year | Should -Be $expected.Year } } diff --git a/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 b/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 index ace83809e0f..a423d86c890 100644 --- a/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 +++ b/test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1 @@ -41,6 +41,7 @@ Describe 'Online help tests for PowerShell Cmdlets' -Tags "CI" { # TopicTitle - is the cmdlet name in the csv file # HelpURI - is the expected help URI in the csv file + # If this is correct, then launching the cmdlet should open the expected help URI. It "Validate 'get-help $($cmdlet.TopicTitle) -Online'" -Skip:$skipTest { $actualURI = Get-Help $cmdlet.TopicTitle -Online @@ -51,48 +52,6 @@ Describe 'Online help tests for PowerShell Cmdlets' -Tags "CI" { } } -Describe 'Get-Help -Online opens the default web browser and navigates to the cmdlet help content' -Tags "Feature" { - - $skipTest = [System.Management.Automation.Platform]::IsIoT -or - [System.Management.Automation.Platform]::IsNanoServer -or - $env:__INCONTAINER -eq 1 - - # this code is a workaround for issue: https://github.com/PowerShell/PowerShell/issues/3079 - if((-not ($skipTest)) -and $IsWindows) - { - $skipTest = $true - $regKey = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" - - try - { - $progId = (Get-ItemProperty $regKey).ProgId - if($progId) - { - if (-not (Test-Path 'HKCR:\')) - { - New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR | Should NotBeNullOrEmpty - } - $browserExe = ((Get-ItemProperty "HKCR:\$progId\shell\open\command")."(default)" -replace '"', '') -split " " - if ($browserExe.count -ge 1) - { - if($browserExe[0] -match '.exe') - { - $skipTest = $false - } - } - } - } - catch - { - # We are not able to access Registry, skipping test. - } - } - - It "Get-Help get-process -online" -skip:$skipTest { - { Get-Help get-process -online } | Should -Not -Throw - } -} - Describe 'Get-Help -Online is not supported on Nano Server and IoT' -Tags "CI" { $skipTest = -not ([System.Management.Automation.Platform]::IsIoT -or [System.Management.Automation.Platform]::IsNanoServer) diff --git a/test/powershell/engine/Help/HelpSystem.Tests.ps1 b/test/powershell/engine/Help/HelpSystem.Tests.ps1 index 8a752fbf82b..c10e2990668 100644 --- a/test/powershell/engine/Help/HelpSystem.Tests.ps1 +++ b/test/powershell/engine/Help/HelpSystem.Tests.ps1 @@ -574,7 +574,9 @@ Describe "Help failure cases" -Tags Feature { ) { param($command) - { & $command foobar -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand" + # under some conditions this does not throw, so include what we actually got + $helpTopic = [guid]::NewGuid().ToString("N") + { & $command $helpTopic -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand" -Because "A help topic was unexpectantly found for $helpTopic" } } From 6f63eb4d4f401686f127536595212b07d0e675b6 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 11 May 2022 15:23:58 -0700 Subject: [PATCH 06/10] Add a finalize template which causes jobs with issues to fail (#17314) * Add a finalize template * add finalize to prep * update display name * Add condition * revert me: add fake issue * fix display name * Revert "revert me: add fake issue" This reverts commit 5b10f299ce8f2c0f5cc11a8484b7b3b396d4a473. --- tools/releaseBuild/azureDevOps/releaseBuild.yml | 2 ++ .../azureDevOps/templates/checkAzureContainer.yml | 3 ++- .../azureDevOps/templates/compliance/compliance.yml | 2 ++ tools/releaseBuild/azureDevOps/templates/json.yml | 2 ++ tools/releaseBuild/azureDevOps/templates/linux.yml | 4 ++++ .../releaseBuild/azureDevOps/templates/mac-file-signing.yml | 2 ++ .../releaseBuild/azureDevOps/templates/mac-package-build.yml | 2 ++ .../azureDevOps/templates/mac-package-signing.yml | 2 ++ tools/releaseBuild/azureDevOps/templates/mac.yml | 2 ++ tools/releaseBuild/azureDevOps/templates/step/finalize.yml | 5 +++++ tools/releaseBuild/azureDevOps/templates/testartifacts.yml | 2 ++ .../azureDevOps/templates/windows-hosted-build.yml | 2 ++ .../azureDevOps/templates/windows-package-signing.yml | 2 ++ .../releaseBuild/azureDevOps/templates/windows-packaging.yml | 2 ++ 14 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/releaseBuild.yml b/tools/releaseBuild/azureDevOps/releaseBuild.yml index 33193ebd6f1..704fb31be53 100644 --- a/tools/releaseBuild/azureDevOps/releaseBuild.yml +++ b/tools/releaseBuild/azureDevOps/releaseBuild.yml @@ -197,3 +197,5 @@ stages: Get-Content "$(Build.StagingDirectory)\release.json" Write-Host "##vso[artifact.upload containerfolder=metadata;artifactname=metadata]$(Build.StagingDirectory)\release.json" displayName: Create and upload release.json file to build artifact + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/checkAzureContainer.yml b/tools/releaseBuild/azureDevOps/templates/checkAzureContainer.yml index 82b88999b29..32a87b09df0 100644 --- a/tools/releaseBuild/azureDevOps/templates/checkAzureContainer.yml +++ b/tools/releaseBuild/azureDevOps/templates/checkAzureContainer.yml @@ -19,6 +19,7 @@ jobs: ReleaseTagVar: $(ReleaseTagVar) - task: AzurePowerShell@4 + displayName: Check if blob exists and delete if specified inputs: azureSubscription: '$(AzureFileCopySubscription)' scriptType: inlineScript @@ -44,4 +45,4 @@ jobs: } } - + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/compliance/compliance.yml b/tools/releaseBuild/azureDevOps/templates/compliance/compliance.yml index e81bdcf3709..eb0400bc3fe 100644 --- a/tools/releaseBuild/azureDevOps/templates/compliance/compliance.yml +++ b/tools/releaseBuild/azureDevOps/templates/compliance/compliance.yml @@ -88,3 +88,5 @@ jobs: inputs: sourceScanPath: '$(Build.SourcesDirectory)\tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/json.yml b/tools/releaseBuild/azureDevOps/templates/json.yml index 714978022a5..1d6c10b8f3e 100644 --- a/tools/releaseBuild/azureDevOps/templates/json.yml +++ b/tools/releaseBuild/azureDevOps/templates/json.yml @@ -53,3 +53,5 @@ jobs: inputs: sourceScanPath: '$(Build.SourcesDirectory)\tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/linux.yml b/tools/releaseBuild/azureDevOps/templates/linux.yml index 5da7f8d5480..a1bcecc539f 100644 --- a/tools/releaseBuild/azureDevOps/templates/linux.yml +++ b/tools/releaseBuild/azureDevOps/templates/linux.yml @@ -134,6 +134,8 @@ jobs: condition: and(succeeded(), ne(variables['SkipBuild'], 'true')) workingDirectory: $(PowerShellRoot) + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml + - job: upload_${{ parameters.buildName }} displayName: ${{ parameters.uploadDisplayName }} ${{ parameters.buildName }} dependsOn: build_${{ parameters.buildName }} @@ -254,3 +256,5 @@ jobs: parameters: artifactPath: '$(Build.StagingDirectory)\signedPackages\release' condition: and(and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM')) + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/mac-file-signing.yml b/tools/releaseBuild/azureDevOps/templates/mac-file-signing.yml index 8139d9ff819..aefc963e735 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac-file-signing.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac-file-signing.yml @@ -117,3 +117,5 @@ jobs: inputs: sourceScanPath: '$(repoRoot)\tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml b/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml index f636fbba363..c65b6ddf479 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac-package-build.yml @@ -127,3 +127,5 @@ jobs: inputs: sourceScanPath: '$(PowerShellRoot)/tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/mac-package-signing.yml b/tools/releaseBuild/azureDevOps/templates/mac-package-signing.yml index cc7fd8d49ab..2f6cb22be1b 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac-package-signing.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac-package-signing.yml @@ -129,3 +129,5 @@ jobs: inputs: sourceScanPath: '$(repoRoot)/tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/mac.yml b/tools/releaseBuild/azureDevOps/templates/mac.yml index ec34762cc7b..24d85865c33 100644 --- a/tools/releaseBuild/azureDevOps/templates/mac.yml +++ b/tools/releaseBuild/azureDevOps/templates/mac.yml @@ -63,3 +63,5 @@ jobs: inputs: sourceScanPath: '$(Build.SourcesDirectory)/tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/step/finalize.yml b/tools/releaseBuild/azureDevOps/templates/step/finalize.yml new file mode 100644 index 00000000000..72a677fec9a --- /dev/null +++ b/tools/releaseBuild/azureDevOps/templates/step/finalize.yml @@ -0,0 +1,5 @@ +steps: + - pwsh: | + throw "Jobs with an Issue will not work for release. Please fix the issue and try again." + displayName: Check for SucceededWithIssues + condition: eq(variables['Agent.JobStatus'],'SucceededWithIssues') diff --git a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml index 38d9ee0d158..99122b59de6 100644 --- a/tools/releaseBuild/azureDevOps/templates/testartifacts.yml +++ b/tools/releaseBuild/azureDevOps/templates/testartifacts.yml @@ -57,3 +57,5 @@ jobs: BuildTestPackage -runtime linux-musl-x64 displayName: Build test package and upload + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml index 8440d731328..f3b339177fd 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-hosted-build.yml @@ -73,3 +73,5 @@ jobs: inputs: sourceScanPath: '$(PowerShellRoot)\tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/windows-package-signing.yml b/tools/releaseBuild/azureDevOps/templates/windows-package-signing.yml index e84408c0803..1b9f6006233 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-package-signing.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-package-signing.yml @@ -116,3 +116,5 @@ jobs: inputs: sourceScanPath: '$(repoRoot)\tools' snapshotForceEnabled: true + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml diff --git a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml index 404a59c963b..8d939ddad99 100644 --- a/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml +++ b/tools/releaseBuild/azureDevOps/templates/windows-packaging.yml @@ -271,3 +271,5 @@ jobs: } displayName: Clean up local Clone condition: always() + + - template: /tools/releaseBuild/azureDevOps/templates/step/finalize.yml From b4dd39a00d6d7d57b654cec8a33553cc91791d77 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Wed, 13 Jul 2022 13:31:57 -0700 Subject: [PATCH 07/10] Fix `Export-PSSession` to not throw error when a rooted path is specified for `-OutputModule` (#17671) --- .../resources/PathUtilsStrings.resx | 2 +- .../utils/PathUtils.cs | 30 ++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/System.Management.Automation/resources/PathUtilsStrings.resx b/src/System.Management.Automation/resources/PathUtilsStrings.resx index 6fb676ac609..b3170cb391a 100644 --- a/src/System.Management.Automation/resources/PathUtilsStrings.resx +++ b/src/System.Management.Automation/resources/PathUtilsStrings.resx @@ -136,7 +136,7 @@ The directory '{0}' already exists. Use the -Force parameter if you want to overwrite the directory and files within the directory. - The -OutputModule parameter does not resolve to a path, and a user module path cannot be found for the provided name. + The user module path does not exist, and hence a module folder cannot be created for the provided module name '{0}'. Cannot create the module {0} due to the following: {1}. Use a different argument for the -OutputModule parameter and retry. diff --git a/src/System.Management.Automation/utils/PathUtils.cs b/src/System.Management.Automation/utils/PathUtils.cs index 3e5fda8f5f4..d761e02c4cb 100644 --- a/src/System.Management.Automation/utils/PathUtils.cs +++ b/src/System.Management.Automation/utils/PathUtils.cs @@ -7,6 +7,7 @@ using System.Text; using System.Management.Automation.Internal; +using Microsoft.PowerShell.Commands; using Dbg = System.Management.Automation.Diagnostics; namespace System.Management.Automation @@ -356,7 +357,9 @@ internal static DirectoryInfo CreateModuleDirectory(PSCmdlet cmdlet, string modu DirectoryInfo directoryInfo = null; try { - string rootedPath = Microsoft.PowerShell.Commands.ModuleCmdletBase.ResolveRootedFilePath(moduleNameOrPath, cmdlet.Context); + // Even if 'moduleNameOrPath' is a rooted path, 'ResolveRootedFilePath' may return null when the path doesn't exist yet, + // or when it contains wildcards but cannot be resolved to a single path. + string rootedPath = ModuleCmdletBase.ResolveRootedFilePath(moduleNameOrPath, cmdlet.Context); if (string.IsNullOrEmpty(rootedPath) && moduleNameOrPath.StartsWith('.')) { PathInfo currentPath = cmdlet.CurrentProviderLocation(cmdlet.Context.ProviderNames.FileSystem); @@ -365,18 +368,25 @@ internal static DirectoryInfo CreateModuleDirectory(PSCmdlet cmdlet, string modu if (string.IsNullOrEmpty(rootedPath)) { - string personalModuleRoot = ModuleIntrinsics.GetPersonalModulePath(); - if (string.IsNullOrEmpty(personalModuleRoot)) + if (Path.IsPathRooted(moduleNameOrPath)) { - cmdlet.ThrowTerminatingError( - new ErrorRecord( - new ArgumentException(PathUtilsStrings.ExportPSSession_ErrorModuleNameOrPath), - "ExportPSSession_ErrorModuleNameOrPath", - ErrorCategory.InvalidArgument, - cmdlet)); + rootedPath = moduleNameOrPath; } + else + { + string personalModuleRoot = ModuleIntrinsics.GetPersonalModulePath(); + if (string.IsNullOrEmpty(personalModuleRoot)) + { + cmdlet.ThrowTerminatingError( + new ErrorRecord( + new ArgumentException(StringUtil.Format(PathUtilsStrings.ExportPSSession_ErrorModuleNameOrPath, moduleNameOrPath)), + "ExportPSSession_ErrorModuleNameOrPath", + ErrorCategory.InvalidArgument, + cmdlet)); + } - rootedPath = Path.Combine(personalModuleRoot, moduleNameOrPath); + rootedPath = Path.Combine(personalModuleRoot, moduleNameOrPath); + } } directoryInfo = new DirectoryInfo(rootedPath); From 59cea228718d5780e0501ca648c0b15b837eb403 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 10 Aug 2022 12:49:36 -0700 Subject: [PATCH 08/10] Update .NET 3.1 SDK and test packages --- global.json | 2 +- test/xUnit/xUnit.tests.csproj | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/global.json b/global.json index ba1d7a51681..b52d3459f1c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.1.419" + "version": "3.1.422" } } diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index b95b569c240..2e836912410 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -23,9 +23,12 @@ - + - + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + From 5c54fc0e0435b880ed9d794fe2d5d3a08f530dce Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Wed, 10 Aug 2022 12:55:57 -0700 Subject: [PATCH 09/10] Update wix file --- assets/files.wxs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/files.wxs b/assets/files.wxs index b08258101aa..97c59eea89a 100644 --- a/assets/files.wxs +++ b/assets/files.wxs @@ -3016,13 +3016,13 @@ - - + + - - + + @@ -3994,8 +3994,8 @@ - - + + From 689e9915ea8e446f207848641b3c072929ed0446 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Thu, 11 Aug 2022 19:53:09 +0000 Subject: [PATCH 10/10] Merged PR 22116: Changelog for v7.0.12 Changelog for v7.0.12 --- .spelling | 7 +++++++ CHANGELOG/7.0.md | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.spelling b/.spelling index feed218bd50..83b84281566 100644 --- a/.spelling +++ b/.spelling @@ -13,6 +13,7 @@ about_ about_debuggers about_jobs +about_PSDesiredStateConfiguration acl add-localgroupmember add-ons @@ -52,6 +53,7 @@ asp.net assemblyloadcontext authenticodesignature azdevops +AzureFileCopy azurerm.netcore.preview azurerm.profile.netcore.preview azurerm.resources.netcore.preview @@ -287,6 +289,7 @@ github githug gitter glachancecmaisonneuve +global.json globbing GoogleTest gzip @@ -388,9 +391,11 @@ macos macports maertendmsft mahawar +manifest.spdx.json markekraus marktiedemann mcbobke +mcr.microsoft.com md meir017 memberresolution @@ -556,6 +561,7 @@ psgallery psm1 psobject psobjects +psoptions.json psproxyjobs psreadline psrp.windows @@ -704,6 +710,7 @@ systemd tabcompletion tadas tandasat +tar.gz test.ps1 test.txt. test1.txt diff --git a/CHANGELOG/7.0.md b/CHANGELOG/7.0.md index 8bbc077646e..3906b7c04ca 100644 --- a/CHANGELOG/7.0.md +++ b/CHANGELOG/7.0.md @@ -1,5 +1,36 @@ # 7.0 Changelog +## [7.0.12] - 2022-08-11 + +### General Cmdlet Updates and Fixes + +- Fix `Export-PSSession` to not throw error when a rooted path is specified for `-OutputModule` (#17671) + +### Tests + +- Enable more tests to be run in a container. (#17294) +- Switch to using GitHub action to verify markdown links for PRs (#17281) +- Add `win-x86` test package to the build (#15517) + +### Build and Packaging Improvements + +
+ + +

Bump .NET 3.1 SDK to 3.1.28

+
+ +
    +
  • Update wix file
  • +
  • Add a finalize template which causes jobs with issues to fail (#17314)
  • +
  • Make sure we execute tests on LTS package for older LTS releases (#17326)
  • +
  • Update AzureFileCopy task and fix the syntax for specifying pool (#17013)
  • +
+ +
+ +[7.0.12]: https://github.com/PowerShell/PowerShell/compare/v7.0.11...v7.0.12 + ## [7.0.11] - 2022-05-13 ### Build and Packaging Improvements @@ -15,7 +46,7 @@
  • Add explicit job name for approval tasks in Snap stage (#16579)
  • Update to use mcr.microsoft.com (#17272)
  • -
  • Update global.json and wix
  • +
  • Update global.json and wix
  • Put Secure supply chain analysis at correct place (#17273)
  • Partial back-port of: Update a few tests to make them more stable in CI (#16944) (Internal 20648)
  • Replace . in notices container name (#17292)