diff --git a/.azure-pipelines/daily-build.yml b/.azure-pipelines/daily-build.yml index ed334cfdac4e..a03c816ba021 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 "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' + 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() \ No newline at end of file diff --git a/tools/RunVersionController.ps1 b/tools/RunVersionController.ps1 index 71194c133d28..56f6966930ea 100644 --- a/tools/RunVersionController.ps1 +++ b/tools/RunVersionController.ps1 @@ -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, @@ -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 = @{} @@ -315,4 +325,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