Files
runner-images/images.CI/azure-pipelines/image-generation.yml
T

46 lines
1.9 KiB
YAML
Raw Normal View History

2020-02-14 19:09:09 +03:00
jobs:
- job:
pool: ci-agent-pool
2020-02-15 20:52:05 +03:00
timeoutInMinutes: 600
variables:
- group: Image Generation Variables
2020-02-14 19:09:09 +03:00
steps:
2020-02-18 17:19:11 +03:00
- powershell: |
2020-02-18 15:37:23 +03:00
Remove-Item -path './*' -Recurse -Force
2020-02-19 10:58:59 +03:00
Write-Host "Download $(CUSTOM_REPOSITORY_BRANCH) branch from $(CUSTOM_REPOSITORY_URL)"
git clone $(CUSTOM_REPOSITORY_URL) . -b $(CUSTOM_REPOSITORY_BRANCH) --single-branch --depth 1
2020-02-18 15:37:23 +03:00
displayName: 'Download custom repository'
2020-02-19 10:58:59 +03:00
condition: and(ne(variables['CUSTOM_REPOSITORY_BRANCH'], ''), ne(variables['CUSTOM_REPOSITORY_URL'], ''))
2020-02-18 15:37:23 +03:00
- task: PowerShell@2
displayName: 'Build VM'
inputs:
targetType: filePath
filePath: ./images.CI/build-image.ps1
arguments: -ResourcesNamePrefix $(Build.BuildNumber) `
2020-02-14 19:09:09 +03:00
-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) `
2020-02-14 19:09:09 +03:00
-ClientId $(CLIENT_ID) `
-ClientSecret $(CLIENT_SECRET) `
-Image ${{ parameters.image_type }} `
-SubscriptionId $(AZURE_SUBSCRIPTION) `
-TenantId $(AZURE_TENANT)