Skip to content

Commit 300cb18

Browse files
committed
added dev and prod deployment workflows for gh
1 parent 44ba66d commit 300cb18

File tree

5 files changed

+272
-137
lines changed

5 files changed

+272
-137
lines changed

.github/workflows/dataProductDeployment.yml

Lines changed: 0 additions & 137 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Data Product Deployment - Dev
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- "code/**"
8+
- "infra/**"
9+
- ".github/workflows/dataProductDeployment.yml"
10+
- ".github/workflows/validationTemplate.yml"
11+
- ".github/workflows/deploymentTemplate.yml"
12+
pull_request:
13+
branches: [ main ]
14+
paths:
15+
- "code/**"
16+
- "infra/**"
17+
- ".github/workflows/dataProductDeployment.yml"
18+
- ".github/workflows/validationTemplate.yml"
19+
- ".github/workflows/deploymentTemplate.yml"
20+
21+
env:
22+
AZURE_SUBSCRIPTION_ID: "2150d511-458f-43b9-8691-6819ba2e6c7b" # Update to '{dataLandingZoneSubscriptionId}'
23+
AZURE_RESOURCE_GROUP_NAME: "dlz01-dev-di002" # Update to '{dataLandingZoneName}-rg'
24+
AZURE_LOCATION: "northeurope" # Update to '{regionName}'
25+
26+
jobs:
27+
validation_dev:
28+
uses: "${{ github.repository }}/.github/workflows/validationTemplate.yml@${{ github.ref_name }}"
29+
name: "Validation of IaC templates - Dev"
30+
with:
31+
environment: "dev"
32+
azure_subscription_id: ${{ env.AZURE_SUBSCRIPTION_ID }}
33+
azure_resource_group_name: ${{ env.AZURE_RESOURCE_GROUP_NAME }}
34+
azure_location_name: ${{ env.AZURE_LOCATION }}
35+
36+
deployment_dev:
37+
uses: "${{ github.repository }}/.github/workflows/deploymentTemplate.yml@${{ github.ref_name }}"
38+
name: "Deployment of IaC templates - Dev"
39+
needs: [ validation ]
40+
if: github.event_name == 'push'
41+
with:
42+
environment: "dev"
43+
azure_subscription_id: ${{ env.AZURE_SUBSCRIPTION_ID }}
44+
azure_resource_group_name: ${{ env.AZURE_RESOURCE_GROUP_NAME }}
45+
azure_location_name: ${{ env.AZURE_LOCATION }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Data Product Deployment - Test/Prod
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
push:
7+
branches: [ main ]
8+
paths:
9+
- "code/**"
10+
- "infra/**"
11+
- ".github/workflows/dataProductDeployment.yml"
12+
- ".github/workflows/validationTemplate.yml"
13+
- ".github/workflows/deploymentTemplate.yml"
14+
15+
env:
16+
AZURE_SUBSCRIPTION_ID_TEST: "2150d511-458f-43b9-8691-6819ba2e6c7b" # Update to '{dataLandingZoneSubscriptionId}'
17+
AZURE_RESOURCE_GROUP_NAME_TEST: "dlz01-dev-di002" # Update to '{dataLandingZoneName}-rg'
18+
AZURE_SUBSCRIPTION_ID_PROD: "2150d511-458f-43b9-8691-6819ba2e6c7b" # Update to '{dataLandingZoneSubscriptionId}'
19+
AZURE_RESOURCE_GROUP_NAME_PROD: "dlz01-dev-di002" # Update to '{dataLandingZoneName}-rg'
20+
AZURE_LOCATION: "northeurope" # Update to '{regionName}'
21+
22+
jobs:
23+
validation_test:
24+
uses: "${{ github.repository }}/.github/workflows/validationTemplate.yml@${{ github.ref_name }}"
25+
name: "Validation of IaC templates - Test"
26+
with:
27+
environment: "test"
28+
azure_subscription_id: ${{ env.AZURE_SUBSCRIPTION_ID_TEST }}
29+
azure_resource_group_name: ${{ env.AZURE_RESOURCE_GROUP_NAME_TEST }}
30+
azure_location_name: ${{ env.AZURE_LOCATION }}
31+
32+
validation_prod:
33+
uses: "${{ github.repository }}/.github/workflows/validationTemplate.yml@${{ github.ref_name }}"
34+
name: "Validation of IaC templates - Prod"
35+
needs: [ validation_test ]
36+
with:
37+
environment: "prod"
38+
azure_subscription_id: ${{ env.AZURE_SUBSCRIPTION_ID_PROD }}
39+
azure_resource_group_name: ${{ env.AZURE_RESOURCE_GROUP_NAME_PROD }}
40+
azure_location_name: ${{ env.AZURE_LOCATION }}
41+
42+
deployment_test:
43+
uses: "${{ github.repository }}/.github/workflows/deploymentTemplate.yml@${{ github.ref_name }}"
44+
name: "Deployment of IaC templates - Test"
45+
needs: [ validation_prod ]
46+
if: github.event_name == 'release'
47+
with:
48+
environment: "test"
49+
azure_subscription_id: ${{ env.AZURE_SUBSCRIPTION_ID_TEST }}
50+
azure_resource_group_name: ${{ env.AZURE_RESOURCE_GROUP_NAME_TEST }}
51+
azure_location_name: ${{ env.AZURE_LOCATION }}
52+
53+
deployment_prod:
54+
uses: "${{ github.repository }}/.github/workflows/deploymentTemplate.yml@${{ github.ref_name }}"
55+
name: "Deployment of IaC templates - Prod"
56+
needs: [ deployment_test ]
57+
if: github.event_name == 'release'
58+
with:
59+
environment: "prod"
60+
azure_subscription_id: ${{ env.AZURE_SUBSCRIPTION_ID_PROD }}
61+
azure_resource_group_name: ${{ env.AZURE_RESOURCE_GROUP_NAME_PROD }}
62+
azure_location_name: ${{ env.AZURE_LOCATION }}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Deployment Template
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
required: true
8+
type: string
9+
default: "dev"
10+
description: "Specifies the environment of the deployment."
11+
azure_subscription_id:
12+
required: true
13+
type: string
14+
description: "Specifies the subscription id of the deployment."
15+
azure_resource_group_name:
16+
required: true
17+
type: string
18+
description: "Specifies the resource group name of the deployment."
19+
azure_location_name:
20+
required: true
21+
type: string
22+
default: "northeurope"
23+
description: "Specifies the location name of the deployment."
24+
25+
jobs:
26+
deployment:
27+
name: Deployment to ${{ inputs.environment }}
28+
runs-on: ubuntu-latest
29+
continue-on-error: false
30+
if: github.event_name == 'push' || github.event_name == 'release'
31+
environment: ${{ inputs.environment }}
32+
33+
steps:
34+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
35+
- name: Check Out Repository
36+
id: checkout_repository
37+
uses: actions/checkout@v2
38+
39+
# Login to Azure
40+
- name: Azure Login
41+
id: azure_login
42+
uses: azure/login@v1
43+
with:
44+
creds: ${{ secrets.AZURE_CREDENTIALS }}
45+
46+
# Generate Password 001
47+
- name: Generate Password 001
48+
id: generate_password_001
49+
run: |
50+
echo "Generating Password"
51+
pwsh "${GITHUB_WORKSPACE}/code/GeneratePassword.ps1" -GitHub
52+
53+
# Deploy Data Product
54+
- name: Deploy Data Product
55+
id: data_product_deployment
56+
uses: azure/arm-deploy@v1
57+
with:
58+
scope: resourcegroup
59+
subscriptionId: ${{ inputs.azure_subscription_id }}
60+
resourceGroupName: ${{ inputs.azure_resource_group_name }}
61+
region: ${{ inputs.azure_location_name }}
62+
template: ${{ github.workspace }}/infra/main.json
63+
parameters: ${{ github.workspace }}/infra/params.${{ inputs.environment }}.json administratorPassword="${{ steps.generate_password_001.outputs.password }}"
64+
deploymentMode: Incremental
65+
deploymentName: "DataProduct-${{ github.sha }}"
66+
failOnStdErr: false
67+
68+
# Log out from Azure
69+
- name: Log out from Azure
70+
id: azure_logout
71+
uses: azure/cli@v1
72+
with:
73+
azcliversion: "agentazcliversion"
74+
inlineScript: |
75+
az logout

0 commit comments

Comments
 (0)