-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (78 loc) · 3.14 KB
/
openshift-create-update-db.yml
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
name: Openshift DB deploy/update
run-name: Deploy PostgresCluster to ${{ inputs.ENVIRONMENT_NAME}}
on:
workflow_dispatch:
inputs:
ENVIRONMENT_NAME:
required: true
type: choice
options:
- dev
- qa
- dlvr
- test
- prod
- tools
NAMESPACE:
required: true
type: choice
options:
- a12541-dev
- a12541-test
- a12541-prod
- a12541-tools
jobs:
build:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.ENVIRONMENT_NAME }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: copy crunchydb files
run: mkdir staging && cp -r crunchy-postgres/charts/crunchy-postgres staging/crunchy-postgres
- name: Fill properties files
uses: cschleiden/[email protected]
with:
files: staging/**/*
env:
LICENSE_PLATE: 'a12541'
#Vault path is different for prod than all other environments
VAULT_RESOURCE: ${{ inputs.NAMESPACE == 'a12541-prod' && 'prod' || 'nonprod' }}
ENV: ${{ inputs.ENVIRONMENT_NAME }}
DB_STORAGE: ${{ vars.DB_STORAGE }}
DB_MAX_CPU: ${{ vars.DB_MAX_CPU }}
DB_MAX_MEMORY: ${{ vars.DB_MAX_MEMORY}}
DB_REPLICAS: ${{ vars.DB_INSTANCE_HA_REPLICAS }}
DB_BACKUP_VOLUME_SIZE: ${{ vars.DB_BACKUP_VOLUME_SIZE }}
BOUNCER_REPLICAS: ${{ vars.DB_LOADBALANCER_HA_REPLICAS}}
S3_ENVIRONMENT: ${{ fromJson('{ dev: "dev", qa: "dev", dlvr: "test", test: "test", prod: "prod" }')[inputs.ENVIRONMENT_NAME] }}
# DEV was created before decision to have multiple environments in single namespace was made.
# As such, the DB name is different from later environments - will need to eventually
# delete and recreate object. For now, this updates it to match what's expected
- name: Perform fix for dev environment
if: ${{ inputs.ENVIRONMENT_NAME == 'dev' }}
run: |
sed -i 's/ name: {{ template "crunchy-postgres.fullname" . }}/ name: crunchy-postgres/' crunchy-postgres/charts/crunchy-postgres/templates/PostgresCluster.yaml
cat crunchy-postgres/charts/crunchy-postgres/templates/PostgresCluster.yaml
- name: install helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
#Explicit install of oc cli tool
- name: Install oc
uses: redhat-actions/oc-installer@v1
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{secrets.openshift_server_url}}
openshift_token: ${{secrets.openshift_token}}
namespace: ${{ inputs.NAMESPACE }}
- name: zip and install helm chart
run: |
cd staging && tar -czvf crunchy-postgres.tar.gz crunchy-postgres
helm upgrade -i crunchy-postgres-${{inputs.ENVIRONMENT_NAME}} ./crunchy-postgres.tar.gz