forked from YannickRe/azuredevops-buildagents
-
Notifications
You must be signed in to change notification settings - Fork 0
/
managedimage-cleanup-template.yml
46 lines (44 loc) · 1.37 KB
/
managedimage-cleanup-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
parameters:
- name: variable_group
displayName: Variable Group
type: string
default: BuildAgents
- name: agent_pool
displayName: Agent Pool
type: string
default: CI Windows2019
- name: delete_type
displayName: 'Delete vmss (VM Scale Set) or galleryvm (Gallery VM) image?'
type: string
default: galleryvm
values:
- galleryvm
- vmss
- name: gallery_images_to_keep
displayName: Number of image versions to keep in gallery
type: number
default: 3
- name: repository_base_path
displayName: Scripts Path
type: string
default: .
stages:
- stage: delete_gallery_imagevm
displayName: 'Delete Gallery Image Version VM'
condition: eq('${{ parameters.delete_type }}', 'galleryvm')
jobs:
- template: managedimage-cleanup-galleryvm.yml
parameters:
variable_group: ${{ parameters.variable_group }}
agent_pool: ${{ parameters.agent_pool }}
repository_base_path: ${{ parameters.repository_base_path }}
gallery_images_to_keep: ${{ parameters.gallery_images_to_keep }}
- stage: delete_vmss_imagevm
displayName: 'Delete orphaned Managed Images'
condition: eq('${{ parameters.delete_type }}', 'vmss')
jobs:
- template: managedimage-cleanup-managedvm.yml
parameters:
variable_group: ${{ parameters.variable_group }}
agent_pool: ${{ parameters.agent_pool }}
repository_base_path: ${{ parameters.repository_base_path }}