mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 20:26:49 +00:00
Update Windows/Ubuntu image gen pipeline to use OIDC (#9704)
This commit is contained in:
@@ -59,11 +59,13 @@ jobs:
|
|||||||
arguments: -RepoUrl $(CUSTOM_REPOSITORY_URL) `
|
arguments: -RepoUrl $(CUSTOM_REPOSITORY_URL) `
|
||||||
-RepoBranch $(CUSTOM_REPOSITORY_BRANCH)
|
-RepoBranch $(CUSTOM_REPOSITORY_BRANCH)
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: AzurePowerShell@5
|
||||||
displayName: 'Set variables'
|
displayName: 'Set variables'
|
||||||
inputs:
|
inputs:
|
||||||
targetType: 'inline'
|
TargetAzurePs: LatestVersion
|
||||||
script: |
|
azureSubscription: 'spn-hosted-runners'
|
||||||
|
ScriptType: 'InlineScript'
|
||||||
|
Inline: |
|
||||||
$ImageType = "${{ parameters.image_type }}"
|
$ImageType = "${{ parameters.image_type }}"
|
||||||
$TemplateDirectoryName = if ($ImageType.StartsWith("ubuntu")) { "ubuntu/templates" } else { "windows/templates" }
|
$TemplateDirectoryName = if ($ImageType.StartsWith("ubuntu")) { "ubuntu/templates" } else { "windows/templates" }
|
||||||
$TemplateDirectoryPath = Join-Path "images" $TemplateDirectoryName | Resolve-Path
|
$TemplateDirectoryPath = Join-Path "images" $TemplateDirectoryName | Resolve-Path
|
||||||
@@ -79,13 +81,16 @@ jobs:
|
|||||||
$TempResourceGroupName = "packer-temp-$ManagedImageName"
|
$TempResourceGroupName = "packer-temp-$ManagedImageName"
|
||||||
Write-Host "##vso[task.setvariable variable=TempResourceGroupName;]$TempResourceGroupName"
|
Write-Host "##vso[task.setvariable variable=TempResourceGroupName;]$TempResourceGroupName"
|
||||||
|
|
||||||
|
$clientSecret = $(az keyvault secret show --name "spnhostedrunners" --vault-name "gh-imagegeneration" --query value -o tsv)
|
||||||
|
Write-Host "##vso[task.setvariable variable=ClientSecret;issecret=true]$clientSecret"
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: 'Build VM'
|
displayName: 'Build VM'
|
||||||
inputs:
|
inputs:
|
||||||
targetType: filePath
|
targetType: filePath
|
||||||
filePath: ./images.CI/linux-and-win/build-image.ps1
|
filePath: ./images.CI/linux-and-win/build-image.ps1
|
||||||
arguments: -ClientId $(CLIENT_ID) `
|
arguments: -ClientId $(CLIENT_ID) `
|
||||||
-ClientSecret $(CLIENT_SECRET) `
|
-ClientSecret "$(ClientSecret)" `
|
||||||
-TemplatePath $(TemplatePath) `
|
-TemplatePath $(TemplatePath) `
|
||||||
-ImageName "$(ManagedImageName)" `
|
-ImageName "$(ManagedImageName)" `
|
||||||
-ImageResourceGroupName $(AZURE_RESOURCE_GROUP) `
|
-ImageResourceGroupName $(AZURE_RESOURCE_GROUP) `
|
||||||
@@ -172,5 +177,5 @@ jobs:
|
|||||||
arguments: -TempResourceGroupName "$(TempResourceGroupName)" `
|
arguments: -TempResourceGroupName "$(TempResourceGroupName)" `
|
||||||
-SubscriptionId $(AZURE_SUBSCRIPTION) `
|
-SubscriptionId $(AZURE_SUBSCRIPTION) `
|
||||||
-ClientId $(CLIENT_ID) `
|
-ClientId $(CLIENT_ID) `
|
||||||
-ClientSecret $(CLIENT_SECRET) `
|
-ClientSecret "$(ClientSecret)" `
|
||||||
-TenantId $(AZURE_TENANT)
|
-TenantId $(AZURE_TENANT)
|
||||||
|
|||||||
Reference in New Issue
Block a user