From 66ef728f4418e6215471449492bb1afec8cc47a4 Mon Sep 17 00:00:00 2001 From: Dingmeng Xue Date: Thu, 14 Apr 2022 23:15:38 +0800 Subject: [PATCH] Update build and sign pipeline of Az.Tools.Predictor (#17768) Force merge code because of unrelated error in Az.Accounts * Use msbuild to build Az.Tools.Predictor.sln (#17727) * Update build and sign pipeline of Az.Tools.Predictor * Update code * update code * Update version of az.accounts * update * Update code Co-authored-by: kceiw --- .azure-pipelines/sign-tool-predictor.yml | 19 ++++++++++--------- .../Az.Tools.Predictor.SourceGenerator.csproj | 15 +++++++++++---- .../Az.Tools.Predictor.psd1 | 4 +++- tools/Az.Tools.Predictor/build.proj | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.azure-pipelines/sign-tool-predictor.yml b/.azure-pipelines/sign-tool-predictor.yml index 4243cabf1178..e0a57eb039ff 100644 --- a/.azure-pipelines/sign-tool-predictor.yml +++ b/.azure-pipelines/sign-tool-predictor.yml @@ -5,28 +5,29 @@ pool: steps: - task: PowerShell@2 - displayName: Install PS 7.2 + displayName: Install PowerShell inputs: targetType: 'inline' script: | - $url = "https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.3/PowerShell-7.2.0-preview.3-win-x64.zip" - $output = Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3-win-x64.zip" + $url = "https://github.com/PowerShell/PowerShell/releases/download/v7.2.0/PowerShell-7.2.0-win-x64.zip" + $output = Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-win-x64.zip" (New-Object System.Net.WebClient).DownloadFile($url, $output) - $pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3/" + $pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell/" Expand-Archive -Path $output -DestinationPath $pwshPath $pwshFullPath = Convert-Path $pwshPath Write-Host $pwshFullPath - task: PowerShell@2 - displayName: 'Install platyPS, PowerShellGet, Az 3.0.0' + displayName: 'Install Dependent Modules' inputs: targetType: inline script: | - $pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3/pwsh.exe" + $pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell/pwsh.exe" $command = "`$PSVersionTable ` Install-Module platyPS -Force -Confirm:`$false -Scope CurrentUser ` Install-Module PowerShellGet -Force -Confirm:`$false -Scope CurrentUser -SkipPublisherCheck ` - Install-Module Az -Repository PSGallery -RequiredVersion 3.0.0 -Confirm:`$false -Scope CurrentUser -AllowClobber -Force" + Install-Module PSReadLine -Force -Confirm:`$false -Scope CurrentUser ` + Install-Module Az.Accounts -Repository PSGallery -Confirm:`$false -Scope CurrentUser -AllowClobber -Force" Invoke-Command -ScriptBlock { param ($pwshPath, $command) & $pwshPath -Command $command } -ArgumentList $pwshPath, $command - task: UseDotNet@2 @@ -41,7 +42,7 @@ steps: inputs: command: custom custom: msbuild - arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Clean;Build;GenerateHelp" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell-7.2.0-preview.3\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command"' + arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Clean;Build;GenerateHelp" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command"' - task: UseDotNet@2 displayName: 'Install DotNet 2.1 Runtime for Signing' @@ -90,7 +91,7 @@ steps: inputs: command: custom custom: msbuild - arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Package" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell-7.2.0-preview.3\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command" ' + arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Package" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command" ' - task: PublishPipelineArtifact@0 displayName: 'Save artifacts' diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor.SourceGenerator/Az.Tools.Predictor.SourceGenerator.csproj b/tools/Az.Tools.Predictor/Az.Tools.Predictor.SourceGenerator/Az.Tools.Predictor.SourceGenerator.csproj index 8fe2eab22c40..afa959e37d1c 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor.SourceGenerator/Az.Tools.Predictor.SourceGenerator.csproj +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor.SourceGenerator/Az.Tools.Predictor.SourceGenerator.csproj @@ -38,10 +38,17 @@ - - + + + + + + + + diff --git a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 index 5433de0a156f..3896b898cb8e 100644 --- a/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 +++ b/tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1 @@ -41,8 +41,10 @@ For more information on Az Predictor, please visit the following: https://aka.ms PowerShellVersion = '7.2' # Modules that must be imported into the global environment prior to importing this module -# "RequiredModules" requires the module in the build pipeline to build/sign this package. Instead, we will validate the dependencies at runtime by Az.Tools.Predictor.psm1 +RequiredModules = @(@{ModuleName = 'PSReadLine'; ModuleVersion = '2.2.2'; }, + @{ModuleName = 'Az.Accounts'; ModuleVersion = '2.6.2';}) +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @("Enable-AzPredictor", "Disable-AzPredictor", "Open-AzPredictorSurvey", "Send-AzPredictorRating") # Format files (.ps1xml) to be loaded when importing this module diff --git a/tools/Az.Tools.Predictor/build.proj b/tools/Az.Tools.Predictor/build.proj index 5e4784f59746..231c04e5e304 100644 --- a/tools/Az.Tools.Predictor/build.proj +++ b/tools/Az.Tools.Predictor/build.proj @@ -32,7 +32,7 @@ - +