From 30ef07d3bdb301c96d00e8d9bef7af0bf68650cd Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 9 Apr 2021 13:26:50 -0700 Subject: [PATCH] Fix release build pipeline A backlog task of removing the `findPsesBuild` script and associated logic caused us to end up with a release with the wrong artifacts. The tagged PSES build was partially succeeded, which the download task then ignored as the trigger, and instead of failing, fell back to this script which gave it the latest fully succeeded build (an old version of PSES). That PSES build was only partially successful because the "Install PowerShell Daily" step failed due to a transient network error, and so this was intentionally ignored as it did not affect the build. Or so we thought. --- .vsts-ci/azure-pipelines-ci.yml | 18 -------------- .vsts-ci/azure-pipelines-release.yml | 32 ++++--------------------- .vsts-ci/templates/ci-general.yml | 16 +++++++------ .vsts-ci/templates/release-general.yml | 25 ++----------------- CHANGELOG.md | 6 +++++ tools/releaseBuild/findPsesBuild.ps1 | 27 --------------------- tools/releaseBuild/setVstsVariables.ps1 | 18 -------------- 7 files changed, 22 insertions(+), 120 deletions(-) delete mode 100644 tools/releaseBuild/findPsesBuild.ps1 delete mode 100644 tools/releaseBuild/setVstsVariables.ps1 diff --git a/.vsts-ci/azure-pipelines-ci.yml b/.vsts-ci/azure-pipelines-ci.yml index d6bb03970a..73e761d389 100644 --- a/.vsts-ci/azure-pipelines-ci.yml +++ b/.vsts-ci/azure-pipelines-ci.yml @@ -13,24 +13,6 @@ trigger: branches: include: - master - - legacy/1.x - paths: - exclude: - - /.dependabot/* - - /.poshchan/* - - /.github/**/* - - /.vscode/**/* - - /.vsts-ci/misc-analysis.yml - - /tools/**/* - - .editorconfig - - .gitattributes - - .gitignore - - /docs/**/* - - /CHANGELOG.md - - /CONTRIBUTING.md - - /README.md - - /LICENSE - - /CODE_OF_CONDUCT.md jobs: - job: Windows diff --git a/.vsts-ci/azure-pipelines-release.yml b/.vsts-ci/azure-pipelines-release.yml index 27461d83b0..4fe28b4646 100644 --- a/.vsts-ci/azure-pipelines-release.yml +++ b/.vsts-ci/azure-pipelines-release.yml @@ -1,5 +1,3 @@ -name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr) - variables: # Don't download unneeded packages - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE @@ -9,28 +7,9 @@ variables: value: 'true' trigger: - batch: true branches: include: - - master - - legacy/1.x - paths: - exclude: - - /.dependabot/* - - /.poshchan/* - - /.github/**/* - - /.vscode/**/* - - /.vsts-ci/misc-analysis.yml - - /tools/**/* - - .editorconfig - - .gitattributes - - .gitignore - - /docs/**/* - - /CHANGELOG.md - - /CONTRIBUTING.md - - /README.md - - /LICENSE - - /CODE_OF_CONDUCT.md + - release/* resources: repositories: @@ -43,13 +22,12 @@ resources: source: PowerShellEditorServices trigger: branches: - - master - - releases/* - - changelog* - - refs/tags/* + include: + - release/* + tags: + - v* jobs: - - job: 'ReleaseBuild' displayName: 'Build release' pool: diff --git a/.vsts-ci/templates/ci-general.yml b/.vsts-ci/templates/ci-general.yml index cf116304e8..80daf4a81a 100644 --- a/.vsts-ci/templates/ci-general.yml +++ b/.vsts-ci/templates/ci-general.yml @@ -13,33 +13,35 @@ steps: Write-Host "##vso[task.prependpath]$powerShellPath" continueOnError: true displayName: Install PowerShell Daily + - pwsh: '$PSVersionTable' displayName: Display PowerShell version information + - pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))" displayName: Set Build Name for Non-PR condition: ne(variables['Build.Reason'], 'PullRequest') - - task: PowerShell@2 - displayName: 'Set environment variables for VSTS (Phase 1)' - inputs: - targetType: filePath - filePath: ./tools/releaseBuild/setVstsVariables.ps1 + + # TODO: Use a submodule or some such so we can actually track a version here. - pwsh: | - Write-Host "Cloning '$env:PSES_BRANCH' branch from '$env:PSES_FORK/PowerShellEditorServices'" - git clone --single-branch --branch $env:PSES_BRANCH https://github.com/$env:PSES_FORK/PowerShellEditorServices.git ../PowerShellEditorServices + git clone https://github.com/PowerShell/PowerShellEditorServices.git ../PowerShellEditorServices Install-Module InvokeBuild -Scope CurrentUser -Force Install-Module PlatyPS -Scope CurrentUser -Force New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell + # Build - pwsh: Invoke-Build + - task: PublishTestResults@2 inputs: testRunner: JUnit testResultsFiles: '**/test-results.xml' condition: succeededOrFailed() + - task: PublishBuildArtifacts@1 inputs: ArtifactName: vscode-powershell PathtoPublish: '$(Build.ArtifactStagingDirectory)/vscode-powershell' + # Rich Navigation - task: RichCodeNavIndexer@0 # Note, for now, this is Windows only. diff --git a/.vsts-ci/templates/release-general.yml b/.vsts-ci/templates/release-general.yml index d675054b63..2d1261eb41 100644 --- a/.vsts-ci/templates/release-general.yml +++ b/.vsts-ci/templates/release-general.yml @@ -1,40 +1,19 @@ steps: - checkout: self -- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))" - displayName: Set Build Name for Non-PR - condition: ne(variables['Build.Reason'], 'PullRequest') - - pwsh: | Get-ChildItem -Path env: displayName: Capture environment condition: succeededOrFailed() -# TODO: Use modern resources for these variables. -- task: PowerShell@2 - displayName: 'Set environment variables for VSTS (Phase 1)' - inputs: - targetType: filePath - filePath: ./vscode-powershell/tools/releaseBuild/setVstsVariables.ps1 - -# TODO: Remove this when satisfied with added trigger. -- task: PowerShell@2 - displayName: 'Find PowerShellEditorServices build' - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - inputs: - targetType: filePath - filePath: ./vscode-powershell/tools/releaseBuild/findPsesBuild.ps1 - - task: DownloadPipelineArtifact@2 - displayName: 'Download Artifacts from PowerShell Editor Services' + displayName: 'Download Artifacts from PowerShellEditorServices' inputs: source: specific project: '8e2735c1-3674-408a-bcab-87f089ea29d5' pipeline: 1056 preferTriggeringPipeline: true - runVersion: specific - runId: '$(PSES_BUILDID)' + allowPartiallySucceededBuilds: true artifact: 'PowerShellEditorServices' path: '$(Build.SourcesDirectory)/PowerShellEditorServices/module/' diff --git a/CHANGELOG.md b/CHANGELOG.md index ccbd9d4c6f..6a7d874e2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ #### [PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices) +Please note that these changes were intended to be included in this preview +release; however, a silent pipeline failure led to the previous version of +PowerShellEditorServices being included instead. These changes will be included +in the next preview release. See: +[#3282](https://github.com/PowerShell/vscode-powershell/issues/3282) + - 🧠✨ [PowerShellEditorServices #1176](https://github.com/PowerShell/PowerShellEditorServices/pull/1427) - Add '$' as trigger character for completion. (Thanks @MartinGC94!) - 👷🚨✨ [PowerShellEditorServices #1426](https://github.com/PowerShell/PowerShellEditorServices/pull/1426) - Bump CI images and enable tests on Apple M1. - ✨ [PowerShellEditorServices #1424](https://github.com/PowerShell/PowerShellEditorServices/pull/1424) - Update to use OmniSharp 0.19.0. diff --git a/tools/releaseBuild/findPsesBuild.ps1 b/tools/releaseBuild/findPsesBuild.ps1 deleted file mode 100644 index 493a816c3c..0000000000 --- a/tools/releaseBuild/findPsesBuild.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -$branch = [uri]::EscapeDataString($env:PSES_BRANCH) -$headers = @{Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"} - -$buildsUrl = $env:VSTS_PSES_URL_TEMPLATE -f $branch, "succeeded" -$succeededBuilds = Invoke-RestMethod -ContentType application/json -Uri $buildsUrl -Headers $headers -Write-Host "Requested URL: $buildsUrl" -Write-Host "Got response:`n$(ConvertTo-Json $succeededBuilds)" - -$buildsURL = $buildsURL -replace "branchName", "tagName" -$taggedBuilds = Invoke-RestMethod -ContentType application/json -Uri $buildsUrl -Headers $headers -Write-Host "Requested URL: $buildsUrl" -Write-Host "Got response:`n$(ConvertTo-Json $taggedBuilds)" - -$buildsUrl = $env:VSTS_PSES_URL_TEMPLATE -f $branch, "partiallySucceeded" -$partiallySucceededBuilds = Invoke-RestMethod -ContentType application/json -Uri $buildsUrl -Headers $headers -Write-Host "Requested URL: $buildsUrl" -Write-Host "Got response:`n$(ConvertTo-Json $partiallySucceededBuilds)" - -$builds = @( - $succeededBuilds.value - $taggedBuilds.value - $partiallySucceededBuilds.value - ) | Sort-Object finishTime -Descending - -Write-Host "Got PSES_BRANCH: ${env:PSES_BRANCH}" -Write-Host "setting PSES_BUILDID to $($builds[0].Id)" -Write-Host "##vso[task.setvariable variable=PSES_BUILDID]$($builds[0].Id)" diff --git a/tools/releaseBuild/setVstsVariables.ps1 b/tools/releaseBuild/setVstsVariables.ps1 deleted file mode 100644 index ace8d35f0b..0000000000 --- a/tools/releaseBuild/setVstsVariables.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -$vstsVariables = @{ - PSES_BRANCH = 'master' - PSES_FORK = 'PowerShell' -} - -# Use VSTS's API to set an env vars -foreach ($var in $vstsVariables.Keys) -{ - # Allow environment to override - if (Get-Item "env:$var" -ErrorAction Ignore) - { - continue - } - - $val = $vstsVariables[$var] - Write-Host "Setting var '$var' to value '$val'" - Write-Host "##vso[task.setvariable variable=$var]$val" -}