-
Notifications
You must be signed in to change notification settings - Fork 0
274 lines (249 loc) · 11.7 KB
/
build-and-deploy.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: build and deploy
on:
push:
branches:
- '**'
- '!feature/cron-fix'
env:
INGRESS_CUCUMBER: https://bidrag-cucumber-cloud.ekstern.dev.nav.no
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
permissions:
contents: "read"
id-token: "write"
name: Build with maven and docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: mvn -B -e --settings .m2/maven-settings.xml clean install
- uses: nais/docker-build-push@v0
id: docker-push
with:
team: bidrag
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.docker-push.outputs.image }}
tag: ${{ steps.docker-push.outputs.tag }}
deploy-feature:
runs-on: ubuntu-latest
name: Deploy feature
needs: build
steps:
- uses: actions/checkout@v3
with:
path: deploy
- name: Deploy to dev-gcp for feature.yaml
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/.nais/nais.yaml
VARS: deploy/.nais/feature.yaml
IMAGE: ${{ needs.build.outputs.image }}
deploy-main:
runs-on: ubuntu-latest
name: Deploy main
if: github.ref != 'refs/heads/main'
needs: build
steps:
- uses: actions/checkout@v3
with:
path: deploy
- name: Deploy to dev-gcp for feature.yaml
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/.nais/nais.yaml
VARS: deploy/.nais/main.yaml
IMAGE: ${{ needs.build.outputs.image }}
run-tests-for-cucumber-cloud:
runs-on: ubuntu-latest
name: bidrag-cucumber-cloud
needs: [deploy-feature, deploy-main]
steps:
- run: echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
if: github.ref != 'refs/heads/main'
- run: |
curl -i -H "Content-Type: application/json" \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"ingressesForApps":[
"${{ env.INGRESS_CUCUMBER }}@tag:bidrag-cucumber-cloud"
], "skipAuth": true}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-stonad:
runs-on: ubuntu-latest
name: bidrag-stonad
needs: [deploy-feature, deploy-main]
env:
INGRESS_STONAD: https://bidrag-stonad.intern.dev.nav.no
INGRESS_VEDTAK: https://bidrag-vedtak.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_STONAD=https://bidrag-stonad-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_VEDTAK=https://bidrag-vedtak-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@bidrag-stonad-vedtak"],"noContextPathForApps":["bidrag-vedtak"],"ingressesForApps":[
"${{ env.INGRESS_VEDTAK }}@bidrag-vedtak"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-stonad"],"ingressesForApps":[
"${{ env.INGRESS_STONAD }}@tag:bidrag-stonad"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-vedtak:
runs-on: ubuntu-latest
name: bidrag-vedtak
needs: [deploy-feature, deploy-main]
env:
INGRESS_VEDTAK: https://bidrag-vedtak.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_VEDTAK=https://bidrag-vedtak-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-vedtak"],"ingressesForApps":[
"${{ env.INGRESS_VEDTAK }}@tag:bidrag-vedtak"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-grunnlag:
runs-on: ubuntu-latest
name: bidrag-grunnlag
needs: [deploy-feature, deploy-main]
env:
INGRESS_GRUNNLAG: https://bidrag-grunnlag.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_GRUNNLAG=https://bidrag-grunnlag-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-grunnlag"],"ingressesForApps":[
"${{ env.INGRESS_GRUNNLAG }}@tag:bidrag-grunnlag"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-arbeidsflyt:
runs-on: ubuntu-latest
name: bidrag-arbeidsflyt
needs: [deploy-feature, deploy-main]
env:
INGRESS_OPPGAVE: https://oppgave.dev-fss-pub.nais.io
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_OPPGAVE=https://oppgave-q1.dev-fss-pub.nais.io" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- name: endre-fagomrade
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-endre-fagomrade"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- name: journalforing
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-journalforing"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- name: opprett-oppgave
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-opprett-oppgave"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
- name: overfor-til-annen-enhet
run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"tags":["@arbeidsflyt-overfor-til-annen-enhet"],"noContextPathForApps":["oppgave"],"ingressesForApps":[
"${{ env.INGRESS_OPPGAVE }}@oppgave"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
run-tests-for-bidrag-dokument-forsendelse:
runs-on: ubuntu-latest
name: bidrag-dokument-forsendelse
needs: [deploy-feature, deploy-main]
env:
INGRESS_DOKUMENT_FORSENDELSE: https://bidrag-dokument-forsendelse.intern.dev.nav.no
steps:
- name: feature ingresses
if: github.ref != 'refs/heads/main'
run: |
echo "INGRESS_DOKUMENT_FORSENDELSE=https://bidrag-dokument-forsendelse-feature.intern.dev.nav.no" >> $GITHUB_ENV
echo "INGRESS_CUCUMBER=https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no" >> $GITHUB_ENV
- run: |
curl -H "Content-Type: application/json" -i \
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \
--request POST \
--data '{"noContextPathForApps":["bidrag-dokument-forsendelse"],"ingressesForApps":[
"${{ env.INGRESS_DOKUMENT_FORSENDELSE }}@tag:bidrag-dokument-forsendelse"
]}' \
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200)
bump_dev_version:
runs-on: ubuntu-latest
name: Bump SNAPSHOT version
if: github.ref == 'refs/heads/main'
needs:
- run-tests-for-cucumber-cloud
- run-tests-for-arbeidsflyt
- run-tests-for-bidrag-stonad
- run-tests-for-bidrag-vedtak
- run-tests-for-bidrag-grunnlag
- run-tests-for-bidrag-dokument-forsendelse
steps:
- uses: actions/checkout@v2
- uses: navikt/bidrag-git/tag-snap@v1-tag-snap