forked from hmcts/azure-devops-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.remove-pod.yml
88 lines (80 loc) · 2.84 KB
/
azure-pipelines.remove-pod.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
parameters:
- name: env
type: string
default: dev
values:
- dev
- demo
- test
- ithc
- stg
- name: cluster
type: string
values:
- 00
- 01
- name: project
type: string
- name: app_name
type: string
- name: pod_suffix
type: string
default: pr-396
- name: connectionName
type: string
default: "DTS-SHAREDSERVICES-DEV-Video Hearings"
variables:
- template: ../variables/sds-aks-shared.yaml
parameters:
env: ${{ parameters.env }}
app_name: ${{ parameters.app_name }}
cluster: ${{ parameters.cluster }}
project: ${{ parameters.project }}
- name: dnsRecordName
value: ${{ parameters.app_name }}-${{ parameters.pod_suffix }}
stages:
- stage: uninstall_pod
displayName: Uninstall from aks-${{ parameters.cluster }}-${{ parameters.env }}
jobs:
- job: podCheck
steps:
- task: Kubernetes@1
name: podCheck
displayName: Check pod ${{ parameters.project }}-${{ parameters.app_name }}-${{ parameters.pod_suffix }} exists
continueOnError: true
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: ${{ parameters.connectionName }}
azureResourceGroup: "${{ variables.clusterResourceGroup }}"
kubernetesCluster: "${{ variables.clusterName }}"
useClusterAdmin: true
command: get
arguments: pod ${{ parameters.project }}-${{ parameters.app_name }}-${{ parameters.pod_suffix }} -n ${{ parameters.project }}
- job:
dependsOn: podCheck
condition: eq(dependencies.podCheck.result,'Succeeded')
steps:
- template: ../templates/Containerisation/helm/helm-remove.yaml
parameters:
azureSubscription: ${{ parameters.connectionName }}
kubernetesRG: "${{ variables.clusterResourceGroup }}"
kubernetesCluster: "${{ variables.clusterName }}"
chartPath: '${{ variables.chartPath }}'
namespace: '${{ parameters.project }}'
chartName: '${{ parameters.project }}-${{ parameters.app_name }}'
imageTag: '${{ parameters.pod_suffix }}'
environment: ${{ parameters.env }}
#additionalArgs: "-o json"
- stage: remove_dns
displayName: remove ${{ variables.dnsRecordName }} from ${{ variables.dnsZone }}
condition: always()
jobs:
- job:
steps:
- template: ../templates/Azure/Dns/private-dns-remove.yaml
parameters:
subscriptionName: ${{ parameters.connectionName }}
dnsSubscriptionName: ${{ variables.dnsZoneSubscription }}
dnsResourceGroupName: ${{ variables.dnsZoneResourceGroup }}
zoneName: ${{ variables.dnsZone }}
recordName: ${{ variables.dnsRecordName }}