-
Notifications
You must be signed in to change notification settings - Fork 19
/
.cirrus.yml
239 lines (214 loc) · 7.87 KB
/
.cirrus.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
env:
CIRRUS_VAULT_URL: https://vault.sonar.build:8200
CIRRUS_VAULT_AUTH_PATH: jwt-cirrusci
CIRRUS_VAULT_ROLE: cirrusci-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}
ARTIFACTORY_URL: VAULT[development/kv/data/repox data.url]
ARTIFACTORY_PRIVATE_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader
ARTIFACTORY_PRIVATE_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
# Deploy public artifact to artifactory
ARTIFACTORY_DEPLOY_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer
ARTIFACTORY_DEPLOY_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token]
ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa
ORG_GRADLE_PROJECT_signingKey: VAULT[development/kv/data/sign data.key]
ORG_GRADLE_PROJECT_signingPassword: VAULT[development/kv/data/sign data.passphrase]
ORG_GRADLE_PROJECT_signingKeyId: 0x7DCD4258
# Use bash (instead of sh on linux or cmd.exe on windows)
CIRRUS_SHELL: bash
GIT_SUB_MODULE: ""
GRADLE_USER_HOME: ${CIRRUS_WORKING_DIR}/.gradle
linux_image_template: &LINUX_IMAGE
image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-g8-latest
cluster_name: ${CIRRUS_CLUSTER_NAME}
region: eu-central-1
namespace: default
use_in_memory_disk: true
linux_1_cpu_1G_template: &LINUX_1_CPU_1G
eks_container:
<<: *LINUX_IMAGE
cpu: 1
memory: 1G
linux_3_5_cpu_7G_template: &LINUX_3_5_CPU_7G
eks_container:
<<: *LINUX_IMAGE
cpu: 3.5
memory: 12G # TODO: decrease back to 7G when we fix the memory issues with the Gradle scanner
linux_6_cpu_12G_java_17_template: &LINUX_6_CPU_12G_JAVA_17
eks_container:
<<: *LINUX_IMAGE
image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-g8-latest
cpu: 6
memory: 24G
windows_16_cpu_32G_template: &WINDOWS_16_CPU_32G
ec2_instance:
experimental: true # see https://github.com/cirruslabs/cirrus-ci-docs/issues/1051
image: base-windows-jdk17-v*
platform: windows
region: eu-central-1
type: c5.4xlarge # 3.6 GHz (3.9GHz single core) Intel Xeon Scalable Processor, 16 vCPU, 32 GiB Memory
preemptible: false
use_ssd: true
setup_gradle_cache_template: &SETUP_GRADLE_CACHE
gradle_cache:
folder: .gradle/caches
create_gradle_directory_script:
- mkdir -p "${CIRRUS_WORKING_DIR}/.gradle"
cleanup_gradle_cache_script_template: &CLEANUP_GRADLE_CACHE_SCRIPT
cleanup_gradle_script:
- /usr/bin/find "${CIRRUS_WORKING_DIR}/.gradle/caches/" -name "*.lock" -type f -delete
- rm -rf "${CIRRUS_WORKING_DIR}/.gradle/caches/4.10.2/"
- rm -rf "${CIRRUS_WORKING_DIR}/.gradle/caches/journal-1/"
- rm -rf "${CIRRUS_WORKING_DIR}/.gradle/caches/build-cache-1/"
gradle_its_template: &GRADLE_ITS_TEMPLATE
<<: *SETUP_GRADLE_CACHE
run_its_script:
- |
if [ -n "${GIT_SUB_MODULE}" ]; then
git submodule update --init --depth 1 "${GIT_SUB_MODULE}"
fi
- source cirrus-env QA
- ./gradlew "${GRADLE_TASK}" "-P${ITS_PROJECT}"
"-Dsonar.runtimeVersion=${SQ_VERSION}"
"-DbuildNumber=$BUILD_NUMBER"
--info --console plain --no-daemon --build-cache
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
only_if_sonarsource_qa_template: &ONLY_IF_SONARSOURCE_QA
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*")
qa_task_filter_template: &QA_TASK_FILTER
depends_on:
- build
<<: *ONLY_IF_SONARSOURCE_QA
build_task:
<<: *LINUX_3_5_CPU_7G
<<: *SETUP_GRADLE_CACHE
env:
# analysis on next
SONAR_TOKEN: VAULT[development/kv/data/next data.token]
SONAR_HOST_URL: https://next.sonarqube.com/sonarqube
#allow deployment of pull request artifacts to repox
DEPLOY_PULL_REQUEST: true
build_script:
- source cirrus-env BUILD-PRIVATE
- regular_gradle_build_deploy_analyze -x test -x sonar
on_failure:
error_log_artifacts:
path: "hs_err_pid*.log"
heap_dump_artifacts:
path: "*.hprof"
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
build_test_analyze_task:
<<: *LINUX_3_5_CPU_7G
<<: *SETUP_GRADLE_CACHE
env:
# analysis on next
SONAR_TOKEN: VAULT[development/kv/data/next data.token]
SONAR_HOST_URL: https://next.sonarqube.com/sonarqube
#allow deployment of pull request artifacts to repox
DEPLOY_PULL_REQUEST: true
build_script:
- source cirrus-env BUILD-PRIVATE
- regular_gradle_build_deploy_analyze -x artifactoryPublish
on_failure:
error_log_artifacts:
path: "hs_err_pid*.log"
heap_dump_artifacts:
path: "*.hprof"
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
ws_scan_task:
<<: *LINUX_3_5_CPU_7G
<<: *SETUP_GRADLE_CACHE
depends_on:
- build
# run only on master, long-term branches and mend-related branches
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && ($CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "mend-.*")
env:
WS_APIKEY: VAULT[development/kv/data/mend data.apikey]
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
whitesource_script:
- source cirrus-env QA
- ./gradlew clean assemble
- source ./export_ws_variables.sh
- source ws_scan.sh
allow_failures: "true"
always:
ws_artifacts:
path: "whitesource/**/*"
# --- WARNING --- WARNING --- WARNING --- WARNING --- WARNING --- WARNING ---
# The following task names should all be included in promote_task/depends_on
# ---------------------------------------------------------------------------
qa_plug_pub_lin_task:
<<: *QA_TASK_FILTER
env:
ITS_PROJECT: "plugin"
GRADLE_TASK: ":its:plugin:test"
matrix:
- SQ_VERSION: "DEV"
- SQ_VERSION: "LATEST_RELEASE[9.9]"
- SQ_VERSION: "LATEST_RELEASE"
<<: *LINUX_6_CPU_12G_JAVA_17
<<: *GRADLE_ITS_TEMPLATE
qa_plug_pub_win_task:
<<: *QA_TASK_FILTER
env:
SQ_VERSION: LATEST_RELEASE[9.9]
GRADLE_TASK: ":its:plugin:test"
ITS_PROJECT: "plugin"
<<: *WINDOWS_16_CPU_32G
<<: *GRADLE_ITS_TEMPLATE
qa_ruling_kotlin_task:
<<: *QA_TASK_FILTER
env:
SQ_VERSION: "LATEST_RELEASE"
GRADLE_TASK: ":its:ruling:test"
ITS_PROJECT: "ruling"
GIT_SUB_MODULE: "its/sources"
<<: *LINUX_6_CPU_12G_JAVA_17
<<: *GRADLE_ITS_TEMPLATE
qa_ruling_kotlin_compiler_task:
<<: *QA_TASK_FILTER
env:
KOTLIN_COMPILER_IT_ENABLED: "true"
SQ_VERSION: "LATEST_RELEASE"
GIT_SUB_MODULE: "its/sources"
<<: *LINUX_6_CPU_12G_JAVA_17
<<: *SETUP_GRADLE_CACHE
run_its_script:
- |
if [ -n "${GIT_SUB_MODULE}" ]; then
git submodule update --init --depth 1 "${GIT_SUB_MODULE}"
fi
- source cirrus-env QA
- ./gradlew :its:ruling:test --tests "org.sonarsource.slang.SlangRulingTest.test_kotlin_compiler" -Pruling
"-Dsonar.runtimeVersion=${SQ_VERSION}"
"-DbuildNumber=$BUILD_NUMBER"
--info --console plain --no-daemon --build-cache
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
build_win_task:
<<: *QA_TASK_FILTER
<<: *WINDOWS_16_CPU_32G
<<: *SETUP_GRADLE_CACHE
build_script:
- ./gradlew build --info --console plain --no-daemon --build-cache
on_failure:
error_log_artifacts:
path: "hs_err_pid*.log"
heap_dump_artifacts:
path: "*.hprof"
<<: *CLEANUP_GRADLE_CACHE_SCRIPT
promote_task:
depends_on:
- build
- build_test_analyze
- qa_plug_pub_lin
- qa_plug_pub_win
- qa_ruling_kotlin
- qa_ruling_kotlin_compiler
- build_win
- ws_scan
<<: *ONLY_IF_SONARSOURCE_QA
<<: *LINUX_3_5_CPU_7G
env:
ARTIFACTORY_PROMOTE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token]
GITHUB_TOKEN: VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token]
script: cirrus_promote_gradle multi