From 33cf8988dc5013a6a0a0fa3aee9367bfd928f2ca Mon Sep 17 00:00:00 2001 From: Beisi Zhou Date: Fri, 6 Nov 2020 14:12:06 +0800 Subject: [PATCH 1/3] [dailybuild] bump version and sign --- .azure-pipelines/daily-build.yml | 162 ++++++++++++++++++--- tools/Az/Az.psd1 | 1 - tools/RunVersionController.ps1 | 19 ++- tools/VersionController/MinimalVersion.csv | 3 +- 4 files changed, 163 insertions(+), 22 deletions(-) diff --git a/.azure-pipelines/daily-build.yml b/.azure-pipelines/daily-build.yml index ed334cfdac4e..06be625b0347 100644 --- a/.azure-pipelines/daily-build.yml +++ b/.azure-pipelines/daily-build.yml @@ -9,20 +9,148 @@ schedules: pr: none -pool: - vmImage: 'windows-2019' - -steps: -- task: DotNetCoreCLI@2 - displayName: Build for Version Bump - inputs: - command: 'custom' - custom: 'msbuild' - arguments: 'build.proj' - -- task: ComponentGovernanceComponentDetection@0 - displayName: Component Detection - inputs: - scanType: 'Register' - verbosity: 'Normal' - alertWarningLevel: 'High' \ No newline at end of file +jobs: +- job: DailyBuild + timeoutInMinutes: 180 + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: 'Initialization' + inputs: + targetType: 'inline' + script: | + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted + # Avoid issue of filename too long + git config --global core.longpaths true + # Wipe any changes from a previous branch + git clean -xdf + + - task: PowerShell@2 + displayName: Prepare Powershell $(PSVersion) + inputs: + filePath: 'tools/Test/SmokeTest/PrepareRequiredPowershell.ps1' + arguments: '-RequiredPsVersion $(PSVersion)' + + - task: PowerShell@2 + displayName: 'Install platyPS' + inputs: + targetType: 'inline' + script: | + $command = "`$PSVersionTable ` + Install-Module platyPS -Force -Confirm:`$false -Scope CurrentUser ` + Exit" + dotnet tool run pwsh -c $command + + - task: DotNetCoreCLI@2 + displayName: 'Build for Bumping Version' + inputs: + command: custom + custom: msbuild + arguments: 'build.proj /t:"Build" /p:"Configuration=Release"' + + - task: PowerShell@2 + displayName: 'Bump Version' + inputs: + targetType: 'inline' + script: | + $command = "`$PSVersionTable ` + ./tools/RunVersionController.ps1 -MonthName $(MonthName) -Year $(Year) ` + Exit" + dotnet tool run pwsh -c $command + + - task: PowerShell@2 + displayName: 'Push to Branch internal/dailybuild' + inputs: + targetType: 'inline' + script: | + git config user.email "bez@microsoft.com" + git config user.name "azuresdkci" + git remote set-url origin https://$(Token)@github.com/Azure/azure-powershell.git + git checkout -b internal/dailybuild + git add . + git commit -m "Bump Version" + git status + git push -u origin internal/dailybuild --force + + - task: PowerShell@2 + displayName: 'Clean artifacts folder' + inputs: + targetType: 'inline' + script: | + Remove-Item -Force -Recurse -Path artifacts + + - task: DotNetCoreCLI@2 + displayName: 'Build for Test' + inputs: + command: custom + custom: msbuild + arguments: 'build.proj /t:Build /p:Configuration=Release' + + - task: EsrpCodeSigning@1 + inputs: + ConnectedServiceName: '$(signServiceConnection)' + FolderPath: 'artifacts' + Pattern: | + Release/**/Microsoft*Azure*PowerShell*Cmdlets*.dll + Release/**/Az.*.private.dll + Release/**/Microsoft.Azure.PowerShell.Authentication.dll + Release/**/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll + Release/**/Microsoft.Azure.PowerShell.Authenticators.dll + !Release/**/Microsoft*Azure*PowerShell*Cmdlets*.Test.dll + UseMinimatch: true + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "KeyCode": "CP-233863-SN", + "OperationCode": "StrongNameSign", + "Parameters": {}, + "ToolName": "sign", + "ToolVersion": "1.0" + }, + { + "KeyCode": "CP-233863-SN", + "OperationCode": "StrongNameVerify", + "Parameters": {}, + "ToolName": "sign", + "ToolVersion": "1.0" + }, + { + "KeyCode": "CP-230012", + "OperationCode": "SigntoolSign", + "Parameters": { + "OpusName": "Microsoft", + "OpusInfo": "http://www.microsoft.com", + "FileDigest": "/fd \"SHA256\"", + "PageHash": "/NPH", + "TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + }, + "ToolName": "sign", + "ToolVersion": "1.0" + }, + { + "KeyCode": "CP-230012", + "OperationCode": "SigntoolVerify", + "Parameters": {}, + "ToolName": "sign", + "ToolVersion": "1.0" + } + ] + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + + - task: DotNetCoreCLI@2 + displayName: Publish + inputs: + command: custom + custom: msbuild + arguments: 'build.proj /t:Publish /p:Configuration=Release;NuGetKey=$(NuGetKey)' + + - task: PublishPipelineArtifact@0 + displayName: 'Save artifacts' + inputs: + artifactName: artifacts + targetPath: artifacts + condition: succeededOrFailed() \ No newline at end of file diff --git a/tools/Az/Az.psd1 b/tools/Az/Az.psd1 index f0683bad13dd..5afbbbe4b4e4 100644 --- a/tools/Az/Az.psd1 +++ b/tools/Az/Az.psd1 @@ -57,7 +57,6 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.1.2'; }, @{ModuleName = 'Az.Aks'; RequiredVersion = '2.0.0'; }, @{ModuleName = 'Az.AnalysisServices'; RequiredVersion = '1.1.4'; }, @{ModuleName = 'Az.ApiManagement'; RequiredVersion = '2.1.0'; }, - @{ModuleName = 'Az.AppConfiguration'; RequiredVersion = '1.0.0'; }, @{ModuleName = 'Az.ApplicationInsights'; RequiredVersion = '1.1.0'; }, @{ModuleName = 'Az.Automation'; RequiredVersion = '1.4.0'; }, @{ModuleName = 'Az.Batch'; RequiredVersion = '3.1.0'; }, diff --git a/tools/RunVersionController.ps1 b/tools/RunVersionController.ps1 index 71194c133d28..8295a014666a 100644 --- a/tools/RunVersionController.ps1 +++ b/tools/RunVersionController.ps1 @@ -5,9 +5,15 @@ [CmdletBinding(DefaultParameterSetName="ReleaseAz")] Param( - [Parameter(ParameterSetName='ReleaseAz', Mandatory = $true)] + [Parameter(ParameterSetName='ReleaseAz', Mandatory = $false)] [string]$Release, + [Parameter(ParameterSetName='ReleaseAz', Mandatory = $false)] + [string]$MonthName, + + [Parameter(ParameterSetName='ReleaseAz', Mandatory = $false)] + [string]$Year, + [Parameter(ParameterSetName='ReleaseSingleModule', Mandatory = $true)] [string]$ModuleName, @@ -188,6 +194,15 @@ switch ($PSCmdlet.ParameterSetName) "ReleaseAz" { + if('' -eq $Release) + { + if(('' -eq $MonthName) -or ('' -eq $Year)) + { + throw "Must given parameter Release or MonthName&Year" + } + $Release = "$MonthName $Year" + } + # clean the unnecessary SerializedCmdlets json file $ExistSerializedCmdletJsonFile = Get-ExistSerializedCmdletJsonFile $ExpectJsonHashSet = @{} @@ -315,4 +330,4 @@ switch ($PSCmdlet.ParameterSetName) Update-ModuleManifest -Path "$PSScriptRoot\Az\Az.psd1" -ModuleVersion $newVersion -ReleaseNotes $releaseNotes Update-ChangeLog -Content $changeLog -RootPath $rootPath } -} +} \ No newline at end of file diff --git a/tools/VersionController/MinimalVersion.csv b/tools/VersionController/MinimalVersion.csv index f6bb99c5c603..517a3f377fc3 100644 --- a/tools/VersionController/MinimalVersion.csv +++ b/tools/VersionController/MinimalVersion.csv @@ -1,2 +1 @@ -"Module","Minimal Version" -"Az.AppConfiguration","1.0.0" \ No newline at end of file +"Module","Minimal Version" \ No newline at end of file From 9034725a0c8e0f9fb5065819891b5f13881eea8a Mon Sep 17 00:00:00 2001 From: Beisi Zhou Date: Tue, 17 Nov 2020 17:17:53 +0800 Subject: [PATCH 2/3] Polish codes --- .azure-pipelines/daily-build.yml | 4 ++-- tools/Az/Az.psd1 | 1 + tools/RunVersionController.ps1 | 23 +++++++++------------- tools/VersionController/MinimalVersion.csv | 3 ++- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.azure-pipelines/daily-build.yml b/.azure-pipelines/daily-build.yml index 06be625b0347..7e04f8ac0cb5 100644 --- a/.azure-pipelines/daily-build.yml +++ b/.azure-pipelines/daily-build.yml @@ -64,7 +64,7 @@ jobs: inputs: targetType: 'inline' script: | - git config user.email "bez@microsoft.com" + git config user.email "azuresdkci@microsoft.com" git config user.name "azuresdkci" git remote set-url origin https://$(Token)@github.com/Azure/azure-powershell.git git checkout -b internal/dailybuild @@ -81,7 +81,7 @@ jobs: Remove-Item -Force -Recurse -Path artifacts - task: DotNetCoreCLI@2 - displayName: 'Build for Test' + displayName: 'Build after Version Bump up' inputs: command: custom custom: msbuild diff --git a/tools/Az/Az.psd1 b/tools/Az/Az.psd1 index 5afbbbe4b4e4..f0683bad13dd 100644 --- a/tools/Az/Az.psd1 +++ b/tools/Az/Az.psd1 @@ -57,6 +57,7 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.1.2'; }, @{ModuleName = 'Az.Aks'; RequiredVersion = '2.0.0'; }, @{ModuleName = 'Az.AnalysisServices'; RequiredVersion = '1.1.4'; }, @{ModuleName = 'Az.ApiManagement'; RequiredVersion = '2.1.0'; }, + @{ModuleName = 'Az.AppConfiguration'; RequiredVersion = '1.0.0'; }, @{ModuleName = 'Az.ApplicationInsights'; RequiredVersion = '1.1.0'; }, @{ModuleName = 'Az.Automation'; RequiredVersion = '1.4.0'; }, @{ModuleName = 'Az.Batch'; RequiredVersion = '3.1.0'; }, diff --git a/tools/RunVersionController.ps1 b/tools/RunVersionController.ps1 index 8295a014666a..56f6966930ea 100644 --- a/tools/RunVersionController.ps1 +++ b/tools/RunVersionController.ps1 @@ -5,13 +5,13 @@ [CmdletBinding(DefaultParameterSetName="ReleaseAz")] Param( - [Parameter(ParameterSetName='ReleaseAz', Mandatory = $false)] + [Parameter(ParameterSetName='ReleaseAz', Mandatory = $true)] [string]$Release, - [Parameter(ParameterSetName='ReleaseAz', Mandatory = $false)] + [Parameter(ParameterSetName='ReleaseAzByMonthAndYear', Mandatory = $true)] [string]$MonthName, - [Parameter(ParameterSetName='ReleaseAz', Mandatory = $false)] + [Parameter(ParameterSetName='ReleaseAzByMonthAndYear', Mandatory = $true)] [string]$Year, [Parameter(ParameterSetName='ReleaseSingleModule', Mandatory = $true)] @@ -191,18 +191,13 @@ switch ($PSCmdlet.ParameterSetName) dotnet $PSScriptRoot/../artifacts/VersionController/VersionController.Netcore.dll $PSScriptRoot/../artifacts/VersionController/Exceptions $ModuleName } - "ReleaseAz" + "ReleaseAzByMonthAndYear" { - - if('' -eq $Release) - { - if(('' -eq $MonthName) -or ('' -eq $Year)) - { - throw "Must given parameter Release or MonthName&Year" - } - $Release = "$MonthName $Year" - } - + $Release = "$MonthName $Year" + } + + {$PSItem.StartsWith("ReleaseAz")} + { # clean the unnecessary SerializedCmdlets json file $ExistSerializedCmdletJsonFile = Get-ExistSerializedCmdletJsonFile $ExpectJsonHashSet = @{} diff --git a/tools/VersionController/MinimalVersion.csv b/tools/VersionController/MinimalVersion.csv index 517a3f377fc3..f6bb99c5c603 100644 --- a/tools/VersionController/MinimalVersion.csv +++ b/tools/VersionController/MinimalVersion.csv @@ -1 +1,2 @@ -"Module","Minimal Version" \ No newline at end of file +"Module","Minimal Version" +"Az.AppConfiguration","1.0.0" \ No newline at end of file From a7eba2ff3f9ec7301d08f00c87e02ee310f68a41 Mon Sep 17 00:00:00 2001 From: Beisi Zhou Date: Wed, 18 Nov 2020 15:01:37 +0800 Subject: [PATCH 3/3] cancel commit intermediate result to 'internal/dailybuild' --- .azure-pipelines/daily-build.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.azure-pipelines/daily-build.yml b/.azure-pipelines/daily-build.yml index 7e04f8ac0cb5..a03c816ba021 100644 --- a/.azure-pipelines/daily-build.yml +++ b/.azure-pipelines/daily-build.yml @@ -59,19 +59,19 @@ jobs: Exit" dotnet tool run pwsh -c $command - - task: PowerShell@2 - displayName: 'Push to Branch internal/dailybuild' - inputs: - targetType: 'inline' - script: | - git config user.email "azuresdkci@microsoft.com" - git config user.name "azuresdkci" - git remote set-url origin https://$(Token)@github.com/Azure/azure-powershell.git - git checkout -b internal/dailybuild - git add . - git commit -m "Bump Version" - git status - git push -u origin internal/dailybuild --force + # - task: PowerShell@2 + # displayName: 'Push to Branch internal/dailybuild' + # inputs: + # targetType: 'inline' + # script: | + # git config user.email "azuresdkci@microsoft.com" + # git config user.name "azuresdkci" + # git remote set-url origin https://$(Token)@github.com/Azure/azure-powershell.git + # git checkout -b internal/dailybuild + # git add . + # git commit -m "Bump Version" + # git status + # git push -u origin internal/dailybuild --force - task: PowerShell@2 displayName: 'Clean artifacts folder'