Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into Localization
Browse files Browse the repository at this point in the history
  • Loading branch information
vmapetr committed Nov 4, 2022
2 parents 1ddb021 + 967954c commit 231204a
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions .vsts.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,34 +90,33 @@ extends:
inputs:
artifactName: agent

- ${{ if not(parameters.onlyGitHubRelease) }}:
# Upload agent packages to Azure blob storage and refresh Azure CDN
- powershell: |
Write-Host "Preloading Azure modules." # This is for better performance, to avoid module-autoloading.
Import-Module Azure, Az.Accounts, Az.Storage, Az.Cdn -ErrorAction Ignore -PassThru
$uploadFiles = New-Object System.Collections.ArrayList
$certificateThumbprint = (Get-ItemProperty -Path "$(ServicePrincipalReg)").ServicePrincipalCertThumbprint
$clientId = (Get-ItemProperty -Path "$(ServicePrincipalReg)").ServicePrincipalClientId
Write-Host "##vso[task.setsecret]$certificateThumbprint"
Write-Host "##vso[task.setsecret]$clientId"
Login-AzAccount -ServicePrincipal -CertificateThumbprint $certificateThumbprint -ApplicationId $clientId -TenantId $(TenantId)
Select-AzSubscription -SubscriptionId $(SubscriptionId)
$storage = Get-AzStorageAccount -ResourceGroupName vstsagentpackage -AccountName vstsagentpackage
$versionDir = "${{ parameters.version }}"
Get-ChildItem -LiteralPath "$(System.ArtifactsDirectory)/agent" | ForEach-Object {
$target=$_
Get-ChildItem -LiteralPath "$(System.ArtifactsDirectory)/agent/$target" -Include "*.zip","*.tar.gz" | ForEach-Object {
$executable = $_
Write-Host "Uploading $executable to BlobStorage vstsagentpackage/agent/$versionDir"
Set-AzStorageBlobContent -Context $storage.Context -Container agent -File "$(System.ArtifactsDirectory)/agent/$target/$executable" -Blob "$versionDir/$executable" -Force
$uploadFiles.Add("/agent/$versionDir/$executable")
}
# Upload agent packages to Azure blob storage and refresh Azure CDN
- powershell: |
Write-Host "Preloading Azure modules." # This is for better performance, to avoid module-autoloading.
Import-Module Azure, Az.Accounts, Az.Storage, Az.Cdn -ErrorAction Ignore -PassThru
$uploadFiles = New-Object System.Collections.ArrayList
$certificateThumbprint = (Get-ItemProperty -Path "$(ServicePrincipalReg)").ServicePrincipalCertThumbprint
$clientId = (Get-ItemProperty -Path "$(ServicePrincipalReg)").ServicePrincipalClientId
Write-Host "##vso[task.setsecret]$certificateThumbprint"
Write-Host "##vso[task.setsecret]$clientId"
Login-AzAccount -ServicePrincipal -CertificateThumbprint $certificateThumbprint -ApplicationId $clientId -TenantId $(TenantId)
Select-AzSubscription -SubscriptionId $(SubscriptionId)
$storage = Get-AzStorageAccount -ResourceGroupName vstsagentpackage -AccountName vstsagentpackage
$versionDir = "${{ parameters.version }}"
Get-ChildItem -LiteralPath "$(System.ArtifactsDirectory)/agent" | ForEach-Object {
$target=$_
Get-ChildItem -LiteralPath "$(System.ArtifactsDirectory)/agent/$target" -Include "*.zip","*.tar.gz" | ForEach-Object {
$executable = $_
Write-Host "Uploading $executable to BlobStorage vstsagentpackage/agent/$versionDir"
Set-AzStorageBlobContent -Context $storage.Context -Container agent -File "$(System.ArtifactsDirectory)/agent/$target/$executable" -Blob "$versionDir/$executable" -Force
$uploadFiles.Add("/agent/$versionDir/$executable")
}
Write-Host "Purge Azure CDN Cache"
Unpublish-AzCdnEndpointContent -EndpointName vstsagentpackage -ProfileName vstsagentpackage -ResourceGroupName vstsagentpackage -PurgeContent $uploadFiles
Write-Host "Force Refresh Azure CDN Cache"
Publish-AzCdnEndpointContent -EndpointName vstsagentpackage -ProfileName vstsagentpackage -ResourceGroupName vstsagentpackage -LoadContent $uploadFiles
displayName: Upload to Azure Blob
}
Write-Host "Purge Azure CDN Cache"
Unpublish-AzCdnEndpointContent -EndpointName vstsagentpackage -ProfileName vstsagentpackage -ResourceGroupName vstsagentpackage -PurgeContent $uploadFiles
Write-Host "Force Refresh Azure CDN Cache"
Publish-AzCdnEndpointContent -EndpointName vstsagentpackage -ProfileName vstsagentpackage -ResourceGroupName vstsagentpackage -LoadContent $uploadFiles
displayName: Upload to Azure Blob
# Download all agent hashes created in previous phases
- task: DownloadBuildArtifacts@0
Expand Down

0 comments on commit 231204a

Please sign in to comment.