-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.sds.pr-close.yml
94 lines (82 loc) · 2.98 KB
/
azure-pipelines.sds.pr-close.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: $(Date:yyyyMMddHHmm)-$(Rev:r)
resources:
repositories:
- repository: azTemplates
type: github
name: hmcts/azure-devops-templates
ref: master
endpoint: hmcts
pr: none
trigger: none
pool:
vmImage: ubuntu-22.04
variables:
- group: vh-github-app-credentials
parameters:
- name: prNumber
displayName: Pull Request Number
type: string
stages:
- stage: uninstall_dev
displayName: Uninstall Dev Helm and DNS
dependsOn: []
variables:
- template: variables/dev.yaml
- template: variables/shared.yaml
parameters:
env: ${{ variables.env }}
prNumber: ${{ parameters.prNumber }}
- name: dnsRecordName
value: ${{ variables.git_repo_name }}-${{ variables.prTagPrefix }}
jobs:
- job: helm_uninstall
displayName: Uninstall Helm from Dev
steps:
- template: templates\Azure\Aks\get-active-cluster.yaml@azTemplates
parameters:
subscriptionName: "${{ variables.subscriptionName }}"
environment: ${{ variables.env }}
- bash: |
echo "$(appName)"
- template: templates/Containerisation/helm/helm-uninstall.yaml@azTemplates
parameters:
namespace: 'vh'
releaseName: "${{ variables.chartName }}-${{ variables.prTagPrefix }}"
azureSubscription: "${{ variables.subscriptionName }}"
aksResourceGroupName: "$(aksCluster.resourceGroup)"
aksClusterName: "$(aksCluster.name)"
- job: dns_uninstall
displayName: Uninstall DNS from Dev
steps:
- template: templates\Azure\Dns\private-dns-remove.yaml@azTemplates
parameters:
subscriptionName: "${{ variables.subscriptionName }}"
dnsSubscriptionName: "${{ variables.dnsZoneSubscription }}"
dnsResourceGroupName: "${{ variables.dnsZoneResourceGroup }}"
zoneName: ${{ variables.dnsZone }}
recordName: ${{ variables.dnsRecordName }}
- stage: delete_packages
displayName: Delete PR Packages
dependsOn: []
variables:
- template: variables/shared.yaml
parameters:
env: ${{ variables.env }}
prNumber: ${{ parameters.prNumber }}
jobs:
- job: delete_packages
displayName: Delete Nuget Packages
steps:
- powershell: |
$prNumber=[int]"${{ parameters.prNumber }}"
Write-Host "PR Number $prNumber"
$prFilter='pr-{0:d4}' -f $prNumber
Write-Host "Filter $prFilter"
Write-Host "##vso[task.setvariable variable=prFilter;isOutput=true]$prFilter"
displayName: "Get PR Filter"
name: filter
- template: templates\dotnet\delete-nuget-package-versions-by-filter.yml@azTemplates
parameters:
feedName: ${{ variables.nuget_feed_name }}
packageName: ${{ variables.nuget_package_name }}
versionFilter: $(filter.prFilter)