This is Azure pipeline test created for sap-hana/deploy
- allNew-SN: create all resources from scratch for single node
- allNew-HA: create all resources from scratch for HA pair
- reuseRG-SN: use existing resource group (generated inside the job) for single node
- reuseVNET-SN: use existing vnet (management generated from allNew) for single node
- reuseNSG-SN: use existing NSG (nsg geneareted from allNew) for single node
- All PRs against master and include code change in sap-hana/deploy will trigger this pipeline test.
- Each scenario will create a testcase with name that contains name of the testcase, os version and buildId, eg. sap-allNew-SN-SLES12-289.
- Each testcase will create resources under it's own resource group, which has the same name as the testcase, eg. resource group sap-allNew-SN-SLES12-289.
- Terraform will run with varible file generated during the test, which has name as the testcase as well, eg. sap-allNew-SN-SLES12-289.json
- After the deployment is done (successful/fail), cleanup job will delete the resource group
- create a custom json under
templates/tempGen/<scenario>.json
- the json need to include key(s) that will be customized for this scenario
- for values that requires to be replaced, please put a different placeholder for each one:
- for name of resource group, replace with
var-rg-name
- for arm id of the reuse reousrce, replace with
<reuse resource name>-arm-id
- sample:
{ "infrastructure" : { "resource_group" : { "is_existing" : "true", "name" : "var-rg-name", "arm_id" : "rg-arm-id" } } }
- for name of resource group, replace with
- create a new job under
jobs
- define the scenario by setting variable
scenario
- in
script
section, add necessary step(s) to retrieve the value(s) for placeholder(s) (eg. using az cli) - use
templates/test-case-template-update.yaml
as many times as needed to replace the above values intotemplates/tempGen/<scenario>.json
- sample:
- job: reuseRG${{parameters.osVersion}} variables: scenario: sap-reuseRG testcase: $(scenario)-${{parameters.osVersion}}-$(Build.BuildId) steps: - script: | az login --service-principal --user $(hana-pipeline-spn-id) --password $(hana-pipeline-spn-pw) --tenant $(landscape-tenant) --output none az group create --location eastus -n $(testcase) echo '##vso[task.setvariable variable=arm_id]$(az group show --name $(testcase) --query id --output tsv)' - template: test-case-template-update.yaml parameters: scenario: $(scenario) testCaseName: $(testcase) placeHolder: var-rg-name value: $(testcase) - template: test-case-template-update.yaml parameters: scenario: $(scenario) testCaseName: $(testcase) placeHolder: rg-arm-id value: $(arm_id) - template: terraform-deployment-steps.yaml parameters: testCaseName: $(testcase) osImage: ${{parameters.osImage}} - template: ansible-deployment-steps.yaml parameters: testCaseName: $(testcase)
- add the new scenario to
stage: DestroyingResources
->job: cleanUp
-> variblescenario_list
.
- create a new job with template under
jobs
withosVersion
and string forosImage
- sample:
- template: templates/job-template-per-os.yaml parameters: osVersion: "SLES12" osImage: '\"offer\": \"sles-sap-12-sp5\", \"publisher\": \"SUSE\", \"sku\": \"gen1\"'
- add the new OS into os_list under
stage: DestroyingResources
->job: cleanUp
-> varibleos_list
.