generated from bcgov/vue3-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfoundry.okd.on-push.application.yml
More file actions
201 lines (179 loc) · 7.1 KB
/
foundry.okd.on-push.application.yml
File metadata and controls
201 lines (179 loc) · 7.1 KB
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
name: "Foundry OKD: Update App/Airflow Images & Deploy Helm Release"
on:
push:
branches:
- dev
paths:
- client/**
- backend/**
- airflow/**
- migrations/**
- charts/okd/**
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
bump_version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version_bump.outputs.newTag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
id: version_bump
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: client
build_push_nginx:
runs-on: ubuntu-latest
needs: bump_version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Azure Login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_REGISTRY }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Frontend Image
uses: docker/build-push-action@v5
with:
context: ./client
file: ./client/Dockerfile_OKD
build-args: CLIENT_URL=https://bcwatertool.fspatial
push: true
tags: ${{ secrets.ACR_REGISTRY }}/bcwat/nginx:latest, ${{ secrets.ACR_REGISTRY }}/bcwat/nginx:${{ needs.bump_version.outputs.version }}
build_push_flyway:
runs-on: ubuntu-latest
needs: bump_version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Azure Login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_REGISTRY }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Flyway Migrations Image
uses: docker/build-push-action@v5
with:
context: ./migrations
push: true
tags: ${{ secrets.ACR_REGISTRY }}/bcwat/flyway:latest, ${{ secrets.ACR_REGISTRY }}/bcwat/flyway:${{ needs.bump_version.outputs.version }}
build_push_api:
runs-on: ubuntu-latest
needs: bump_version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Azure Login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_REGISTRY }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push API Image
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ${{ secrets.ACR_REGISTRY }}/bcwat/api:latest, ${{ secrets.ACR_REGISTRY }}/bcwat/api:${{ needs.bump_version.outputs.version }}
build_push_airflow:
runs-on: ubuntu-latest
needs: bump_version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Azure Login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_REGISTRY }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Airflow Image
uses: docker/build-push-action@v5
with:
context: ./airflow
file: ./airflow/Dockerfile_OKD
push: true
tags: ${{ secrets.ACR_REGISTRY }}/bcwat/airflow:latest, ${{ secrets.ACR_REGISTRY }}/bcwat/airflow:${{ needs.bump_version.outputs.version }}
upgrade_helm_releases:
runs-on: ubuntu-latest
needs:
- bump_version
- build_push_nginx
- build_push_api
- build_push_flyway
- build_push_airflow
steps:
# Connect to OnPrem WG
- name: Checkout
uses: actions/checkout@v4
# Connect to OnPrem WG
- name: Set up WireGuard Connection
uses: niklaskeerl/easy-wireguard-action@v2
with:
WG_CONFIG_FILE: ${{ secrets.FOUNDRY_ONPREM_WG_CONF }}
# Install OC CLI - Despite OC Login Action specifying OC is installed
# for Ubuntu Runners, this fails without the install:
# --------------------------------
# Run redhat-actions/oc-login@v1
# Authenticating using token
# Error: Error: Unable to locate executable file: oc. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
# -------------
- name: Install oc CLI
run: |
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz oc
sudo mv oc /usr/local/bin
- name: Install Helm CLI
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# This is for onPrem only
# BC Gov Actions will use the OC Runner Action:
# bcgov/action-oc-runner@5882b707c20135424f62202f80d56c1d243fd96c
- name: Authenticate to OKD and set context
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OKD_SERVER }}
openshift_token: ${{ secrets.FOUNDRY_OKD_TOKEN }}
insecure_skip_tls_verify: true
namespace: bcwat
- name: Helm Upgrade Application
working-directory: ./charts/okd/app
run: |
helm upgrade --install bcwat . \
--namespace bcwat \
--atomic \
-f values.yaml \
--set backend.image=${{ secrets.ACR_REGISTRY }}/bcwat/api:${{ needs.bump_version.outputs.version }} \
--set frontend.image=${{ secrets.ACR_REGISTRY }}/bcwat/nginx:${{ needs.bump_version.outputs.version }} \
--timeout 15m
- name: Helm Apache Airflow Install
run: |
helm repo add apache-airflow https://airflow.apache.org
- name: Helm Upgrade Airflow
working-directory: ./charts/okd/airflow
run: |
helm upgrade --install airflow apache-airflow/airflow \
--namespace bcwat \
--version 1.16.0 \
--atomic \
-f values.yaml \
--set images.airflow.tag=latest \
--set-string secrets.bcwatFlowworks.password="${{ secrets.FOUNDRY_BCWAT_FLOWWORKS_PASSWORD }}" \
--set-string secrets.bcwatFlowworks.username="${{ secrets.FOUNDRY_BCWAT_FLOWWORKS_USERNAME }}" \
--set-string secrets.fernet.key="${{ secrets.FOUNDRY_AIRFLOW_FERNET_KEY }}" \
--set-string secrets.api.secretKey="${{ secrets.FOUNDRY_AIRFLOW_API_SECRET_KEY_}}" \
--set-string secrets.api.jwtKey="${{ secrets.FOUNDRY_AIRFLOW_API_JWT_KEY_}}" \
--set-string secrets.sendgridApiKey="${{ secrets.FOUNDRY_SENDGRID_API_KEY }}" \
--set migrations.image=${{ secrets.ACR_REGISTRY }}/bcwat/flyway:${{ needs.bump_version.outputs.version }} \
--set-string webserver.podAnnotations."rollout-timestamp"="$(date +%s)" \
--set-string scheduler.podAnnotations."rollout-timestamp"="$(date +%s)" \
--set-string triggerer.podAnnotations."rollout-timestamp"="$(date +%s)" \
--timeout 15m