This repository has been archived by the owner on Dec 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.yml
1020 lines (970 loc) · 44 KB
/
config.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
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
version: 2.1
orbs:
slack: circleci/slack@4.4.4
gravitee: gravitee-io/gravitee@1.0.38
secrethub: secrethub/cli@1.1.0
gh: circleci/github-cli@1.0.4
executors:
node-lts:
parameters:
class:
description: The resource class
type: enum
enum: [ 'small', 'medium', 'large', 'xlarge' ]
default: 'medium'
docker:
- image: cimg/node:14.18
resource_class: <<parameters.class>>
commands:
restore-maven-cache:
description: "Restore Maven cache"
steps:
- restore_cache:
keys:
- gravitee-api-management-v4-{{ .Branch }}-{{ checksum "pom.xml" }}
notify-on-failure:
steps:
- slack/notify:
branch_pattern: master
event: fail
template: basic_fail_1
get-apim-tag:
steps:
- run:
name: Read tag of Docker images to deploy
command: |
export TAG=$(cat ./docker-tag.txt)
# Workaround for sharing this variable to the next steps
echo "export TAG=$TAG" >> $BASH_ENV
parameters:
gio_action:
type: enum
enum: [ release, standalone_release, standalone_release_replay, nexus_staging, vm_nexus_staging, pull_requests ]
default: pull_requests
dry_run:
type: boolean
default: true
description: "Run in dry run mode?"
maven_profile_id:
type: string
default: "gravitee-dry-run"
description: "Maven ID of the Maven profile to use for a dry run ?"
secrethub_org:
type: string
default: "graviteeio"
description: "SecretHub Org to use to fetch secrets ?"
secrethub_repo:
type: string
default: "cicd"
description: "SecretHub Repo to use to fetch secrets ?"
s3_bucket_name:
type: string
default: ""
description: "Name of the S3 Bucket used to store and retrieve the state of the maven project, to perform the nexus staging ?"
replayed_release:
type: string
default: ""
description: "What is the version number of the release you want to replay? (Mandatory, only for the 'standalone_release_replay' Workflow / see 'gio_action' pipeline parameter)"
jobs:
compute-apim-tag:
docker:
- image: cimg/openjdk:11.0
resource_class: small
steps:
- checkout
- restore_cache:
name: Restore Maven cache for compute-tag job
keys:
- gravitee-api-management-compute-tag-{{ .Branch }}-{{ checksum "pom.xml" }}
- run:
name: Compute APIM Version
command: |
export APIM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "export APIM_VERSION=$APIM_VERSION" >> $BASH_ENV
echo "Gravitee APIM version: ${APIM_VERSION}"
- run:
name: Compute Tag for Docker images
command: |
if [[ $CIRCLE_BRANCH =~ ^([0-9]+\.[0-9]+\.x|master)$ ]]
then
export TAG=${CIRCLE_BRANCH}
else
# Compute tag with branch name, commmit SHA and timestamp. Then slugify it to be sure it can be handled by Docker
export TAG=${APIM_VERSION}-$(echo "${CIRCLE_BRANCH:0:15}" | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z)-${CIRCLE_SHA1:0:7}
fi
# Workaround for sharing this variable to the next steps
echo "export TAG=$TAG" >> $BASH_ENV
echo "Docker images will be tagged with: ${TAG}"
echo $TAG > docker-tag.txt
- save_cache:
name: Save Maven cache for compute-tag job
paths:
- ~/.m2
key: gravitee-api-management-compute-tag-{{ .Branch }}-{{ checksum "pom.xml" }}
when: always
- persist_to_workspace:
root: .
paths:
- docker-tag.txt
build:
docker:
- image: cimg/openjdk:11.0
resource_class: large
steps:
- checkout
- attach_workspace:
at: .
- restore-maven-cache
- run:
name: "Build project"
command: |
mvn -pl '!gravitee-apim-console-webui, !gravitee-apim-portal-webui' -s .artifactory.settings.xml clean package --no-transfer-progress -DskipTests -T 2C
cp ./gravitee-apim-rest-api/gravitee-apim-rest-api-standalone/gravitee-apim-rest-api-standalone-distribution/gravitee-apim-rest-api-standalone-distribution-zip/target/gravitee-apim-rest-api-distribution-*.zip ./
- notify-on-failure
- save_cache:
paths:
- ~/.m2
key: gravitee-api-management-v4-{{ .Branch }}-{{ checksum "pom.xml" }}
when: always
- persist_to_workspace:
root: ./
paths:
- ./gravitee-*/*/target/*
- ./gravitee-apim-rest-api-distribution-*.zip
test:
machine:
image: ubuntu-2004:202107-02
resource_class: xlarge
steps:
- checkout
- attach_workspace:
at: .
- restore-maven-cache
- run:
name: Run tests
command: |
# Need to use `package` phase to get repo-test's jar build and shared to mongodb and jdbc repos
mvn -pl '!gravitee-apim-console-webui, !gravitee-apim-portal-webui' -s .artifactory.settings.xml package --no-transfer-progress -T 2C
- run:
name: Save test results
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
when: always
- notify-on-failure
- store_test_results:
path: ~/test-results
publish-on-artifactory:
docker:
- image: cimg/openjdk:11.0
resource_class: large
steps:
- checkout
- attach_workspace:
at: .
- restore-maven-cache
- run:
name: "Maven Package and deploy to Artifactory ([gravitee-snapshots] repository)"
command: |
mvn deploy --no-transfer-progress -DskipTests -T 2C -pl '!gravitee-apim-console-webui, !gravitee-apim-portal-webui' -s .artifactory.settings.xml -P gio-dev
- notify-on-failure
publish-on-nexus:
docker:
- image: cimg/openjdk:11.0
resource_class: large
environment:
NEXUS_SNAPSHOTS_URL: "https://oss.sonatype.org/content/repositories/snapshots"
NEXUS_SNAPSHOTS_SERVER_ID: "sonatype-nexus-snapshots"
steps:
- checkout
- attach_workspace:
at: .
- restore-maven-cache
- run:
name: "Maven Package and deploy to Nexus Snapshots"
command: |
mvn deploy --no-transfer-progress -DskipTests -T 2C -pl '!gravitee-apim-console-webui, !gravitee-apim-portal-webui' -s .nexus.settings.xml -DaltDeploymentRepository=${NEXUS_SNAPSHOTS_SERVER_ID}::default::${NEXUS_SNAPSHOTS_URL}
- notify-on-failure
publish-images-azure-registry:
docker:
- image: cimg/openjdk:11.0
resource_class: small
steps:
- checkout
- attach_workspace:
at: .
- setup_remote_docker
- get-apim-tag
- run:
name: Build & Publish Management API Docker Image to Azure Registry
command: |
export APIM_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
export IMAGE_TAG=graviteeio.azurecr.io/apim-management-api:${TAG}
docker build -f gravitee-apim-rest-api/docker/Dockerfile-dev \
--build-arg GRAVITEEIO_VERSION=${APIM_VERSION} \
-t ${IMAGE_TAG} .
echo $AZURE_DOCKER_REGISTRY_PASSWORD | docker login --username $AZURE_DOCKER_REGISTRY_USERNAME --password-stdin graviteeio.azurecr.io
docker push ${IMAGE_TAG}
- notify-on-failure
console-webui-install:
executor:
name: node-lts
class: small
steps:
- checkout
- restore_cache:
name: Restore NPM cache
keys:
- gravitee-apim-console-webui-cache-v1-{{ checksum "gravitee-apim-console-webui/package-lock.json" }}
- run:
name: Install dependencies
command: npm install
working_directory: gravitee-apim-console-webui
- notify-on-failure
- save_cache:
name: Save NPM cache
key: gravitee-apim-console-webui-cache-v1-{{ checksum "gravitee-apim-console-webui/package-lock.json" }}
paths:
- ./gravitee-apim-console-webui/node_modules
- persist_to_workspace:
root: .
paths:
- gravitee-apim-console-webui/node_modules
console-webui-lint-test:
executor:
name: node-lts
class: medium
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Check License
command: npm run lint:license
working_directory: gravitee-apim-console-webui
- run:
name: Run Prettier and ESLint
command: npm run lint
working_directory: gravitee-apim-console-webui
- run:
name: Run unit tests
command: npm run test:ci
working_directory: gravitee-apim-console-webui
- notify-on-failure
- persist_to_workspace:
root: .
paths:
- gravitee-apim-console-webui/coverage
- store_test_results:
path: gravitee-apim-console-webui/coverage
console-webui-sonarcloud-analysis:
docker:
- image: sonarsource/sonar-scanner-cli
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run Sonarcloud Analysis
command: sonar-scanner
working_directory: gravitee-apim-console-webui
- notify-on-failure
console-webui-build:
executor:
name: node-lts
class: large
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Build
command: npm run build:prod
environment:
NODE_OPTIONS: --max_old_space_size=4086
BACKEND_ENV: element-zero
working_directory: gravitee-apim-console-webui
- run:
name: Zip dist folder
# TODO:
# - Use gzip instead of zip
command: zip -r dist.zip dist
working_directory: gravitee-apim-console-webui
- notify-on-failure
- persist_to_workspace:
root: .
paths:
- gravitee-apim-console-webui/dist
console-webui-deploy-on-azure-storage:
docker:
- image: mcr.microsoft.com/azure-cli:latest
resource_class: small
steps:
- attach_workspace:
at: .
- run:
name: Login into Azure Storage and upload dist
# TODO:
# - Update CircleCI env var AZURE_STORAGE_CONNECTION_STRING (one for Console, one for Portal)
command: |
export BRANCH_ID=$(echo "$CIRCLE_BRANCH" | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr "[:upper:]" "[:lower:]" | cut -c -60)
az login --service-principal -u $AZURE_APPLICATION_ID --tenant $AZURE_TENANT -p $AZURE_APPLICATION_SECRET
az storage container create -n $BRANCH_ID --public-access blob
az storage blob upload-batch -s gravitee-apim-console-webui/dist -d $BRANCH_ID
- notify-on-failure
console-webui-comment-pr-after-deployment:
executor:
name: node-lts
class: small
steps:
- checkout
- gh/setup
- run:
name: Comment Pull Request
command: |
# First check there is an associated pull request, otherwise just stop the job here
if ! gh pr view --json title;
then
echo "No PR found for this branch, stopping the job here."
exit 0
fi
export BRANCH_ID=$(echo "$CIRCLE_BRANCH" | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr "[:upper:]" "[:lower:]" | cut -c -60)
gh pr comment --body "**Gravitee.io Automatic Deployment**
Congrats, all the CI steps were 🟢 . The Bot was able to deploy the build of this PR, so you can now try it directly [here](https://apimnightlywebui24386.blob.core.windows.net/${BRANCH_ID}/index.html)! 🚀
_Notes_: The deployed app is linked to the management API of the Element Zero team's environment."
- notify-on-failure
console-webui-publish-images-azure-registry:
docker:
- image: cimg/openjdk:11.0
resource_class: small
steps:
- checkout
- attach_workspace:
at: .
- setup_remote_docker
- get-apim-tag
- run:
name: Build & Publish Web UI Docker Image to Azure Registry
command: |
cp -fr docker/config .
cp -fr docker/run.sh .
export IMAGE_TAG=graviteeio.azurecr.io/apim-management-ui:${TAG}
docker build -f docker/Dockerfile-dev -t ${IMAGE_TAG} .
echo $AZURE_DOCKER_REGISTRY_PASSWORD | docker login --username $AZURE_DOCKER_REGISTRY_USERNAME --password-stdin graviteeio.azurecr.io
docker push ${IMAGE_TAG}
working_directory: gravitee-apim-console-webui
- notify-on-failure
purge-master-azure-registry:
docker:
- image: mcr.microsoft.com/azure-cli:latest
resource_class: small
steps:
- run:
name: 🗑 Let's purge all master Apim images older than 1d
# TODO:
# - Improve purge of other images and branches
command: |
az login --service-principal -u $AZURE_APPLICATION_ID --tenant $AZURE_TENANT -p $AZURE_APPLICATION_SECRET
az acr run --cmd "acr purge --filter 'apim-console-webui:master-.*' --untagged --ago 1d --keep 3" --registry graviteeio /dev/null
- notify-on-failure
portal-webui-install:
executor:
name: node-lts
class: small
steps:
- checkout
- restore_cache:
name: Restore NPM cache
keys:
- gravitee-apim-portal-webui-cache-v1-{{ checksum "gravitee-apim-portal-webui/package-lock.json" }}
- run:
name: Install dependencies
command: npm install
working_directory: gravitee-apim-portal-webui
- notify-on-failure
- save_cache:
name: Save NPM cache
key: gravitee-apim-portal-webui-cache-v1-{{ checksum "gravitee-apim-portal-webui/package-lock.json" }}
paths:
- ./gravitee-apim-portal-webui/node_modules
- persist_to_workspace:
root: .
paths:
- gravitee-apim-portal-webui/node_modules
portal-webui-lint-test:
executor:
name: node-lts
class: large
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Check License
command: npm run lint:license
working_directory: gravitee-apim-portal-webui
- run:
name: Run Prettier and ESLint
command: npm run lint
working_directory: gravitee-apim-portal-webui
- run:
name: Run unit tests
command: npm run test:coverage
working_directory: gravitee-apim-portal-webui
- notify-on-failure
- persist_to_workspace:
root: .
paths:
- gravitee-apim-portal-webui/coverage
- store_test_results:
path: gravitee-apim-portal-webui/coverage
portal-webui-sonarcloud-analysis:
docker:
- image: sonarsource/sonar-scanner-cli
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Run Sonarcloud Analysis
command: sonar-scanner
working_directory: gravitee-apim-portal-webui
- notify-on-failure
portal-webui-build:
executor:
name: node-lts
class: large
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Build
command: npm run build:prod
environment:
NODE_OPTIONS: --max_old_space_size=4086
working_directory: gravitee-apim-portal-webui
- run:
name: Zip dist folder
# TODO:
# - Use gzip instead of zip
command: zip -r dist.zip dist
working_directory: gravitee-apim-portal-webui
- notify-on-failure
- persist_to_workspace:
root: .
paths:
- gravitee-apim-portal-webui/dist
portal-webui-publish-images-azure-registry:
docker:
- image: cimg/openjdk:11.0
resource_class: small
steps:
- checkout
- attach_workspace:
at: .
- setup_remote_docker
- get-apim-tag
- run:
name: Build & Publish Web UI Docker Image to Azure Registry
command: |
cp -fr docker/config .
cp -fr docker/run.sh .
export IMAGE_TAG=graviteeio.azurecr.io/apim-portal-webui:${TAG}
docker build -f docker/Dockerfile-dev -t ${IMAGE_TAG} .
echo $AZURE_DOCKER_REGISTRY_PASSWORD | docker login --username $AZURE_DOCKER_REGISTRY_USERNAME --password-stdin graviteeio.azurecr.io
docker push ${IMAGE_TAG}
working_directory: gravitee-apim-portal-webui
- notify-on-failure
deploy-on-azure-cluster:
docker:
- image: mcr.microsoft.com/azure-cli:latest
resource_class: small
steps:
- attach_workspace:
at: .
- get-apim-tag
- run:
name: Install Helm
command: |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
helm version
- run:
name: Install Kubectl
command: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
kubectl version --client=true
- run:
name: Helm upgrade and 🚀 to Element Zero cluster
command: |
if [ "master" == "${CIRCLE_BRANCH}" ]
then
az login --service-principal -u $AZURE_APPLICATION_ID --tenant $AZURE_TENANT -p $AZURE_APPLICATION_SECRET
az aks get-credentials --resource-group element-zero --name element-zero
helm upgrade --repo https://helm.gravitee.io \
--install apim \
-n apim \
--reuse-values \
apim3 \
--set "api.image.repository=graviteeio.azurecr.io/apim-management-api" \
--set "api.image.tag=${TAG}" \
--set "portal.image.repository=graviteeio.azurecr.io/apim-portal-webui" \
--set "portal.image.tag=${TAG}" \
--set "ui.image.repository=graviteeio.azurecr.io/apim-management-ui" \
--set "ui.image.tag=${TAG}"
fi
- run:
name: Helm upgrade and 🚀 to APIM cluster
command: |
export K8S_NAMESPACE=apim-${CIRCLE_BRANCH//\./-}
az login --service-principal -u $AZURE_APPLICATION_ID --tenant $AZURE_TENANT -p $AZURE_APPLICATION_SECRET
az aks get-credentials --resource-group apim-hprod --name apim-hprod
helm upgrade --repo https://helm.gravitee.io \
--install apim \
-n ${K8S_NAMESPACE} \
--reuse-values \
apim3 \
--set "api.image.repository=graviteeio.azurecr.io/apim-management-api" \
--set "api.image.tag=${TAG}" \
--set "portal.image.repository=graviteeio.azurecr.io/apim-portal-webui" \
--set "portal.image.tag=${TAG}" \
--set "ui.image.repository=graviteeio.azurecr.io/apim-management-ui" \
--set "ui.image.tag=${TAG}"
- notify-on-failure
workflows:
pull_requests:
when:
and:
- equal: [ pull_requests, << pipeline.parameters.gio_action >> ]
jobs:
- gravitee/d_pull_requests_secrets:
context: cicd-orchestrator
name: pr_secrets_resolution
- compute-apim-tag
- build:
context: gravitee-qa
requires:
- pr_secrets_resolution
- compute-apim-tag
- test:
requires:
- build
- publish-on-artifactory:
filters:
branches:
only:
- master
- /^\d+\.\d+\.x$/
requires:
- test
- publish-on-nexus:
filters:
branches:
only:
- master
- /^\d+\.\d+\.x$/
requires:
- test
- publish-images-azure-registry:
context: cicd-orchestrator
requires:
- test
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/docker-registries/graviteeio/username
var-name: AZURE_DOCKER_REGISTRY_USERNAME
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/docker-registries/graviteeio/password
var-name: AZURE_DOCKER_REGISTRY_PASSWORD
filters:
branches:
only:
- master
- /^\d+\.\d+\.x$/
- implement-continuous-deployment-to-azure
- console-webui-install:
requires:
- pr_secrets_resolution
- compute-apim-tag
- console-webui-lint-test:
requires:
- console-webui-install
- console-webui-sonarcloud-analysis:
context: cicd-orchestrator
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/graviteebot/infra/sonarcloud.io.token
var-name: SONAR_TOKEN
requires:
- console-webui-lint-test
- console-webui-build:
requires:
- console-webui-install
- console-webui-deploy-on-azure-storage:
context: cicd-orchestrator
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/application-id
var-name: AZURE_APPLICATION_ID
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/tenant
var-name: AZURE_TENANT
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/application-secret
var-name: AZURE_APPLICATION_SECRET
requires:
- console-webui-build
- console-webui-comment-pr-after-deployment:
context: cicd-orchestrator
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/graviteebot/github_personal_access_token
var-name: GITHUB_TOKEN
requires:
- console-webui-deploy-on-azure-storage
- console-webui-publish-images-azure-registry:
context: cicd-orchestrator
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/docker-registries/graviteeio/username
var-name: AZURE_DOCKER_REGISTRY_USERNAME
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/docker-registries/graviteeio/password
var-name: AZURE_DOCKER_REGISTRY_PASSWORD
requires:
- console-webui-build
filters:
branches:
only:
- master
- /^\d+\.\d+\.x$/
- implement-continuous-deployment-to-azure
- portal-webui-install:
requires:
- pr_secrets_resolution
- compute-apim-tag
- portal-webui-lint-test:
requires:
- portal-webui-install
- portal-webui-sonarcloud-analysis:
context: cicd-orchestrator
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/graviteebot/infra/sonarcloud.io.token
var-name: SONAR_TOKEN
requires:
- portal-webui-lint-test
- portal-webui-build:
requires:
- portal-webui-install
- portal-webui-publish-images-azure-registry:
context: cicd-orchestrator
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/docker-registries/graviteeio/username
var-name: AZURE_DOCKER_REGISTRY_USERNAME
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/docker-registries/graviteeio/password
var-name: AZURE_DOCKER_REGISTRY_PASSWORD
requires:
- portal-webui-build
filters:
branches:
only:
- master
- /^\d+\.\d+\.x$/
- implement-continuous-deployment-to-azure
- deploy-on-azure-cluster:
context: cicd-orchestrator
pre-steps:
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/application-id
var-name: AZURE_APPLICATION_ID
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/tenant
var-name: AZURE_TENANT
- secrethub/env-export:
secret-path: graviteeio/cicd/azure/application-secret
var-name: AZURE_APPLICATION_SECRET
requires:
- publish-images-azure-registry
- console-webui-publish-images-azure-registry
- portal-webui-publish-images-azure-registry
filters:
branches:
only:
- master
- /^\d+\.\d+\.x$/
- implement-continuous-deployment-to-azure
# ---
# The 2 Workflows Below are there for the CICD Orchestrator to be able to
# release Gravitee Kubernetes in an APIM release Process, with Docker executors instead of VMs
release:
when:
and:
- equal: [ release, << pipeline.parameters.gio_action >> ]
- not: << pipeline.parameters.dry_run >>
jobs:
- gravitee/d_release_secrets:
context: cicd-orchestrator
name: release_secrets_resolution
- gravitee/d_release:
name: maven_n_git_release
requires:
- release_secrets_resolution
dry_run: false
maven_profile_id: << pipeline.parameters.maven_profile_id >>
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
release_dry_run:
when:
and:
- equal: [ release, << pipeline.parameters.gio_action >> ]
- << pipeline.parameters.dry_run >>
jobs:
- gravitee/d_release_secrets:
context: cicd-orchestrator
name: release_secrets_resolution
- gravitee/d_release:
name: maven_n_git_release
requires:
- release_secrets_resolution
dry_run: true
maven_profile_id: << pipeline.parameters.maven_profile_id >>
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
# ---
# CICD Workflow For APIM Orchestrated Nexus Staging, Container-based : Circle CI Docker Executor
nexus_staging:
when:
equal: [ nexus_staging, << pipeline.parameters.gio_action >> ]
jobs:
- gravitee/d_nexus_staging_secrets:
context: cicd-orchestrator
name: nexus_staging_secrets_resolution
- gravitee/d_nexus_staging:
name: nexus_staging
requires:
- nexus_staging_secrets_resolution
dry_run: << pipeline.parameters.dry_run >>
maven_profile_id: << pipeline.parameters.maven_profile_id >>
# => If you are running a standalone release, your S3 Bucket name
# is 'prepared-standalone-nexus-staging-${GRAVITEE_REPO_NAME}-${RELEASE_VERSION_NUMBER}'
# => If you are running an Orchestrated release, The Orchestrator knows how to compute the S3 Bucket name
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
# ---
# The 6 Workflows Below are there to perform a "Standalone Release" and "replay" a "Standalone Release" :
# => independently of any APIM release Process, with Docker executors instead of VMs
# => with chained nexus staging : only when release with dry run mode off
standalone_release:
when:
and:
- equal: [ standalone_release, << pipeline.parameters.gio_action >> ]
- not: << pipeline.parameters.dry_run >>
jobs:
- gravitee/d_release_secrets:
context: cicd-orchestrator
name: release_secrets_resolution
- gravitee/d_standalone_release:
name: maven_n_git_release
requires:
- release_secrets_resolution
dry_run: false
maven_profile_id: << pipeline.parameters.maven_profile_id >>
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
standalone_release_dry_run:
when:
and:
- equal: [ standalone_release, << pipeline.parameters.gio_action >> ]
- << pipeline.parameters.dry_run >>
jobs:
- gravitee/d_release_secrets:
context: cicd-orchestrator
name: release_secrets_resolution
- gravitee/d_standalone_release:
name: maven_n_git_release
requires:
- release_secrets_resolution
dry_run: true
maven_profile_id: << pipeline.parameters.maven_profile_id >>
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
standalone_nexus_staging:
# ---
# Running the nexus staging makes sense only when the
# standalone release is being performed with dry run mode off
# That is to say, when the maven project is ready to be release to maven Staging
# ---
when:
and:
- equal: [ standalone_release, << pipeline.parameters.gio_action >> ]
- not: << pipeline.parameters.dry_run >>
# ---
# Running the nexus staging makes sense only when the
# standalone release is being performed with dry run mode off
# That is to say, when the maven project is ready to be release to mmaven Staging
# Never the less, to test the CICD system, I temporarily git pushed a different configuration
# ---
# when:
# equal: [ standalone_release, << pipeline.parameters.gio_action >> ]
jobs:
- gravitee/d_nexus_staging_secrets:
context: cicd-orchestrator
name: nexus_staging_secrets_resolution
- nexus_staging_dry_run_approval:
type: approval
requires:
- nexus_staging_secrets_resolution
- gravitee/d_standalone_nexus_staging:
name: standalone_nexus_staging_dry_run
requires:
- nexus_staging_dry_run_approval
# - nexus_staging_secrets_resolution
dry_run: true
# maven_profile_id: << pipeline.parameters.maven_profile_id >>
maven_profile_id: "gravitee-release"
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
- gravitee/d_standalone_nexus_staging:
name: standalone_nexus_staging
requires:
- standalone_nexus_staging_dry_run
# - nexus_staging_secrets_resolution
dry_run: false
# maven_profile_id: << pipeline.parameters.maven_profile_id >>
maven_profile_id: "gravitee-release"
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
standalone_release_replay:
when:
and:
- equal: [ standalone_release_replay, << pipeline.parameters.gio_action >> ]
- not: << pipeline.parameters.dry_run >>
jobs:
- gravitee/d_release_secrets:
context: cicd-orchestrator
name: release_secrets_resolution
- gravitee/d_standalone_release_replay:
name: maven_n_git_release
requires:
- release_secrets_resolution
dry_run: false
maven_profile_id: << pipeline.parameters.maven_profile_id >>
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
gio_release_version: << pipeline.parameters.replayed_release >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
standalone_release_replay_dry_run:
when:
and:
- equal: [ standalone_release_replay, << pipeline.parameters.gio_action >> ]
- << pipeline.parameters.dry_run >>
jobs:
- gravitee/d_release_secrets:
context: cicd-orchestrator
name: release_secrets_resolution
- gravitee/d_standalone_release_replay:
name: maven_n_git_release
requires:
- release_secrets_resolution
dry_run: true
maven_profile_id: << pipeline.parameters.maven_profile_id >>
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
gio_release_version: << pipeline.parameters.replayed_release >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
standalone_nexus_staging_replay:
# ---
# Running the nexus staging makes sense only when the
# standalone release is being performed with dry run mode off
# That is to say, when the maven project is ready to be release to maven Staging
# ---
when:
and:
- equal: [ standalone_release_replay, << pipeline.parameters.gio_action >> ]
- not: << pipeline.parameters.dry_run >>
# ---
# Running the nexus staging makes sense only when the
# standalone release is being performed with dry run mode off
# That is to say, when the maven project is ready to be release to mmaven Staging
# Never the less, to test the CICD system, I temporarily git pushed a different configuration
# ---
# when:
# equal: [ standalone_release, << pipeline.parameters.gio_action >> ]
jobs:
- gravitee/d_nexus_staging_secrets:
context: cicd-orchestrator
name: nexus_staging_secrets_resolution
- nexus_staging_replay_dry_run_approval:
type: approval
requires:
- nexus_staging_secrets_resolution
- gravitee/d_standalone_nexus_staging_replay:
name: standalone_nexus_staging_replay_dry_run
requires:
- nexus_staging_replay_dry_run_approval
# - nexus_staging_secrets_resolution
dry_run: true
# maven_profile_id: << pipeline.parameters.maven_profile_id >>
maven_profile_id: "gravitee-release"
s3_bucket_name: << pipeline.parameters.s3_bucket_name >>
gio_release_version: << pipeline.parameters.replayed_release >>
# container_gun_image_org: 'circleci'
# container_gun_image_name: 'openjdk'
# container_gun_image_tag: '11.0.3-jdk-stretch'
container_size: "large"
- gravitee/d_standalone_nexus_staging_replay:
name: standalone_nexus_staging_replay
requires:
- standalone_nexus_staging_replay_dry_run
# - nexus_staging_secrets_resolution
dry_run: false
# maven_profile_id: << pipeline.parameters.maven_profile_id >>