forked from Azure/sap-automation
-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (83 loc) · 3.72 KB
/
02-deploy-sap-workload-zone.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
# /*---------------------------------------------------------------------------8
# | |
# | This workflows deploys the SAP Workload Zone with GitHub Actions |
# | |
# +------------------------------------4--------------------------------------*/
name: Deploy SAP Workload Zone
run-name: Deploy SAP Workload Zone by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
deployer:
description: "Deployer configuration name, use the following syntax: ENV-LOCA-VNET-INFRASTRUCTURE"
required: true
type: environment
workload_zone:
description: "Workload zone configuration name, use the following syntax: ENV-LOCA-VNET-INFRASTRUCTURE"
required: true
type: string
default: "DEV-WEEU-SAP01-INFRASTRUCTURE"
workload_environment:
description: "Workload environment (DEV, QA, PRD, ...)"
required: true
type: string
default: DEV
inherit_settings:
description: "Inherit Terraform state file information from control plane"
type: boolean
default: true
test:
description: "Test the deployment without actually deploying the resources"
type: boolean
default: false
permissions:
contents: write
id-token: write
issues: write
jobs:
deploy_sap_workload_zone:
name: Deploy SAP Workload Zone
environment: ${{ inputs.deployer }}
runs-on: self-hosted
container:
image: ghcr.io/xpiritbv/azure-sap-automation:github-workflow
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get app token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v3
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
organization: ${{ github.repository_owner }}
- name: Azure Login
uses: Azure/Login@v2
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
- name: Deploy SAP Workload Zone
run: |
cd ${SAP_AUTOMATION_REPO_PATH}
deploy/automation/02-deploy-sap-workload-zone/01-deploy-sap-workload-zone.sh
env:
APP_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
CP_ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
CP_ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
CP_ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
CP_ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
#CP_ARM_OBJECT_ID: ${{ secrets.AZURE_OBJECT_ID }}
WL_ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
WL_ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
WL_ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
WL_ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
#WL_ARM_OBJECT_ID: ${{ secrets.AZURE_OBJECT_ID }}
SAP_AUTOMATION_REPO_PATH: ${{ github.workspace }} # TODO: Remove this line when using the scripts from the container
TEST_ONLY: ${{ inputs.test }}
deployerconfig: ${{ inputs.deployer }}.tfvars
deployerfolder: ${{ inputs.deployer }}
inherit: ${{ inputs.inherit_settings }}
workload_environment: ${{ inputs.workload_environment }}
workload_zone_folder: ${{ inputs.workload_zone }}
workload_zone_configuration_file: ${{ inputs.workload_zone }}.tfvars