forked from persiaAziz-zz/sap-hana-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-daily.yaml
121 lines (120 loc) · 4.47 KB
/
azure-pipelines-daily.yaml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# This Azure pipeline YAML contains tests the daily full test on the master branch
# It includes:
# - Terraform deployments:
# + single HANA server
# + RTI
# + 1 Linux jumpbox
# + 1 Windows jumpbox
# - Ansible playbook execution:
# + SAP Bits download
# + HANA installation including XSA and SHINE
# + HANA Client/Studio installation on Linux/Windows jumpboxes
# A pipeline with no CI trigger
trigger: none
# A pipeline with no PR triggers
pr: none
schedules:
- cron: '0 12 * * *'
displayName: Daily full test at noon (UTC)
branches:
include:
- master
always: true
variables:
- group: azure-config-variables
- group: azure-sap-hana-pipeline-secrets
stages:
- stage: SetEnv
jobs:
- job: prepareAgent
pool:
vmImage: "ubuntu-18.04"
steps:
- checkout: self
clean: "all"
path: "sap-hana"
persistCredentials: true
- script: |
pip install packaging
sudo -H pip install msrest==0.6.0
displayName: 'Install python tools'
###############################################################################
# This stage creates resources for below test cases: #
# - Below testcases are tested only with SLES12 SP5 #
# - createAllNew-HA: it creates all resources from scratch in HA Scenario #
# - createAllNew-SN: it creates all resources from scratch for single node #
# - reuseRG-SN: it only reuses an existing resource group for single node #
# - reuseVnet-SN: it only reuses an existing vnet from createAllNew-SN #
# - reuseNSG-SN: it only reuses an existing NSG from createAllNew-SN #
# - createAllNew-SN testcase will be tested again with below OS #
# - RHEL7.6 #
###############################################################################
- stage: CreatingResources
dependsOn: SetEnv
jobs:
- template: templates/job-template-per-os-daily.yaml
parameters:
osVersion: "SLES12"
osImage: '\"offer\": \"sles-sap-12-sp5\",
\"publisher\": \"SUSE\",
\"sku\": \"gen1\"'
- template: templates/job-template-per-os-daily.yaml
parameters:
osVersion: "RHEL7"
osImage: '\"offer\": \"RHEL-SAP-HA\",
\"publisher\": \"RedHat\",
\"sku\": \"7.6\"'
#####################################################################
# This stage destroy resources created from all above test cases. #
# It will be triggered after stage CreatingResources is finished. #
# It will always be triggered, regardless the status of stage one - #
# success of fail #
# Tag "Delete=True" will be added to mark all resource groups for #
# scheduled deletion done by azure-pipelines-cleanup.yaml #
#####################################################################
- stage: DestroyingResources
dependsOn: CreatingResources
condition: or(succeededOrFailed(), always())
jobs:
- job: cleanUp
steps:
- script: |
az login --service-principal --user $(hana-pipeline-spn-id) --password $(hana-pipeline-spn-pw) --tenant $(landscape-tenant) --output none
os_list=(
SLES12
RHEL7
)
scenario_list=(
sap-allNew-SN
sap-allNew-HA
sap-reuseRG-SN
sap-reuseVNET-SN
sap-reuseNSG-SN
)
for scenario in "${scenario_list[@]}"
do
for os in "${os_list[@]}"
do
rg_list+=("${scenario}-${os}-$(Build.BuildId)")
done
done
for rg in "${rg_list[@]}"
do
echo $rg
if $(az group exists -n $rg); then
az group update --resource-group $rg --set tags.Delete=True
az group delete -n $rg --no-wait -y
fi
done
displayName: 'Clean up'
env:
TF_VAR_azure_service_principal_id: $(hana-pipeline-spn-id)
TF_VAR_azure_service_principal_pw: $(hana-pipeline-spn-pw)
AZURE_CLIENT_ID: $(hana-pipeline-spn-id)
AZURE_SECRET: $(hana-pipeline-spn-pw)
AZURE_TENANT: $(landscape-tenant)
AZURE_SUBSCRIPTION_ID: $(landscape-subscription)
ARM_CLIENT_ID: $(hana-pipeline-spn-id)
ARM_CLIENT_SECRET: $(hana-pipeline-spn-pw)
ARM_TENANT_ID: $(landscape-tenant)
ARM_SUBSCRIPTION_ID: $(landscape-subscription)