-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
147 lines (125 loc) · 3.54 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
stages:
- build
- test
- release # push all release artifacts
- deploy-dev # deploy to the dev cluster
include:
- local: 'ci/templates/helm/helm.gitlab-ci.yml'
- local: 'ci/templates/bazel/bazel.gitlab-ci.yml'
bazel-fetch:
extends: .bazel-job
stage: build
script:
- bazel fetch //...
.bazel-test-job-base:
extends: .bazel-test-job
needs:
- "bazel-fetch"
bazel-unit-test:
extends: .bazel-test-job-base
script:
# find all testing targets with the name "unit-tests"
- bazel query 'attr(name, "unit-tests", tests(//...))' | xargs bazel test
bazel-integration-test:
extends: .bazel-test-job-base
script:
# find all testing targets with the name "int-tests"
- bazel query 'attr(name, "int-tests", tests(//...))' | xargs ./scripts/bazel-test-dotenv.sh $ENV_FILE
bazel-lint:
extends: .bazel-test-job-base
script:
# find all testing targets with the name "lint"
- bazel query 'attr(name, "lint", tests(//...))' | xargs bazel test
## Helm Charts
chart-repo-build:
extends: .helm-repo-build
variables:
CHART_DIR: charts/ff-virtual-2020
needs: [] # can be started immediately
lint-charts:
extends: .helm-repo-lint
variables:
CHART_DIRS: "charts/ff-virtual-2020"
needs:
- "chart-repo-build"
## Artifact Releasing
artifacts-store-top-speed:
extends: .bazel-artifacts-store
variables:
S3_DIR: "fts-ff-virtual-2020-artifacts/top_speed"
TARGET: "//top_speed/src/main/java/com/fintechstudios/ff_virtual_2020/top_speed:top_speed_deploy.jar"
ARTIFACT: "top_speed/src/main/java/com/fintechstudios/ff_virtual_2020/top_speed/top_speed_deploy.jar"
## Chart Deploy
## Infrastructure
.infrastructure:
variables:
RELEASE_NAME: "ff-virtual-2020-top-speed-infra"
CHART_DIR: "charts/ff-virtual-2020"
CHART_NAME: "infrastructure"
KUBE_NAMESPACE: "ff-virtual-2020"
only:
changes:
# no application code, just Chart resources
- charts/ff-virtual-2020/infrastructure/**/*
- ci/templates/**/*
deploy-infrastructure-dev:
extends:
- .helm-deploy-dev
- .infrastructure
needs:
# since no code, just wait for everything in the test stage,
# but skip the artifact uploading release stage
- "bazel-integration-test"
- "bazel-unit-test"
- "bazel-lint"
- "lint-charts"
rollback-infrastructure-dev:
extends:
- .helm-rollback-dev
- .infrastructure
## Not shooting for production in this demo!
#
#deploy-infrastructure-prod:
# extends:
# - .helm-rollback-prod
# - .infrastructure
# needs:
# - "deploy-infrastructure-dev"
#
#rollback-infrastructure-prod:
# extends:
# - .helm-rollback-prod
# - .infrastructure
# needs:
# # until can depend on job in same stage: https://gitlab.com/gitlab-org/gitlab/issues/30632
# - "deploy-infrastructure-dev"
## Top Speed
.top-speed:
variables:
CHART_DIR: "charts/ff-virtual-2020"
CHART_NAME: "top-speed"
KUBE_NAMESPACE: "ff-virtual-2020"
RELEASE_NAME: "ff-virtual-2020-top-speed"
only:
changes:
- charts/ff-virtual-2020/top-speed/**/*
- ci/templates/**/*
- scripts/**/*
- WORKSPACE
- top_speed/**/*
.top-speed-deploy:
extends: .top-speed
before_script:
# use the artifact from this commit
# as the deployment artifact
- export HELM_UPGRADE_EXTRA_ARGS="--set artifactJarUri=s3://fts-ff-virtual-2020-artifacts/top_speed/$CI_COMMIT_SHA.jar"
deploy-top-speed-dev:
extends:
- .helm-deploy-dev
- .top-speed
needs:
- "artifacts-store-top-speed"
rollback-top-speed-dev:
extends:
- .helm-rollback-dev
- .top-speed