Skip to content

Commit f9f4487

Browse files
committed
testing
1 parent 98ad966 commit f9f4487

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1468
-1754
lines changed

.github/workflows/deploy-dependencies.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ on:
99
default: "dev"
1010
type: choice
1111
options:
12-
- demo
13-
- dev
14-
- dev-stg
12+
- ""
1513
jobs:
1614
github-to-k8s-sync-env:
1715
uses: ./.github/workflows/github-to-k8s-sync-env.yml

.github/workflows/deploy-mosip.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy MOSIP
2+
run-name: "Deploy MOSIP on ${{ inputs.environment }}"
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
type: string
8+
workflow_dispatch:
9+
inputs:
10+
environment:
11+
description: "Target environment"
12+
required: true
13+
default: "dev"
14+
type: choice
15+
options:
16+
- demo
17+
- dev
18+
- dev-stg
19+
jobs:
20+
github-to-k8s-sync-env:
21+
uses: ./.github/workflows/github-to-k8s-sync-env.yml
22+
with:
23+
environment: ${{ inputs.environment }}
24+
secrets: inherit
25+
deploy:
26+
needs: github-to-k8s-sync-env
27+
environment: ${{ inputs.environment }}
28+
env:
29+
ENV: ${{ inputs.environment }}
30+
BRANCH: ${{ github.ref_name }}
31+
runs-on:
32+
- self-hosted
33+
- k8s
34+
- ${{ inputs.environment }}
35+
steps:
36+
- uses: actions/checkout@v5
37+
- name: Deploy OpenCRVS MOSIP API
38+
if: inputs.deploy_mosip
39+
run: |
40+
helm upgrade --install mosip-api oci://ghcr.io/opencrvs/opencrvs-mosip \
41+
--namespace "opencrvs-${ENV}" \
42+
-f environments/${ENV}/mosip-api/values.yaml \
43+
--set hostname=${{ vars.DOMAIN }} \
44+
--create-namespace \
45+
--atomic
46+
- name: Cleanup Helm Locks
47+
if: failure() || cancelled()
48+
run: |
49+
kubectl -n "opencrvs-${ENV}" get secrets -l owner=helm -o json | \
50+
jq -r '.items[] | select(.metadata.labels.status=="pending-install" or .metadata.labels.status=="pending-upgrade") | .metadata.name' | \
51+
xargs -r kubectl -n "opencrvs-${ENV}" delete secret || \
52+
echo "No helm locks found, all is good"
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Deploy OpenCRVS (with approval)
2+
run-name: "Deploy OpenCRVS on ${{ inputs.environment }} (core: ${{ inputs.core-image-tag }}, country: ${{ inputs.countryconfig-image-tag }})"
3+
on:
4+
workflow_call:
5+
inputs:
6+
core-image-tag:
7+
type: string
8+
countryconfig-image-tag:
9+
type: string
10+
environment:
11+
type: string
12+
workflow_dispatch:
13+
inputs:
14+
core-image-tag:
15+
description: "Tag of the core image"
16+
required: true
17+
default: "v1.9.0-beta-1"
18+
countryconfig-image-tag:
19+
description: "Tag of the countryconfig image"
20+
required: true
21+
default: "v1.9.0-beta-1"
22+
environment:
23+
description: "Target environment"
24+
required: true
25+
default: "dev"
26+
type: choice
27+
options:
28+
- demo1
29+
jobs:
30+
approve:
31+
uses: trstringer/manual-approval@v1
32+
with:
33+
secret: ${{ github.TOKEN }}
34+
approvers: ${{ vars.DEPLOY_APPROVERS }} # comma separated list of GitHub usernames
35+
minimum-approvals: 1
36+
issue-title: 'Deploy (${{ github.event.inputs.environment }}): core: ${{ github.event.inputs.core-image-tag }} country config: ${{ github.event.inputs.countryconfig-image-tag }}'
37+
issue-body: 'Please approve or deny the deployment of core: ${{ github.event.inputs.core-image-tag }} country config: ${{ github.event.inputs.countryconfig-image-tag }} to ${{ github.event.inputs.environment }}'
38+
exclude-workflow-initiator-as-approver: false
39+
github-to-k8s-sync-env:
40+
uses: ./.github/workflows/github-to-k8s-sync-env.yml
41+
with:
42+
environment: ${{ inputs.environment }}
43+
secrets: inherit
44+
deploy:
45+
needs: github-to-k8s-sync-env
46+
environment: ${{ inputs.environment }}
47+
env:
48+
ENV: ${{ inputs.environment }}
49+
BRANCH: ${{ github.ref_name }}
50+
CORE_IMAGE_TAG: ${{ inputs.core-image-tag }}
51+
COUNTRYCONFIG_IMAGE_TAG: ${{ inputs.countryconfig-image-tag }}
52+
COUNTRYCONFIG_IMAGE_NAME: ${{ secrets.DOCKERHUB_ACCOUNT || 'opencrvs' }}/${{ secrets.DOCKERHUB_REPO || 'ocrvs-farajaland'}}
53+
runs-on:
54+
- self-hosted
55+
- k8s
56+
- ${{ inputs.environment }}
57+
steps:
58+
- uses: actions/checkout@v5
59+
- name: Generate summary
60+
env:
61+
PUBLIC_DOMAIN: ${{ vars.DOMAIN }}
62+
run: |
63+
SUMMARY=$(cat <<EOF
64+
### Deployment Summary
65+
66+
| Key | Value |
67+
|-----|-------|
68+
| Environment URL | https://$PUBLIC_DOMAIN |
69+
| Core image tag | \`${{ inputs.core-image-tag }}\` |
70+
| Country config image | \`${{ inputs.countryconfig-image-tag }}\` |
71+
| Branch name | \`${{ github.ref_name }}\` |
72+
EOF
73+
)
74+
echo "$SUMMARY" | sed 's/^ //' >> $GITHUB_STEP_SUMMARY
75+
- name: Create namespace
76+
run: kubectl create namespace "opencrvs-${ENV}" || true
77+
- name: Copy secrets from dependencies into application namespace
78+
# Only redis secret for now needs to be copied
79+
run: |
80+
secrets=(
81+
"redis-opencrvs-users"
82+
)
83+
for secret in "${secrets[@]}"; do
84+
kubectl get secret $secret -n opencrvs-deps-${ENV} -o yaml \
85+
| sed "s#namespace: opencrvs-deps-${ENV}#namespace: opencrvs-${ENV}#" \
86+
| grep -vE 'resourceVersion|uid|creationTimestamp' \
87+
| kubectl apply -n opencrvs-${ENV} -f - \
88+
|| echo "Secret $secret doesn't exist in opencrvs-deps-${ENV} namespace"
89+
done
90+
- name: Deploy with Helm
91+
run: |
92+
helm upgrade --install opencrvs oci://ghcr.io/opencrvs/opencrvs-services \
93+
--timeout 15m \
94+
--namespace "opencrvs-${ENV}" \
95+
-f environments/${ENV}/opencrvs-services/values.yaml \
96+
--create-namespace \
97+
--atomic \
98+
--wait \
99+
--wait-for-jobs \
100+
--set image.tag="$CORE_IMAGE_TAG" \
101+
--set countryconfig.image.tag="$COUNTRYCONFIG_IMAGE_TAG" \
102+
--set countryconfig.image.name="$COUNTRYCONFIG_IMAGE_NAME" \
103+
--set hostname=${{ vars.DOMAIN }}
104+
- name: Cleanup Helm Locks
105+
if: failure() || cancelled()
106+
run: |
107+
kubectl -n "opencrvs-${ENV}" get secrets -l owner=helm -o json | \
108+
jq -r '.items[] | select(.metadata.labels.status=="pending-install" or .metadata.labels.status=="pending-upgrade") | .metadata.name' | \
109+
xargs -r kubectl -n "opencrvs-${ENV}" delete secret || \
110+
echo "No helm locks found, all is good"

.github/workflows/deploy-opencrvs.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111
type: string
1212
reset:
1313
type: boolean
14-
deploy_mosip:
15-
type: boolean
1614
workflow_dispatch:
1715
inputs:
1816
core-image-tag:
@@ -29,19 +27,12 @@ on:
2927
default: "dev"
3028
type: choice
3129
options:
32-
- demo
33-
- dev
34-
- dev-stg
30+
- ""
3531
reset:
3632
description: "Reset environment after deploy"
3733
required: false
3834
default: false
3935
type: boolean
40-
deploy_mosip:
41-
description: "Deploy MOSIP integration"
42-
required: false
43-
default: false
44-
type: boolean
4536
jobs:
4637
github-to-k8s-sync-env:
4738
uses: ./.github/workflows/github-to-k8s-sync-env.yml
@@ -86,15 +77,8 @@ jobs:
8677
EOF
8778
)
8879
echo "$SUMMARY" | sed 's/^ //' >> $GITHUB_STEP_SUMMARY
89-
- name: Deploy OpenCRVS MOSIP API
90-
if: inputs.deploy_mosip
91-
run: |
92-
helm upgrade --install mosip-api oci://ghcr.io/opencrvs/opencrvs-mosip \
93-
--namespace "opencrvs-${ENV}" \
94-
-f environments/${ENV}/mosip-api/values.yaml \
95-
--set hostname=${{ vars.DOMAIN }} \
96-
--create-namespace \
97-
--atomic
80+
- name: Create namespace
81+
run: kubectl create namespace "opencrvs-${ENV}" || true
9882
- name: Copy secrets from dependencies into application namespace
9983
# Only redis secret for now needs to be copied
10084
run: |

.github/workflows/k8s-reindex.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ on:
99
default: "dev"
1010
type: choice
1111
options:
12-
- demo
13-
- dev
14-
- dev-stg
12+
- ""
1513
workflow_call:
1614
inputs:
1715
environment:

.github/workflows/k8s-reset-data.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ on:
1414
default: "dev"
1515
type: choice
1616
options:
17-
- demo
18-
- dev
19-
- dev-stg
17+
- ""
2018
workflow_call:
2119
inputs:
2220
environment:

.github/workflows/k8s-seed-data.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ on:
99
default: "dev"
1010
type: choice
1111
options:
12-
- demo
13-
- dev
14-
- dev-stg
12+
- demo-prod
1513
workflow_call:
1614
inputs:
1715
environment:
@@ -42,16 +40,13 @@ jobs:
4240
' > ${namespace}.json
4341
- name: Seeding data
4442
run: |
45-
kubectl delete job -n opencrvs-${ENV} data-seed || true
46-
kubectl delete pod -n opencrvs-${ENV} -lapp=events;
47-
sleep 30;
48-
kubectl wait --for=condition=ready pod -n opencrvs-${ENV} -lapp=events;
43+
kubectl delete job --wait -n ${namespace} data-seed || true
4944
helm template -f ${namespace}.json \
5045
--set data_seed.enabled=true \
51-
--namespace opencrvs-${ENV} \
46+
--namespace ${namespace} \
5247
-s templates/data-seed-job.yaml \
53-
oci://ghcr.io/opencrvs/opencrvs-services | kubectl apply -n opencrvs-${ENV} -f -
54-
sleep 30;
55-
kubectl logs job/data-seed -f -n opencrvs-${ENV} || true
56-
kubectl wait --for=condition=complete job/data-seed -n opencrvs-${ENV} --timeout=600s;
57-
kubectl delete pod -n opencrvs-${ENV} -lapp=events;
48+
oci://ghcr.io/opencrvs/opencrvs-services | kubectl apply -n ${namespace} --wait --timeout=600s -f -
49+
kubectl get pods -n ${namespace} -lapp=data-seed
50+
kubectl wait --for=condition=Complete job/data-seed -n ${namespace} --timeout=600s; RES=$?
51+
kubectl logs job/data-seed -f -n ${namespace}
52+
exit $RES

.github/workflows/provision.md

Whitespace-only changes.

.github/workflows/provision.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ on:
99
default: 'demo'
1010
type: choice
1111
options:
12-
- dev
13-
- demo
12+
- ""
1413
tags:
1514
description: 'Tags to apply to the provisioned resources'
1615
required: true
@@ -27,8 +26,7 @@ on:
2726
- decrypt-on-boot
2827
- checks
2928
- containerd-setup
30-
- kubernetes-installation
31-
- join-workers
29+
- k8s
3230
- system-preparation
3331
jobs:
3432
provision:
@@ -62,7 +60,6 @@ jobs:
6260
smtp_from: "[email protected]"
6361
smtp_password: ${{ secrets.SMTP_PASSWORD }}
6462
alert_email: ${{ secrets.ALERT_EMAIL }}
65-
6663
- name: checkout repository
6764
uses: actions/checkout@v5
6865
- name: Run Ansible Playbook

.github/workflows/update-envs.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)