Skip to content

Commit 56d1b36

Browse files
authored
Updating Host CI lease access (#10314) (#10318)
* Updating Host CI lease access (#10294) * Fixing Azure Powershell argument configuration (#10307)
1 parent 8b4524c commit 56d1b36

File tree

5 files changed

+38
-56
lines changed

5 files changed

+38
-56
lines changed

azure-pipelines.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -349,17 +349,12 @@ jobs:
349349
targetType: 'inline'
350350
script: 'Install-Module -Name Az.Storage -RequiredVersion 1.11.0 -Scope CurrentUser -Force -AllowClobber'
351351

352-
- task: AzureKeyVault@1
353-
inputs:
354-
# Note: This is actually a Service Connection in DevOps, not an Azure subscription name
355-
azureSubscription: 'Azure-Functions-Host-CI'
356-
keyVaultName: 'azure-functions-host-ci'
357-
secretsFilter: '*'
358-
- task: PowerShell@2
352+
- task: AzurePowerShell@5
359353
displayName: 'Checkout secrets'
360354
inputs:
361-
filePath: '$(Build.Repository.LocalPath)\build\checkout-secrets.ps1'
362-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'''
355+
azureSubscription: Azure-Functions-Host-CI
356+
ScriptPath: '$(Build.Repository.LocalPath)\build\checkout-secrets.ps1'
357+
azurePowerShellVersion: 'LatestVersion'
363358
- task: AzureKeyVault@1
364359
inputs:
365360
# Note: This is actually a Service Connection in DevOps, not an Azure subscription name
@@ -382,12 +377,14 @@ jobs:
382377
AzureWebJobsEventHubReceiver: $(EventHub)
383378
AzureWebJobsSecretStorageKeyVaultConnectionString: $(KeyVaultConnectionString)
384379
AzureWebJobsSecretStorageKeyVaultName: $(KeyVaultName)
385-
- task: PowerShell@2
380+
- task: AzurePowerShell@5
386381
condition: always()
387382
displayName: 'Checkin secrets'
388383
inputs:
389-
filePath: '$(Build.Repository.LocalPath)\build\checkin-secrets.ps1'
390-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'' -leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'
384+
azureSubscription: Azure-Functions-Host-CI
385+
ScriptPath: '$(Build.Repository.LocalPath)\build\checkin-secrets.ps1'
386+
ScriptArguments: '-leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'
387+
azurePowerShellVersion: 'LatestVersion'
391388

392389
- job: RunIntegrationTests
393390
pool:
@@ -425,11 +422,12 @@ jobs:
425422
azureSubscription: 'Azure-Functions-Host-CI'
426423
keyVaultName: 'azure-functions-host-ci'
427424
secretsFilter: '*'
428-
- task: PowerShell@2
425+
- task: AzurePowerShell@5
429426
displayName: 'Checkout secrets'
430427
inputs:
431-
filePath: '$(Build.Repository.LocalPath)\build\checkout-secrets.ps1'
432-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'''
428+
azureSubscription: Azure-Functions-Host-CI
429+
ScriptPath: '$(Build.Repository.LocalPath)\build\checkout-secrets.ps1'
430+
azurePowerShellVersion: 'LatestVersion'
433431
- task: AzureKeyVault@1
434432
inputs:
435433
# Note: This is actually a Service Connection in DevOps, not an Azure subscription name
@@ -574,9 +572,11 @@ jobs:
574572
arguments: '--filter "Group=ReleaseTests" --no-build'
575573
projects: |
576574
**\WebJobs.Script.Tests.Integration.csproj
577-
- task: PowerShell@2
575+
- task: AzurePowerShell@5
578576
condition: always()
579577
displayName: 'Checkin secrets'
580578
inputs:
581-
filePath: '$(Build.Repository.LocalPath)\build\checkin-secrets.ps1'
582-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'' -leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'
579+
azureSubscription: Azure-Functions-Host-CI
580+
ScriptPath: '$(Build.Repository.LocalPath)\build\checkin-secrets.ps1'
581+
ScriptArguments: '-leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'
582+
azurePowerShellVersion: 'LatestVersion'

build/checkin-secrets.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
param (
2-
[string]$connectionString = "",
32
[string]$leaseBlob = "",
43
[string]$leaseToken = ""
54
)
@@ -16,7 +15,7 @@ if ($leaseToken -eq "") {
1615

1716
Write-Host "Breaking lease for $leaseBlob."
1817

19-
$storageContext = New-AzStorageContext -ConnectionString $connectionString
18+
$storageContext = New-AzStorageContext -StorageAccountName "azurefunctionshostci0" -UseConnectedAccount
2019
$blob = Get-AzStorageBlob -Context $storageContext -Container "ci-locks" -Blob $leaseBlob
2120

2221
$accessCondition = New-Object -TypeName Microsoft.Azure.Storage.AccessCondition

build/checkout-secrets.ps1

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
param (
2-
[string]$connectionString = ""
3-
)
4-
51
function AcquireLease($blob) {
62
try {
73
return $blob.ICloudBlob.AcquireLease($null, $null, $null, $null, $null)
@@ -14,15 +10,10 @@ function AcquireLease($blob) {
1410
# use this for tracking metadata in lease blobs
1511
$buildName = "3.0." + $env:buildNumber + "_" + $env:SYSTEM_JOBDISPLAYNAME
1612

17-
$azVersion = "1.11.0"
1813
Import-Module Az.Storage
19-
$azModule = Get-Module -Name Az.Storage
20-
if ($azModule.Version -ne $azVersion) {
21-
throw "Az.Storage module version $azVersion was not found. Current version: $($azModule.Version)"
22-
}
2314

2415
# get a blob lease to prevent test overlap
25-
$storageContext = New-AzStorageContext -ConnectionString $connectionString
16+
$storageContext = New-AzStorageContext -StorageAccountName "azurefunctionshostci0" -UseConnectedAccount
2617

2718
While($true) {
2819
$blobs = Get-AzStorageBlob -Context $storageContext -Container "ci-locks"

eng/ci/templates/official/jobs/run-integration-tests.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,12 @@ jobs:
4949
command: ci
5050
workingDir: sample/CustomHandlerRetry
5151

52-
- task: AzureKeyVault@1
53-
inputs:
54-
# Note: This is actually a Service Connection in DevOps, not an Azure subscription name
55-
azureSubscription: Azure-Functions-Host-CI-internal
56-
keyVaultName: azure-functions-host-ci
57-
secretsFilter: '*'
58-
59-
- task: PowerShell@2
52+
- task: AzurePowerShell@5
6053
displayName: Checkout secrets
6154
inputs:
62-
filePath: build/checkout-secrets.ps1
63-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'''
55+
azureSubscription: Azure-Functions-Host-CI-internal
56+
azurePowerShellVersion: 'LatestVersion'
57+
ScriptPath: build/checkout-secrets.ps1
6458

6559
- task: AzureKeyVault@1
6660
inputs:
@@ -218,9 +212,11 @@ jobs:
218212
arguments: '--filter "Group=ReleaseTests" $(test_args)'
219213
projects: $(test_projects)
220214

221-
- task: PowerShell@2
215+
- task: AzurePowerShell@5
222216
condition: always()
223217
displayName: Checkin secrets
224218
inputs:
225-
filePath: build/checkin-secrets.ps1
226-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'' -leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'
219+
azureSubscription: Azure-Functions-Host-CI-internal
220+
azurePowerShellVersion: 'LatestVersion'
221+
ScriptPath: build/checkin-secrets.ps1
222+
ScriptArguments: '-leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'

eng/ci/templates/official/jobs/run-non-e2e-tests.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,12 @@ jobs:
2929
targetType: inline
3030
script: 'Install-Module -Name Az.Storage -RequiredVersion 1.11.0 -Scope CurrentUser -Force -AllowClobber'
3131

32-
- task: AzureKeyVault@1
33-
inputs:
34-
# Note: This is actually a Service Connection in DevOps, not an Azure subscription name
35-
azureSubscription: Azure-Functions-Host-CI-internal
36-
keyVaultName: azure-functions-host-ci
37-
secretsFilter: '*'
38-
39-
- task: PowerShell@2
32+
- task: AzurePowerShell@5
4033
displayName: Checkout secrets
4134
inputs:
42-
filePath: build/checkout-secrets.ps1
43-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'''
35+
azureSubscription: Azure-Functions-Host-CI-internal
36+
azurePowerShellVersion: 'LatestVersion'
37+
ScriptPath: build/checkout-secrets.ps1
4438

4539
- task: AzureKeyVault@1
4640
inputs:
@@ -81,9 +75,11 @@ jobs:
8175
AzureWebJobsSecretStorageKeyVaultName: $(KeyVaultName)
8276
AzureWebJobsEventHubPath: testhub
8377

84-
- task: PowerShell@2
78+
- task: AzurePowerShell@5
8579
condition: always()
8680
displayName: Checkin secrets
8781
inputs:
88-
filePath: build/checkin-secrets.ps1
89-
arguments: '-connectionString ''$(Storage-azurefunctionshostci0)'' -leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'
82+
azureSubscription: Azure-Functions-Host-CI-internal
83+
azurePowerShellVersion: 'LatestVersion'
84+
ScriptPath: build/checkin-secrets.ps1
85+
ScriptArguments: '-leaseBlob $(LeaseBlob) -leaseToken $(LeaseToken)'

0 commit comments

Comments
 (0)