Skip to content

Commit

Permalink
[Pipeline] dailyBuild: bump version and sign (#13439)
Browse files Browse the repository at this point in the history
* [dailybuild] bump version and sign

* Polish codes

* cancel commit intermediate result to 'internal/dailybuild'

Co-authored-by: azuresdkci <[email protected]>
  • Loading branch information
BethanyZhou and azuresdkci authored Nov 20, 2020
1 parent af7cf59 commit a96ccb7
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 20 deletions.
162 changes: 145 additions & 17 deletions .azure-pipelines/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
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 "[email protected]"
# 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 after Version Bump up'
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()
16 changes: 13 additions & 3 deletions tools/RunVersionController.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Param(
[Parameter(ParameterSetName='ReleaseAz', Mandatory = $true)]
[string]$Release,

[Parameter(ParameterSetName='ReleaseAzByMonthAndYear', Mandatory = $true)]
[string]$MonthName,

[Parameter(ParameterSetName='ReleaseAzByMonthAndYear', Mandatory = $true)]
[string]$Year,

[Parameter(ParameterSetName='ReleaseSingleModule', Mandatory = $true)]
[string]$ModuleName,

Expand Down Expand Up @@ -185,9 +191,13 @@ switch ($PSCmdlet.ParameterSetName)
dotnet $PSScriptRoot/../artifacts/VersionController/VersionController.Netcore.dll $PSScriptRoot/../artifacts/VersionController/Exceptions $ModuleName
}

"ReleaseAz"
"ReleaseAzByMonthAndYear"
{

$Release = "$MonthName $Year"
}

{$PSItem.StartsWith("ReleaseAz")}
{
# clean the unnecessary SerializedCmdlets json file
$ExistSerializedCmdletJsonFile = Get-ExistSerializedCmdletJsonFile
$ExpectJsonHashSet = @{}
Expand Down Expand Up @@ -315,4 +325,4 @@ switch ($PSCmdlet.ParameterSetName)
Update-ModuleManifest -Path "$PSScriptRoot\Az\Az.psd1" -ModuleVersion $newVersion -ReleaseNotes $releaseNotes
Update-ChangeLog -Content $changeLog -RootPath $rootPath
}
}
}

0 comments on commit a96ccb7

Please sign in to comment.