mirror of
https://github.com/actions/runner-images.git
synced 2026-01-07 10:48:55 +08:00
46 lines
1.9 KiB
YAML
46 lines
1.9 KiB
YAML
jobs:
|
|
- job:
|
|
pool: ci-agent-pool
|
|
timeoutInMinutes: 600
|
|
variables:
|
|
- group: Image Generation Variables
|
|
|
|
steps:
|
|
- pwsh: |
|
|
Remove-Item -path './*' -Recurse -Force
|
|
Write-Host "Download $(BRANCH_NAME) branch from $(IMAGE_GEN_REPO_URI)"
|
|
git clone $(IMAGE_GEN_REPO_URI) . -b $(BRANCH_NAME) --single-branch --depth 1
|
|
displayName: 'Download custom repository'
|
|
condition: and(ne(variables['BRANCH_NAME'], ''), ne(variables['IMAGE_GEN_REPO_URI'], ''))
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Build VM'
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: ./images.CI/build-image.ps1
|
|
arguments: -ResourcesNamePrefix $(Build.BuildNumber) `
|
|
-ClientId $(CLIENT_ID) `
|
|
-ClientSecret $(CLIENT_SECRET) `
|
|
-Image ${{ parameters.image_type }} `
|
|
-ResourceGroup $(AZURE_RESOURCE_GROUP) `
|
|
-StorageAccount $(AZURE_STORAGE_ACCOUNT) `
|
|
-SubscriptionId $(AZURE_SUBSCRIPTION) `
|
|
-TenantId $(AZURE_TENANT) `
|
|
-Location $(AZURE_LOCATION) `
|
|
-VirtualNetworkName $(BUILD_AGENT_VNET_NAME) `
|
|
-VirtualNetworkRG $(BUILD_AGENT_VNET_RESOURCE_GROUP) `
|
|
-VirtualNetworkSubnet $(BUILD_AGENT_SUBNET_NAME) `
|
|
-GitHubFeedToken $(GITHUB_TOKEN)
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Clean up resources'
|
|
condition: always()
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: ./images.CI/cleanup.ps1
|
|
arguments: -ResourcesNamePrefix $(Build.BuildNumber) `
|
|
-ClientId $(CLIENT_ID) `
|
|
-ClientSecret $(CLIENT_SECRET) `
|
|
-Image ${{ parameters.image_type }} `
|
|
-SubscriptionId $(AZURE_SUBSCRIPTION) `
|
|
-TenantId $(AZURE_TENANT) |