-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
766 lines (716 loc) · 24.9 KB
/
.gitlab-ci.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
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
default:
image: node:18.18.0-bookworm-slim
stages:
- test
- build
- end 2 end
- publish
- deploy
- provision
- performance
workflow:
rules:
# By default, run jobs for every merge request.
- if: $CI_MERGE_REQUEST_ID
# By default, run jobs for every commit on main.
- if: $CI_COMMIT_BRANCH == 'main'
# By default, run jobs for every schedule
- if: $CI_PIPELINE_SOURCE == 'schedule'
# By default, run jobs for every tag
- if: $CI_COMMIT_TAG
###################################################################################################
# Job Templates #
###################################################################################################
# A preset for running Docker in Docker.
.docker:
interruptible: true
services:
- docker:dind
image: docker
dependencies: []
before_script:
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
# A preconfigured environment for using npm.
.npm:
interruptible: true
dependencies: []
cache:
key:
files:
- package-lock.json
paths:
- node_modules
- '**/node_modules'
before_script:
- npm ci
# A template for creating a minor or patch release
.release:
extends: .npm
stage: publish
rules:
- if: $CI_COMMIT_BRANCH == 'main'
when: manual
allow_failure: true
script:
- apt-get update
- apt-get install --yes git gnupg
- gpg --import "$GPG_PRIVATE_KEY"
- npm run scripts -- release "$INCREMENT"
- npm install
- VERSION="$(npm --silent run appsemble -- --version)"
- |
MESSAGE="$VERSION
$(npm --silent run scripts get-release-notes)"
- git config user.email bot@appsemble.com
- git config user.name Appsemble
- git add .
- git commit --message "$MESSAGE" --cleanup whitespace --gpg-sign
- git tag "$VERSION" --message "$MESSAGE" --cleanup whitespace --sign
- git push "https://appsemble-bot:$GITLAB_ACCESS_TOKEN@gitlab.com/appsemble/appsemble" HEAD:main
- |
if [ $? -eq 0 ]; then
echo "Code push successful. Pushing tags..."
git push "https://appsemble-bot:$GITLAB_ACCESS_TOKEN@gitlab.com/appsemble/appsemble" --tags
else
echo "Push to main branch failed. Tags will not be pushed."
fi
###################################################################################################
# Test Stage #
###################################################################################################
# Spell check using cspell
cspell:
extends: .npm
script:
- npx -- cspell
# Lint JavaScript code using ESLint.
eslint:
extends: .npm
script:
- npx -- eslint --format gitlab .
artifacts:
reports:
codequality: gl-codequality.json
# Lint Helm charts.
helm lint:
image: dtzar/helm-kubectl:3
script:
- helm lint config/charts/*
# Lint shell scripts
shellcheck:
image: koalaman/shellcheck-alpine
script:
- printf "Evaluating:\n$(find . -name '*.sh')"
- find . -name '*.sh' | xargs shellcheck
# Verify app messages are in sync with the app definition.
i18n:
extends: .npm
script:
- npm run appsemble -- app extract-messages --verify nl apps/*
# Check formatting using prettier.
prettier:
extends: .npm
script:
- npx -- prettier .
# Lint Markdown using remark.
remark lint:
extends: .npm
script:
- npx -- remark --frail --no-stdout .
# Lint CSS using stylelint.
stylelint:
extends: .npm
script:
- npx -- stylelint .
# Run unittests using NodeJS 18.
test node 18:
interruptible: true
services:
- postgres:15
variables:
POSTGRES_DB: testAppsemble
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
DATABASE_URL: 'postgres://admin:password@postgres:5432/testAppsemble'
script:
- npm ci
- npm test -- --coverage --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
parallel: 3
artifacts:
paths:
- coverage
reports:
junit: junit.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
# Check type validity for our TypeScript files.
tsc:
extends: .npm
script:
- npx --workspaces tsc
# Check type validity for our TypeScript files.
validate:
extends: .npm
script:
- npm run scripts -- validate
###################################################################################################
# Build Stage #
###################################################################################################
# Build the Docker image.
build docker image:
extends: .docker
stage: build
needs: []
script:
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" --build-arg "version=$CI_COMMIT_REF_NAME" --build-arg "date=$CI_JOB_STARTED_AT" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
# Build the npm packages that should be published.
pack:
extends: .npm
stage: build
needs: []
script:
- mkdir build/
- npm --pack-destination build --workspace @appsemble/types pack
- npm --pack-destination build --workspace @appsemble/sdk pack
- npm --pack-destination build --workspace @appsemble/preact pack
- npm --pack-destination build --workspace @appsemble/utils pack
- npm --pack-destination build --workspace @appsemble/node-utils pack
- npm --pack-destination build --workspace @appsemble/webpack-config pack
- npm --pack-destination build --workspace @appsemble/cli pack
- npm --pack-destination build --workspace @appsemble/tsconfig pack
- npm --pack-destination build --workspace appsemble pack
- npm --pack-destination build --workspace create-appsemble pack
- npm run scripts -- validate-packaged-exports build/*
- find build -mindepth 1 -maxdepth 1 -type d -exec rm -r {} +
artifacts:
name: npm packages
expose_as: packages
paths:
- build/
# Package the Helm chart
helm package:
image: dtzar/helm-kubectl:3
stage: build
needs: []
script:
- cp LICENSE.md config/charts/appsemble/
- config/bin/helm-package.sh --dependency-update --destination public config/charts/appsemble/
artifacts:
name: Helm chart
expose_as: Helm chart
paths:
- public/
###################################################################################################
# End 2 End Stage #
###################################################################################################
e2e:
interruptible: true
stage: end 2 end
extends: .docker
needs:
- build docker image
rules:
- if: $CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'appsemble/appsemble'
- if: $CI_PIPELINE_SOURCE == 'schedule'
- if: $CI_COMMIT_TAG
variables:
APPSEMBLE_IMAGE: '$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG'
script:
- docker compose --project-name appsemble-e2e --file docker-compose-e2e.yaml up -d
- . scripts/e2e.sh
after_script:
- docker compose --project-name appsemble-e2e --file docker-compose-e2e.yaml down --volumes
artifacts:
expose_as: Playwright videos
when: always
paths:
- packages/e2e/test-results/
reports:
junit: packages/e2e/results.xml
e2e apps:
stage: end 2 end
needs:
- build docker image
rules:
- if: $CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'appsemble/appsemble'
- if: $CI_PIPELINE_SOURCE == 'schedule'
- if: $CI_COMMIT_TAG
inherit:
variables: false
variables:
APPSEMBLE_IMAGE: '$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG'
parallel:
matrix:
- APP:
[
'appsemble/apps/template',
'appsemble/apps/sittard-geleen',
'appsemble/apps/eindhoven',
'appsemble/apps/amersfoort',
]
trigger:
project: $APP
strategy: depend
branch: main
###################################################################################################
# Publish Stage #
###################################################################################################
twitter:
extends: .npm
stage: publish
# This is new and mainly used to update nice-to-have metadata.
# Allow failure to prevent blocking of important jobs.
allow_failure: true
needs: []
rules:
- if: $CI_COMMIT_TAG
script:
- npm run scripts -- twitter
# Update metadata on Docker Hub
docker metadata:
extends: .npm
stage: publish
# This is new and mainly used to update nice-to-have metadata.
# Allow failure to prevent blocking of important jobs.
allow_failure: true
needs: []
rules:
- if: $CI_COMMIT_TAG
script:
- npm run scripts -- docker-metadata
# Create a GitHub release
github release:
extends: .npm
stage: publish
# This is new and mainly used to update nice-to-have metadata.
# Allow failure to prevent blocking of important jobs.
allow_failure: true
needs: []
rules:
- if: $CI_COMMIT_TAG
script:
- npm run scripts -- github-release
# Create a GitLab release
gitlab release:
extends: .npm
stage: publish
# This is new and mainly used to update nice-to-have metadata.
# Allow failure to prevent blocking of important jobs.
allow_failure: true
needs: []
rules:
- if: $CI_COMMIT_TAG
script:
- npm run scripts -- gitlab-release
publish docker:
extends: .docker
stage: publish
needs:
- build docker image
variables:
GIT_STRATEGY: none
rules:
- if: $CI_COMMIT_TAG
script:
- echo $DOCKER_HUB_PASSWORD | docker login -u $DOCKER_HUB_USERNAME --password-stdin
- docker pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE:latest"
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "appsemble/appsemble:latest"
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" "appsemble/appsemble:$CI_COMMIT_TAG"
- docker push "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
- docker push "appsemble/appsemble:latest"
- docker push "appsemble/appsemble:$CI_COMMIT_TAG"
# Publish the Helm chart to https://charts.appsemble.com
publish helm:
image: dtzar/helm-kubectl:3
needs:
- helm package
stage: publish
variables:
GIT_STRATEGY: none
rules:
- if: $CI_COMMIT_TAG
script:
- apk add git gnupg
- gpg --import "$GPG_PRIVATE_KEY"
- git init
- git remote add origin "https://appsemble-bot:$GITLAB_ACCESS_TOKEN@gitlab.com/appsemble/charts.git"
- git fetch --depth 1
- git checkout --track origin/main
- git config commit.gpgSign true
- git config user.email bot@appsemble.com
- git config user.name Appsemble
- git add public
- git commit --message "Add Appsemble Helm chart $CI_COMMIT_TAG"
- git push origin main
- helm repo add appsemble https://charts.appsemble.com
- | # Wait until the chart has been published downstream
while ! helm show all 'appsemble/appsemble' --version "$CI_COMMIT_TAG" 2> /dev/null; do
sleep 3
echo retrying in 3 seconds…
helm repo update > /dev/null
done
# Publish npm packages to npmjs.org.
publish npm:
stage: publish
dependencies:
- pack
needs:
- pack
variables:
GIT_STRATEGY: none
rules:
- if: $CI_COMMIT_TAG
id_tokens:
SIGSTORE_ID_TOKEN:
aud: sigstore
script:
- npm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
- find . -exec npm publish --access public --provenance {} \;
# Perform various post release actions.
sentry release:
needs: []
image:
name: getsentry/sentry-cli:2
entrypoint: [/bin/sh, -c]
stage: publish
rules:
- if: $CI_COMMIT_TAG
script:
- sentry-cli releases new --finalize "$CI_COMMIT_TAG"
- sentry-cli releases set-commits --auto "$CI_COMMIT_TAG"
# Create a patch release
release patch:
extends: .release
variables:
INCREMENT: patch
# Create a minor release
release minor:
extends: .release
variables:
INCREMENT: minor
###################################################################################################
# Deploy Stage #
###################################################################################################
# Delete all successful jobs for review environments nightly
cleanup k8s jobs:
image: dtzar/helm-kubectl:3
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == 'schedule'
script:
- kubectl config use-context "$CI_PROJECT_PATH:development"
- kubectl config set-context --current --namespace review
- kubectl delete jobs.batch --field-selector 'status.successful=1'
# Update lockfile and fix formatting where possible
update dependencies:
stage: deploy
variables:
GIT_STRATEGY: none
rules:
- if: $CI_PIPELINE_SOURCE == 'schedule'
cache:
policy: push
key:
files:
- package-lock.json
paths:
- node_modules
- '**/node_modules'
script:
- apt update
- apt install --yes git gnupg
- gpg --import "$GPG_PRIVATE_KEY"
- git init
- git remote add origin "https://appsemble-bot:$GITLAB_ACCESS_TOKEN@gitlab.com/appsemble/appsemble.git"
- git fetch --depth 1
- git checkout -B update-lockfile origin/main
- git config commit.gpgSign true
- git config user.email bot@appsemble.com
- git config user.name Appsemble
- rm package-lock.json
- npm install --ignore-scripts
- npx -- eslint --fix . || true
- npx -- remark . -o || true
- npx -- stylelint --fix . || true
- npx -- prettier --write . || true
- git commit --all --message 'Update package-lock.json'
- git push --force origin update-lockfile
-o merge_request.create
-o merge_request.label=Chore
-o merge_request.merge_when_pipeline_succeeds
-o merge_request.remove_source_branch
# Deploy the Docker image for a branch to a review environment.
review:
image: dtzar/helm-kubectl:3
stage: deploy
needs:
- build docker image
- job: helm package
artifacts: true
rules:
- if: $CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'appsemble/appsemble'
environment:
name: review/$CI_MERGE_REQUEST_IID
url: https://$CI_MERGE_REQUEST_IID.appsemble.review
on_stop: stop review
auto_stop_in: 1 day
variables:
GIT_STRATEGY: none
script:
- kubectl config use-context "$CI_PROJECT_PATH:development"
- kubectl config set-context --current --namespace review
# This is the only way to make sure the review environment can be overwritten
- helm delete "review-$CI_MERGE_REQUEST_IID" || true
- kubectl delete pvc --selector "app.kubernetes.io/instance=review-$CI_MERGE_REQUEST_IID" || true
- helm install "review-$CI_MERGE_REQUEST_IID" ./public/appsemble-*.tgz
--atomic
--set "fullnameOverride=review-$CI_MERGE_REQUEST_IID"
--set "gitlab.app=$CI_PROJECT_PATH_SLUG"
--set "gitlab.env=$CI_ENVIRONMENT_SLUG"
--set "image.pullPolicy=Always"
--set "image.repository=$CI_REGISTRY_IMAGE"
--set "image.tag=$CI_COMMIT_REF_SLUG"
--set "ingress.clusterIssuer=letsencrypt-dev"
--set "ingress.enabled=true"
--set "ingress.host=${CI_ENVIRONMENT_URL/https:\/\//}"
--set "ingress.tls.secretName=review-$CI_MERGE_REQUEST_IID-tls"
--set "ingress.tls.wildcardSecretName=review-$CI_MERGE_REQUEST_IID-tls-wildcard"
--set "migrateTo=next"
--set "global.postgresql.auth.existingSecret=postgresql-secret"
--set "provision.account.clientCredentials=$APPSEMBLE_CLIENT_CREDENTIALS"
--set "provision.account.email=$BOT_ACCOUNT_EMAIL"
--set "provision.account.name=$BOT_ACCOUNT_NAME"
--set "provision.account.password=$BOT_ACCOUNT_PASSWORD"
--set "provision.account.timezone=Europe/Amsterdam"
--set "postgresql.fullnameOverride=review-$CI_MERGE_REQUEST_IID-postgresql"
--set "proxy=true"
--set "remote=https://appsemble.app"
--set "sentry.allowedDomains={*.appsemble.review}"
--set "sentry.environment=review-$CI_MERGE_REQUEST_IID"
--set "sentry.secret=sentry"
# Stop a review environment.
stop review:
image: dtzar/helm-kubectl:3
dependencies: []
stage: deploy
rules:
- if: $CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'appsemble/appsemble'
when: manual
allow_failure: true
environment:
name: review/$CI_MERGE_REQUEST_IID
action: stop
variables:
GIT_STRATEGY: none
script:
- kubectl config use-context "$CI_PROJECT_PATH:development"
- kubectl config set-context --current --namespace review
- helm delete "review-$CI_MERGE_REQUEST_IID"
- kubectl delete pvc --selector "app.kubernetes.io/instance=review-$CI_MERGE_REQUEST_IID"
# Deploy the Docker image for main to the staging environment.
staging:
image: dtzar/helm-kubectl:3
stage: deploy
needs:
- build docker image
- job: helm package
artifacts: true
rules:
- if: $CI_PIPELINE_SOURCE == 'schedule'
environment:
name: staging
url: https://staging.appsemble.review
variables:
GIT_STRATEGY: none
script:
- kubectl config use-context "$CI_PROJECT_PATH:development"
- kubectl config set-context --current --namespace staging
# This is the only way to make sure staging can be overwritten
- helm delete staging || true
- kubectl delete pvc --selector "app.kubernetes.io/instance=staging" || true
- helm install staging ./public/appsemble-*.tgz
--atomic
--set "gitlab.app=$CI_PROJECT_PATH_SLUG"
--set "gitlab.env=$CI_ENVIRONMENT_SLUG"
--set "global.postgresql.auth.existingSecret=postgresql-secret"
--set "image.pullPolicy=Always"
--set "image.repository=$CI_REGISTRY_IMAGE"
--set "image.tag=main"
--set "ingress.clusterIssuer=letsencrypt-dev"
--set "ingress.enabled=true"
--set "ingress.host=staging.appsemble.review"
--set "ingress.tls.secretName=staging-tls"
--set "ingress.tls.wildcardSecretName=staging-tls-wildcard"
--set "migrateTo=next"
--set "oauthSecret=oauth2"
--set "postgresql.fullnameOverride=staging-postgresql"
--set "provision.account.clientCredentials=$APPSEMBLE_CLIENT_CREDENTIALS"
--set "provision.account.email=$BOT_ACCOUNT_EMAIL"
--set "provision.account.name=$BOT_ACCOUNT_NAME"
--set "provision.account.password=$BOT_ACCOUNT_PASSWORD"
--set "provision.account.timezone=Europe/Amsterdam"
--set "proxy=true"
--set "remote=https://appsemble.app"
--set "sentry.allowedDomains={*.appsemble.review}"
--set "sentry.environment=staging"
--set "sentry.secret=sentry"
--set "quotas.appEmail.enabled=true"
--set "quotas.appEmail.dailyLimit=10"
--set "quotas.appEmail.alertOrganizationOwner=true"
production:
image: dtzar/helm-kubectl:3
stage: deploy
needs:
- publish docker
- publish helm
rules:
- if: $CI_COMMIT_TAG
environment:
name: production
url: https://appsemble.app
variables:
GIT_STRATEGY: none
script:
- kubectl config use-context "$CI_PROJECT_PATH:production"
- kubectl config set-context --current --namespace appsemble
- helm repo add appsemble https://charts.appsemble.com
# Prevent a finished job without chart actually serving.
- |
retries=0
found=0
while [ $retries -lt 100 ] && [ $found -ne 1 ]; do
helm repo update
if helm search repo appsemble/appsemble --version "$CI_COMMIT_TAG" --fail-on-no-result; then
echo "Chart found!"
found=1
else
echo "Chart version $CI_COMMIT_TAG not found, retrying in 5 seconds..."
sleep 5
retries=$((retries + 1))
fi
done
if [ $found -ne 1 ]; then
echo "Maximum number of attempts reached. Chart not found."
exit 1
fi
- helm upgrade appsemble appsemble/appsemble
--debug
--timeout 30m
--version "$CI_COMMIT_TAG"
--set "gitlab.app=$CI_PROJECT_PATH_SLUG"
--set "gitlab.env=$CI_ENVIRONMENT_SLUG"
--set "global.postgresql.auth.existingSecret=$POSTGRESQL_SECRET"
--set "global.postgresql.auth.database=$POSTGRESQL_DATABASE"
--set "global.postgresql.auth.username=$POSTGRESQL_USERNAME"
--set "global.postgresql.service.ports.postgresql=$POSTGRESQL_PORT"
--set "ingress.annotations.nginx\.ingress\.kubernetes\.io/proxy-body-size=50m"
--set "ingress.annotations.nginx\.ingress\.kubernetes\.io/force-ssl-redirect=\"true\""
--set "ingress.annotations.nginx\.ingress\.kubernetes\.io/ssl-redirect=\"true\""
--set "ingress.annotations.nginx\.ingress\.kubernetes\.io/hsts=\"true\""
--set "ingress.annotations.nginx\.ingress\.kubernetes\.io/hsts-include-subdomains=\"true\""
--set "ingress.annotations.nginx\.ingress\.kubernetes\.io/hsts-max-age=\"31536000\""
--set "ingress.clusterIssuer=letsencrypt-prod"
--set "ingress.enabled=true"
--set "ingress.host=appsemble.app"
--set "ingress.tls.secretName=appsemble-tls"
--set "ingress.tls.wildcardSecretName=appsemble-tls-wildcard"
--set "oauthSecret=oauth2"
--set "postgresql.fullnameOverride=$POSTGRESQL_HOST"
--set "postgresql.enabled=false"
--set 'postgresSSL=true'
--set "proxy=true"
--set "sentry.allowedDomains={*.appsemble.app, appsemble.app}"
--set "sentry.environment=production"
--set "sentry.secret=sentry"
--set "quotas.appEmail.enabled=true"
--set "quotas.appEmail.dailyLimit=10"
--set "quotas.appEmail.alertOrganizationOwner=true"
--wait
###################################################################################################
# Provision Stage #
###################################################################################################
# Provision the review environment with the blocks that were built in the build stage.
provision review:
extends: .npm
stage: provision
rules:
- if: $CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'appsemble/appsemble'
needs:
- review
script:
- npm run scripts -- release patch
- npm run appsemble -- config set context review
- npm run appsemble -- config set remote "https://$CI_MERGE_REQUEST_IID.appsemble.review"
- npm run scripts -- wait-for-api
- . scripts/setup-appsemble.sh
# Provision the staging environment with the blocks that were built in the build stage.
provision staging:
extends: .npm
stage: provision
rules:
- if: $CI_PIPELINE_SOURCE == 'schedule'
needs:
- staging
script:
- npm run scripts -- release patch
- npm run appsemble -- config set context staging
- npm run appsemble -- config set remote https://staging.appsemble.review
- npm run appsemble -- organization create appsemble
--description 'The open source low-code app building platform'
--email support@appsemble.com
--icon packages/server/assets/appsemble.png
--name Appsemble
--website https://appsemble.com
- npm run appsemble -- -vv block publish blocks/*
- npm run appsemble -- -vv app publish apps/* --resources --assets --assets-clonable --modify-context
# Provision the production environment with the blocks that were built in the build stage.
provision production:
extends: .npm
stage: provision
rules:
- if: $CI_COMMIT_TAG
needs:
- production
environment:
name: production
action: prepare
script:
- npm run appsemble -- config set context production
- npm run appsemble -- config set remote https://appsemble.app
- npm run appsemble -- config set ignore-conflict true
- npm run appsemble -- -vv block publish blocks/*
- apt-get update
- apt-get install --yes git gnupg yq
- ./scripts/publish-or-update-apps.sh --push-to-main production
###################################################################################################
# Performance Stage #
###################################################################################################
lighthouse:
interruptible: true
stage: performance
extends: .npm
image: $CI_REGISTRY/appsemble/docker-node-chrome
needs:
- job: provision review
optional: true
- job: provision staging
optional: true
- job: provision production
optional: true
rules:
- if: $CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'appsemble/appsemble'
- if: $CI_PIPELINE_SOURCE == 'schedule'
- if: $CI_COMMIT_TAG
script:
- npm run scripts -- wait-for-ssl
- npx -- lhci collect
- npx -- lhci assert
artifacts:
expose_as: Lighthouse reports
when: always
paths:
- .lighthouseci