generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
153 lines (138 loc) · 5.88 KB
/
cd-openshift-test.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
name: Continuous Integration And Deployment On Push to test
on:
workflow_dispatch: # TODO this is there for testing purposes, once the pipelines are all done, remove this
push:
branches:
- 'main'
#- 'dev'1
paths:
- 'backend/**'
- 'frontend/**'
- '.github/workflows/cd-openshift-test.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
builds:
name: Builds
uses: ./.github/workflows/_build.yml
strategy:
matrix:
component: [backend/applications, backend/gateway, backend/legacy, backend/users, backend/sites, frontend]
include:
- component: backend/applications
triggers: ('backend/applications/')
- component: backend/gateway
triggers: ('backend/gateway/')
- component: backend/legacy
triggers: ('backend/legacy/')
- component: backend/users
triggers: ('backend/users/')
- component: backend/sites
triggers: ('backend/sites/')
- component: frontend
triggers: ('frontend/')
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
with:
component: ${{ matrix.component }}
img_build: "test" # ask the team test or latest
img_fallback: test
triggers: ${{ matrix.triggers }}
# TODO - REIMPLMENET BEFORE MERGING, JUST TESTING WITHOUT THESE TO VERIFY DEPLOYS
tests:
name: Unit Tests
uses: ./.github/workflows/_code-cov.yml
strategy:
matrix:
component: [backend/applications, backend/gateway, backend/users, backend/sites, frontend]
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
with:
component: ${{ matrix.component }}
lcov_file: ${{ matrix.component }}/coverage/lcov.info
test_cmd: npm run test:cov
deploys:
name: Deploys
needs:
- builds
# If any of the previous created a build, then deploy
# TODO - RE-ENABLE IF COMMAND BELOW, DISABLED DURING EXPERIMENTAL test
# if: contains(needs.*.outputs.build, 'true')
uses: ./.github/workflows/_deploy.yml
strategy:
matrix:
component: [backend/applications, backend/gateway, backend/legacy, backend/users, backend/sites, database, frontend]
include:
- component: database
overwrite: false
template_file: .github/openshift/deploy.database.yml
template_vars: -p DB_PVC_SIZE=200Mi
- component: backend/applications
overwrite: true
template_file: .github/openshift/deploy.backend-applications.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/applications -p CONTAINER_PORT=4006 -p ENV=test -p IMAGE_TAG=test
- component: backend/gateway
overwrite: true
template_file: .github/openshift/deploy.backend-gateway.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/gateway -p CONTAINER_PORT=4010 -p ENV=test -p IMAGE_TAG=test
- component: backend/legacy
overwrite: true
template_file: .github/openshift/deploy.backend-legacy.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/legacy -p CONTAINER_PORT=4011 -p ENV=test -p IMAGE_TAG=test
- component: backend/users
overwrite: true
template_file: .github/openshift/deploy.backend-users.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/users -p CONTAINER_PORT=4005 -p ENV=test -p IMAGE_TAG=test
- component: backend/sites
overwrite: true
template_file: .github/openshift/deploy.backend-sites.yml
template_vars: -p PROMOTE=${{ github.repository }}/backend/sites -p CONTAINER_PORT=4006 -p ENV=test -p IMAGE_TAG=test
- component: frontend
overwrite: true
template_file: .github/openshift/deploy.frontend.yml
template_vars: -p PROMOTE=${{ github.repository }}/frontend -p CONTAINER_PORT=8080 -p ENV=test -p IMAGE_TAG=test
secrets:
oc_namespace: ${{ secrets.OC_NAMESPACE }}
oc_server: ${{ secrets.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
with:
environment: test
component: ${{ matrix.component }}
overwrite: ${{ matrix.overwrite }}
template_file: ${{ matrix.template_file }}
template_vars: ${{ matrix.template_vars }}
forms-flow-root-config-and-microfrontends-bpm-changes:
runs-on: ubuntu-20.04
if: github.repository == 'bcgov/nr-epd-digital-services'
steps:
- uses: actions/checkout@v2
- name: Set ENV variables
id: set-variable
# make sure to update the TOOLS_NAME once all the environment for forms-flow-ai-web is ready
run: |
echo "For ${{ github.ref_name }} branch for TEST"
echo "TOOLS_NAME=${{secrets.OC_NAMESPACE_NAMEPLATE}}" >> $GITHUB_ENV
echo "TAG_NAME="test"" >> $GITHUB_ENV
echo "BRANCH_NAME="main"" >> $GITHUB_ENV
echo "ENV_NAME="test"" >> $GITHUB_ENV
shell: bash
- name: Login Openshift
shell: bash
run: |
oc login --server=${{secrets.OC_SERVER}} --token=${{secrets.OC_TOKEN}}
- name: Tools project
shell: bash
run: |
oc project ${{ secrets.OC_NAMESPACE_NAMEPLATE }}-tools
- name: Tag Microfrontends from Dev
shell: bash
run: |
oc tag forms-flow-nav:dev forms-flow-nav:test
oc tag forms-flow-theme:dev forms-flow-theme:test
oc tag forms-flow-web-ee:dev forms-flow-web-ee:test
oc tag forms-flow-bpm:dev forms-flow-bpm:test
- name: Start Build Openshift
shell: bash
run: |
oc start-build forms-flow-web-root-config-test-build --wait