-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
189 lines (164 loc) · 4.08 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
include:
- local: airs/gitlab-ci.yaml
- local: common/gitlab-ci.yaml
- local: integrates/gitlab-ci.yaml
- local: melts/gitlab-ci.yaml
- local: observes/gitlab-ci.yaml
- local: reviews/gitlab-ci.yaml
- local: skims/gitlab-ci.yaml
- local: sorts/gitlab-ci.yaml
- local: docs/.gitlab-ci.yaml
- local: integrates/.gitlab-ci.yml
stages:
- rotation
- pre-build
- build
- lint-code
- test-code
- test-infra
- test-security
- merge-request
- deploy-infra
- deploy-app
- post-deploy
- analytics
- analytics-upload
- subscriptions
- external
- scheduler
workflow:
rules:
- when: always
.makes4: &makes4
image: ghcr.io/fluidattacks/makes:23.04
needs: []
interruptible: true
script:
- m . "${CI_JOB_NAME% *}"
variables:
GIT_DEPTH: 5
.common_in_mrs: &common_in_mrs
tags: [common-small]
rules:
- if: $CI_PIPELINE_SOURCE != "merge_request_event"
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
.common_in_dev_branch: &common_in_dev_branch
tags: [common-small]
rules:
- if: $CI_COMMIT_BRANCH == "trunk"
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "trigger"
when: never
- when: always
.common_rules_in_prod_branch: &common_rules_in_prod_branch
tags: [common-small]
rules:
- if: $CI_COMMIT_BRANCH != "trunk"
when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "trigger"
when: never
- when: always
.common_in_prod_branch: &common_in_prod_branch
<<: *common_rules_in_prod_branch
resource_group: ${CI_JOB_NAME}
.common_in_dev_and_prod: &common_in_dev_and_prod
tags: [common-small]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "trigger"
when: never
- when: always
/common/compute/schedule/test:
<<: [*makes4, *common_in_dev_branch]
stage: test-code
/common/status/check:
<<: [*makes4, *common_in_prod_branch]
stage: post-deploy
/formatBash:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
/formatNix:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
/formatPython:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
tags: [common-large]
/formatTerraform:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
/formatYaml:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
/lintBash:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
/lintGitCommitMsg:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
variables:
GIT_DEPTH: 0
/lintGitMailMap:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
/lintNix:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
sorts_extension:
<<: *common_in_dev_branch
allow_failure: true
image: ghcr.io/fluidattacks/sorts-extension:latest
interruptible: true
needs: []
script: sorts $PWD False 90
stage: lint-code
variables:
GIT_DEPTH: 20
/common/utils/license:
<<: [*makes4, *common_in_dev_branch]
stage: lint-code
script:
- m . /common/utils/license
/reviews:
<<: [*makes4, *common_in_mrs]
stage: merge-request
script:
- m . /reviews .reviews.toml
interruptible: false
common_forces:
<<: *common_in_prod_branch
stage: post-deploy
needs: []
image:
name: fluidattacks/forces:new
entrypoint: [""]
script:
- forces --token "${FORCES_API_TOKEN}" --strict -vv
interruptible: true
allow_failure: true
variables:
GIT_DEPTH: 5
common_sonarcloud_check:
<<: *common_in_dev_and_prod
interruptible: true
stage: external
needs: []
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
script:
- sonar-scanner
variables:
SONAR_HOST_URL: https://sonarcloud.io/
SONAR_USER_HOME: ${CI_PROJECT_DIR}/.sonar # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task