-
Notifications
You must be signed in to change notification settings - Fork 4
213 lines (195 loc) · 9.49 KB
/
solutions-dpg-qa.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: Pucar-Install Workflow Solutins-dpg-qa
on:
workflow_dispatch:
repository_dispatch:
permissions:
id-token: write
contents: write
jobs:
check-changed-files:
runs-on: ubuntu-latest
outputs:
deploy-as-code-changed: ${{ steps.check_files.outputs.deploy-as-code-changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check for changes in deploy-as-code
id: check_files
uses: tj-actions/changed-files@v42
with:
files: |
deploy-as-code/**
# Terraform_Infra_Creation:
# needs: check-changed-files
# runs-on: ubuntu-latest
# env:
# TF_IN_AUTOMATION: "true"
# ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
# ARM_CLIENT_ID: ${{ secrets.AZURE_SOLUTIONS_CLIENT_ID }}
# ARM_CLIENT_SECRET: ${{ secrets.AZURE_SOLUTIONS_CLIENT_SECRET }}
# db_password: ${{ secrets.TF_VAR_db_password }}
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v2
#
# - name: Azure login
# uses: azure/login@v2
# with:
# creds: ${{ secrets.SOLUTIONS_AZURE_CREDENTIALS }}
#
# - name: Terraform init - Infra creation
# id: init-Infra
# run: |
# terraform --version
# terraform init -backend-config="resource_group_name=pucar-solutions-dev" -backend-config="storage_account_name=tfstate771y4" -backend-config="container_name=pucar-solutions-dev-tfstate" -backend-config="key=infra.tfstate" -reconfigure
# working-directory: infra-as-code/terraform/azure-pucar
#
# - name: Terraform Validate - Infra creation
# id: validate-Infra
# run: terraform validate -no-color
# working-directory: infra-as-code/terraform/azure-pucar
#
# - name: Terraform Plan - Infra creation
# id: plan-Infra
# run: terraform plan -no-color -input=false -var-file="tfvars/pucar-solutions/dev.tfvars" -var "db_password=${{ secrets.TF_VAR_db_password }}" -var "ARM_SUBSCRIPTION_ID=${{ env.ARM_SUBSCRIPTION_ID }}" -var "ARM_TENANT_ID=${{ env.ARM_TENANT_ID }}" -var "ARM_CLIENT_ID=${{ env.ARM_CLIENT_ID }}" -var "ARM_CLIENT_SECRET=${{ env.ARM_CLIENT_SECRET }}"
# working-directory: infra-as-code/terraform/azure-pucar
#
# - name: Terraform Apply - Infra creation
# id: apply-Infra
# run: terraform destroy -auto-approve -var-file="tfvars/pucar-solutions/dev.tfvars" -var "db_password=${{ secrets.TF_VAR_db_password }}" -var "ARM_SUBSCRIPTION_ID=${{ env.ARM_SUBSCRIPTION_ID }}" -var "ARM_TENANT_ID=${{ env.ARM_TENANT_ID }}" -var "ARM_CLIENT_ID=${{ env.ARM_CLIENT_ID }}" -var "ARM_CLIENT_SECRET=${{ env.ARM_CLIENT_SECRET }}"
# working-directory: infra-as-code/terraform/azure-pucar
# - name: Generate kubeconfig
# run: |
# az aks get-credentials --resource-group "pucar-solutions-dev" --name "solutions-dev"
# cat ~/.kube/config > kubeconfig
# - name: Kubectl setup
# uses: azure/setup-kubectl@v3
# with:
# version: 'latest'
# id: install
#
# - name: Verify kubectl configuration
# run: kubectl config view
# - name: Verify kubectl get nodes
# run: |
# kubectl get nodes
DIGIT-deployment:
# if: ${{ github.event_name == 'push' }}
# needs: Terraform_Infra_Creation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Generate kubeconfig
run: |
az aks get-credentials --resource-group "pucar-qa" --name "qa"
cat ~/.kube/config > kubeconfig
- name: Kubectl setup
uses: azure/setup-kubectl@v3
with:
version: 'latest'
id: install
- name: Creating namespace
run: kubectl create namespace egov
continue-on-error: true
- name: Verify kubectl get nodes
run: |
kubectl get nodes
- name: Install sops
run: |
sudo apt update
sudo apt install -y age
mkdir -p $HOME/.config/sops/age/
echo # public key: ${{ secrets.PUBLIC_AGE_KEY }} > $HOME/.config/sops/age/keys.txt
echo ${{ secrets.PRIVATE_AGE_KEY }} >> $HOME/.config/sops/age/keys.txt
wget https://github.com/mozilla/sops/releases/download/v3.7.1/sops-v3.7.1.linux
chmod +x sops-v3.7.1.linux
sudo mv sops-v3.7.1.linux /usr/local/bin/sops
- name: sops decryption
run: |
sudo sops --decrypt --age ${{ secrets.PUBLIC_AGE_KEY }} $HOME/work/pucar-DevOps/pucar-DevOps/deploy-as-code/charts/environments/solutions-dev-to-qa-secrets.yaml > env-secrets1.yaml
cp env-secrets1.yaml $HOME/work/pucar-DevOps/pucar-DevOps/deploy-as-code/charts/environments/solutions-dev-to-qa-secrets.yaml
# working-directory: deploy-as-code/charts/environments
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: 'latest' # Specify the version of Helm
- name: Install Helmfile
uses: helmfile/[email protected]
with:
helmfile-version: 'v0.150.0'
helm-plugins: >
https://github.com/databus23/helm-diff
- name: Parse YAML and export as environment variables
id: set-env
run: |
services=$(yq e '.modules[] | select(.name == "egov") | .services' deploy-as-code/charts/release-chart/dependancy_chart-pucar-v0.3.yaml)
# Iterate over each service and export as environment variables
echo "$services" | while IFS=":" read -r key value; do
# Clean up key and value
key=$(echo $key | xargs)
value=$(echo $value | xargs)
# Export as environment variable
echo "${key}=${value}" >> $GITHUB_ENV
done
- name: digit deployment
run: |
helmfile -l deployment=pucar -f digit-helmfile.yaml apply --include-needs=true \
--set scheduler.image.tag=${{ env.scheduler }} \
--set scheduler.initContainers.dbMigration.image.tag=${{ env.scheduler }} \
--set payment-calculator.image.tag=${{ env.payment-calculator }} \
--set payment-calculator.initContainers.dbMigration.image.tag=${{ env.payment-calculator }} \
--set digit-ui.image.tag=${{ env.digit-ui }} \
--set dristi-case-pdf.image.tag=${{ env.dristi-case-pdf }} \
--set dristi-pdf.image.tag=${{ env.dristi-pdf }} \
--set advocate.image.tag=${{ env.advocate }} \
--set advocate.initContainers.dbMigration.image.tag=${{ env.advocate }} \
--set case.image.tag=${{ env.case }} \
--set case.initContainers.dbMigration.image.tag=${{ env.case }} \
--set casemanagement.image.tag=${{ env.casemanagement }} \
--set casemanagement.initContainers.dbMigration.image.tag=${{ env.casemanagement }} \
--set evidence.image.tag=${{ env.evidence }} \
--set evidence.initContainers.dbMigration.image.tag=${{ env.evidence }} \
--set hearing.image.tag=${{ env.hearing }} \
--set hearing.initContainers.dbMigration.image.tag=${{ env.hearing }} \
--set order.image.tag=${{ env.order }} \
--set order.initContainers.dbMigration.image.tag=${{ env.order }} \
--set task.image.tag=${{ env.task }} \
--set task.initContainers.dbMigration.image.tag=${{ env.task }} \
--set billing-service.image.tag=${{ env.billing-service }} \
--set billing-service.initContainers.dbMigration.image.tag=${{ env.billing-service }} \
--set collection-services.image.tag=${{ env.collection-services }} \
--set collection-services.initContainers.dbMigration.image.tag=${{ env.collection-services }} \
--set individual.image.tag=${{ env.individual }} \
--set individual.initContainers.dbMigration.image.tag=${{ env.individual }} \
--set inbox.image.tag=${{ env.inbox }} \
--set e-sign-svc.image.tag=${{ env.e-sign-svc }} \
--set esign-interceptor.image.tag=${{ env.esign-interceptor }} \
--set application.image.tag=${{ env.application }} \
--set application.initContainers.dbMigration.image.tag=${{ env.application }} \
--set analytics.image.tag=${{ env.analytics }} \
--set epayments.image.tag=${{ env.epayments }} \
--set etreasury.image.tag=${{ env.etreasury }} \
--set etreasury.initContainers.dbMigration.image.tag=${{ env.etreasury }} \
--set sbi-webpage.image.tag=${{ env.sbi-webpage }} \
--set sbi-svc.image.tag=${{ env.sbi-svc }} \
--set sbi-svc.initContainers.dbMigration.image.tag=${{ env.sbi-svc }} \
--set epost-tracker.image.tag=${{ env.epost-tracker }} \
--set epost-tracker.initContainers.dbMigration.image.tag=${{ env.epost-tracker }} \
--set summons-svc.image.tag=${{ env.summons-svc }} \
--set summons-svc.initContainers.dbMigration.image.tag=${{ env.summons-svc }} \
--set transformer.image.tag=${{ env.transformer }} \
--set icops-integration.image.tag=${{ env.icops-integration }} \
--set icops-integration.initContainers.dbMigration.image.tag=${{ env.icops-integration }}
working-directory: deploy-as-code
env:
HELMFILE_ENV: "solutions-dev-to-qa"