mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2026-01-06 18:17:26 +08:00
* add release step * add creation release * move file to another folder * resolve comments * minor changes * change BuildNumber to BuildId
63 lines
2.7 KiB
YAML
63 lines
2.7 KiB
YAML
jobs:
|
|
- job:
|
|
pool: ci-agent-pool
|
|
timeoutInMinutes: 600
|
|
variables:
|
|
- group: Image Generation Variables
|
|
|
|
steps:
|
|
- task: PowerShell@2
|
|
displayName: 'Download custom repository'
|
|
condition: and(ne(variables['CUSTOM_REPOSITORY_BRANCH'], ''), ne(variables['CUSTOM_REPOSITORY_URL'], ''))
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
Remove-Item -path './*' -Recurse -Force
|
|
Write-Host "Download $(CUSTOM_REPOSITORY_BRANCH) branch from $(CUSTOM_REPOSITORY_URL)"
|
|
# git on self-hosted agent produces some output to stderr even during successful cloning
|
|
# use cmd output redirect to overcome it
|
|
cmd /c "git clone $(CUSTOM_REPOSITORY_URL) . -b $(CUSTOM_REPOSITORY_BRANCH) --single-branch --depth 1 2>&1"
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Build VM'
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: ./images.CI/build-image.ps1
|
|
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
|
-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: 'Create release for VM deployment'
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: ./images.CI/create-release.ps1
|
|
arguments: -BuildId $(Build.BuildId) `
|
|
-Organization $(RELEASE_TARGET_ORGANIZATION) `
|
|
-DefinitionId $(RELEASE_TARGET_DEFINITION_ID) `
|
|
-Project $(RELEASE_TARGET_PROJECT) `
|
|
-ImageName ${{ parameters.image_type }} `
|
|
-AccessToken $(RELEASE_TARGET_TOKEN)
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Clean up resources'
|
|
condition: always()
|
|
inputs:
|
|
targetType: filePath
|
|
filePath: ./images.CI/cleanup.ps1
|
|
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
|
-ClientId $(CLIENT_ID) `
|
|
-ClientSecret $(CLIENT_SECRET) `
|
|
-Image ${{ parameters.image_type }} `
|
|
-SubscriptionId $(AZURE_SUBSCRIPTION) `
|
|
-TenantId $(AZURE_TENANT) |