|
1 | 1 | env: |
2 | | - CIRRUS_VAULT_URL: https://vault.sonar.build:8200 |
3 | | - CIRRUS_VAULT_AUTH_PATH: jwt-cirrusci |
4 | | - CIRRUS_VAULT_ROLE: cirrusci-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME} |
| 2 | + CIRRUS_CLONE_DEPTH: 20 |
5 | 3 | ARTIFACTORY_URL: VAULT[development/kv/data/repox data.url] |
6 | | - ARTIFACTORY_PRIVATE_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader |
| 4 | + ARTIFACTORY_PRIVATE_USERNAME: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader username] |
7 | 5 | ARTIFACTORY_PRIVATE_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token] |
8 | 6 | ARTIFACTORY_DEPLOY_USERNAME: vault-${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer |
9 | 7 | ARTIFACTORY_DEPLOY_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token] |
10 | 8 | #Possible values for ARTIFACTORY_DEPLOY_REPO: sonarsource-private-qa, sonarsource-public-qa |
11 | 9 | ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa |
12 | 10 | ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token] |
13 | | - GITHUB_TOKEN: VAULT[development/github/token/licenses-ro token] |
14 | | - DEVELOCITY_TOKEN: VAULT[development/kv/data/develocity data.token] |
15 | | - DEVELOCITY_ACCESS_KEY: develocity.sonar.build=${DEVELOCITY_TOKEN} |
16 | 11 | # Use bash (instead of sh on linux or cmd.exe on windows) |
17 | 12 | CIRRUS_SHELL: bash |
18 | | - # Allows to run builds for the 50 last commits in a branch: |
19 | | - CIRRUS_CLONE_DEPTH: 50 |
20 | 13 |
|
21 | 14 | container_definition: &CONTAINER_DEFINITION |
| 15 | + image: "${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest" |
22 | 16 | cluster_name: ${CIRRUS_CLUSTER_NAME} |
23 | 17 | region: eu-central-1 |
24 | 18 | namespace: default |
25 | | - nodeSelectorTerms: |
26 | | - - matchExpressions: |
27 | | - - key: node.kubernetes.io/instance-type |
28 | | - operator: In |
29 | | - values: |
30 | | - - m6a.8xlarge # 3.6 GHz 3rd generation AMD EPYC processors (AMD EPYC 7R13), 18 vCPU, 64 GiB Memory |
31 | | - |
32 | | -container_with_docker_definition: &CONTAINER_WITH_DOCKER_DEFINITION |
33 | | - <<: *CONTAINER_DEFINITION |
34 | | - dockerfile: .cirrus/Dockerfile.jdk17AndLatest |
35 | | - builder_role: cirrus-builder |
36 | | - builder_image: docker-builder-v* |
37 | | - builder_instance_type: t3.small |
38 | | - |
39 | | -win_vm_definition: &WINDOWS_VM_DEFINITION |
40 | | - experimental: true # see https://github.com/cirruslabs/cirrus-ci-docs/issues/1051 |
41 | | - platform: windows |
42 | | - region: eu-central-1 |
43 | | - type: c5.4xlarge # 3.6 GHz (3.9GHz single core) Intel Xeon Scalable Processor, 16 vCPU, 32 GiB Memory |
44 | 19 |
|
45 | 20 | only_sonarsource_qa: &ONLY_SONARSOURCE_QA |
46 | | - only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*") |
| 21 | + only_if: ${CIRRUS_USER_COLLABORATOR} == 'true' && ${CIRRUS_TAG} == "" && (${CIRRUS_PR} != "" || ${CIRRUS_BRANCH} == "master" || ${CIRRUS_BRANCH} =~ "branch-.*" || ${CIRRUS_BRANCH} =~ "dogfood-on-.*") |
47 | 22 |
|
48 | | -log_develocity_url_script: &log_develocity_url_script | |
49 | | - echo "Develocity URL: https://develocity.sonar.build/scans?search.publicHostnames=cirrus-ci-task-${CIRRUS_TASK_ID}" |
50 | | - |
51 | | - |
52 | | -common_build_definition: &COMMON_BUILD_DEFINITION |
| 23 | +build_task: |
53 | 24 | eks_container: |
54 | 25 | <<: *CONTAINER_DEFINITION |
55 | | - image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j23-latest |
56 | 26 | cpu: 4 |
57 | 27 | memory: 4G |
58 | 28 | env: |
59 | | - SIGN_KEY: VAULT[development/kv/data/sign data.key] |
60 | | - PGP_PASSPHRASE: VAULT[development/kv/data/sign data.passphrase] |
61 | 29 | # analysis on next |
62 | 30 | SONAR_TOKEN: VAULT[development/kv/data/next data.token] |
63 | 31 | SONAR_HOST_URL: https://next.sonarqube.com/sonarqube |
64 | 32 | #allow deployment of pull request artifacts to repox |
65 | 33 | DEPLOY_PULL_REQUEST: true |
| 34 | + # signing artifacts |
| 35 | + SIGN_KEY: VAULT[development/kv/data/sign data.key] |
| 36 | + PGP_PASSPHRASE: VAULT[development/kv/data/sign data.passphrase] |
66 | 37 | maven_cache: |
67 | 38 | folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
68 | | - |
69 | | -orchestrator_cache_preparation_definition: &ORCHESTRATOR_CACHE_PREPARATION_DEFINITION |
70 | | - set_orchestrator_home_script: | |
71 | | - export TODAY=$(date '+%Y-%m-%d') |
72 | | - echo "TODAY=${TODAY}" >> $CIRRUS_ENV |
73 | | - echo "ORCHESTRATOR_HOME=${CIRRUS_WORKING_DIR}/orchestrator/${TODAY}" >> $CIRRUS_ENV |
74 | | - mkdir_orchestrator_home_script: | |
75 | | - echo "Create dir ${ORCHESTRATOR_HOME} if needed" |
76 | | - mkdir -p ${ORCHESTRATOR_HOME} |
77 | | -
|
78 | | -orchestrator_cache_elements_definition: &ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
79 | | - folder: ${ORCHESTRATOR_HOME} |
80 | | - fingerprint_script: echo ${TODAY} |
81 | | - reupload_on_changes: "true" |
82 | | - |
83 | | -# Only compile without "test and sonar:sonar". Note: Do not rename "build", it is used by "Check Releasability" |
84 | | -build_task: |
85 | | - <<: *COMMON_BUILD_DEFINITION |
86 | | - build_script: |
87 | | - - *log_develocity_url_script |
88 | | - - source cirrus-env BUILD |
89 | | - - regular_mvn_build_deploy_analyze -Dmaven.test.skip=true -Dsonar.skip=true -pl '!java-checks-test-sources/default,!java-checks-test-sources/aws,!java-checks-test-sources/spring-web-4.0' |
90 | | - cleanup_before_cache_script: cleanup_maven_repository |
91 | | - |
92 | | -test_analyze_task: |
93 | | - <<: *COMMON_BUILD_DEFINITION |
94 | 39 | build_script: |
95 | | - - *log_develocity_url_script |
96 | 40 | - source cirrus-env BUILD |
97 | | - # ignore duplications in the SE engine plugin, as it will be moved away from sonar-java at some point |
98 | | - - PULL_REQUEST_SHA=$GIT_SHA1 regular_mvn_build_deploy_analyze -P-deploy-sonarsource,-release,-sign -Dmaven.deploy.skip=true -Dsonar.analysisCache.enabled=true -Dsonar.cpd.exclusions=java-symbolic-execution/** -Dsonar.sca.exclusions="**/test/files/**, **/test/resources/**, its/plugin/projects/**, java-checks-test-sources/**, its/sources/**," |
99 | | - - cd docs/java-custom-rules-example |
100 | | - - mvn clean package -f pom_SQ_10_6_LATEST.xml --batch-mode |
101 | | - - cd "${CIRRUS_WORKING_DIR}" |
102 | | - - ./check-license-compliance.sh |
103 | | - cleanup_before_cache_script: cleanup_maven_repository |
104 | | - |
105 | | -ws_scan_task: |
106 | | - <<: *ONLY_SONARSOURCE_QA |
107 | | - eks_container: |
108 | | - <<: *CONTAINER_DEFINITION |
109 | | - image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest |
110 | | - cpu: 4 |
111 | | - memory: 4G |
112 | | - # run only on master and long-term branches |
113 | | - only_if: $CIRRUS_USER_COLLABORATOR == 'true' && ($CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "mend-.*") |
114 | | - env: |
115 | | - WS_APIKEY: VAULT[development/kv/data/mend data.apikey] |
116 | | - maven_cache: |
117 | | - folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
118 | | - whitesource_script: |
119 | | - - source cirrus-env QA |
120 | | - - source set_maven_build_version $BUILD_NUMBER |
121 | | - - mvn clean install --batch-mode -Dmaven.test.skip=true -pl '!java-checks-test-sources,!java-checks-test-sources/default,!java-checks-test-sources/aws,!java-checks-test-sources/spring-3.2,!java-checks-test-sources/spring-web-4.0' |
122 | | - - source ws_scan.sh |
123 | | - allow_failures: "true" |
124 | | - always: |
125 | | - ws_artifacts: |
126 | | - path: "whitesource/**/*" |
127 | | - |
128 | | -qa_os_win_task: |
129 | | - ec2_instance: |
130 | | - image: base-windows-jdk21-v* |
131 | | - <<: *WINDOWS_VM_DEFINITION |
132 | | - maven_cache: |
133 | | - folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
134 | | - java_download_cache: |
135 | | - folder: ${CIRRUS_WORKING_DIR}/.java_download_cache |
136 | | - build_script: |
137 | | - - *log_develocity_url_script |
138 | | - - source cirrus-env CI |
139 | | - - ps: .cirrus/install-latest-java-on-windows.ps1 ; if ($?) { & mvn.cmd --batch-mode clean verify } |
140 | | - cleanup_before_cache_script: cleanup_maven_repository |
141 | | - |
142 | | -plugin_qa_task: |
143 | | - depends_on: |
144 | | - - build |
145 | | - <<: *ONLY_SONARSOURCE_QA |
146 | | - eks_container: |
147 | | - <<: *CONTAINER_DEFINITION |
148 | | - image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest |
149 | | - cpu: 14 |
150 | | - memory: 8G |
151 | | - <<: *ORCHESTRATOR_CACHE_PREPARATION_DEFINITION |
152 | | - matrix: |
153 | | - - env: |
154 | | - SQ_VERSION: LATEST_RELEASE |
155 | | - orchestrator_LATEST_RELEASE_cache: |
156 | | - <<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
157 | | - - env: |
158 | | - SQ_VERSION: DEV |
159 | | - orchestrator_DEV_cache: |
160 | | - <<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
161 | | - |
162 | | - maven_cache: |
163 | | - folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
164 | | - submodules_script: |
165 | | - - git submodule update --init --recursive |
166 | | - qa_script: |
167 | | - - *log_develocity_url_script |
168 | | - - source cirrus-env QA |
169 | | - - source set_maven_build_version $BUILD_NUMBER |
170 | | - - cd its/plugin |
171 | | - - mvn package --batch-mode -Pit-plugin -Dsonar.runtimeVersion=${SQ_VERSION} -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=classes -DuseUnlimitedThreads=true |
| 41 | + - regular_mvn_build_deploy_analyze |
172 | 42 | cleanup_before_cache_script: cleanup_maven_repository |
173 | 43 |
|
174 | | -sanity_task: |
175 | | - depends_on: |
176 | | - - build |
177 | | - <<: *ONLY_SONARSOURCE_QA |
178 | | - eks_container: |
179 | | - <<: *CONTAINER_DEFINITION |
180 | | - image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j23-latest |
181 | | - cpu: 4 |
182 | | - memory: 4G |
183 | | - maven_cache: |
184 | | - folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
185 | | - sanity_script: |
186 | | - - *log_develocity_url_script |
187 | | - - source cirrus-env QA |
188 | | - - source set_maven_build_version $BUILD_NUMBER |
189 | | - - cd java-checks-test-sources |
190 | | - - mvn clean compile --batch-mode |
191 | | - - cd ../ |
192 | | - - mvn verify --batch-mode -f sonar-java-plugin/pom.xml -Psanity -Dtest=SanityTest |
193 | | - cleanup_before_cache_script: cleanup_maven_repository |
194 | | - |
195 | | -ruling_task: |
196 | | - depends_on: |
197 | | - - build |
198 | | - <<: *ONLY_SONARSOURCE_QA |
199 | | - eks_container: |
200 | | - <<: *CONTAINER_DEFINITION |
201 | | - image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest |
202 | | - cpu: 14 |
203 | | - memory: 8G |
204 | | - maven_cache: |
205 | | - folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
206 | | - <<: *ORCHESTRATOR_CACHE_PREPARATION_DEFINITION |
207 | | - orchestrator_LATEST_RELEASE_cache: |
208 | | - <<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
209 | | - submodules_script: |
210 | | - - git submodule update --init --recursive |
211 | | - env: |
212 | | - MAVEN_OPTS: "-Xmx3g" |
213 | | - matrix: |
214 | | - - PROFILE: without-sonarqube-project |
215 | | - - PROFILE: only-sonarqube-project |
216 | | - ruling_script: |
217 | | - - *log_develocity_url_script |
218 | | - - source cirrus-env QA |
219 | | - - source set_maven_build_version $BUILD_NUMBER |
220 | | - - cd its/ruling |
221 | | - - mvn package --batch-mode "-Pit-ruling,$PROFILE" -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true |
222 | | - cleanup_before_cache_script: cleanup_maven_repository |
223 | | - on_failure: |
224 | | - actual_artifacts: |
225 | | - path: "${CIRRUS_WORKING_DIR}/its/ruling/target/actual/**/*" |
226 | | - |
227 | | -ruling_win_task: |
228 | | - depends_on: |
229 | | - - build |
230 | | - <<: *ONLY_SONARSOURCE_QA |
231 | | - ec2_instance: |
232 | | - image: base-windows-jdk17-v* |
233 | | - <<: *WINDOWS_VM_DEFINITION |
234 | | - maven_cache: |
235 | | - folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
236 | | - <<: *ORCHESTRATOR_CACHE_PREPARATION_DEFINITION |
237 | | - orchestrator_LATEST_RELEASE_cache: |
238 | | - <<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
239 | | - env: |
240 | | - MAVEN_OPTS: "-Xmx3g" |
241 | | - matrix: |
242 | | - - PROFILE: without-sonarqube-project |
243 | | - - PROFILE: only-sonarqube-project |
244 | | - ruling_script: |
245 | | - - *log_develocity_url_script |
246 | | - - source cirrus-env QA |
247 | | - - source set_maven_build_version $BUILD_NUMBER |
248 | | - - init_git_submodules its/sources |
249 | | - - git submodule update --init --recursive |
250 | | - - cd its/ruling |
251 | | - - mvn package --batch-mode "-Pit-ruling,$PROFILE" -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -B -e -V -Dparallel=methods -DuseUnlimitedThreads=true |
252 | | - cleanup_before_cache_script: cleanup_maven_repository |
253 | | - |
254 | | -autoscan_task: |
255 | | - depends_on: |
256 | | - - build |
257 | | - <<: *ONLY_SONARSOURCE_QA |
258 | | - eks_container: |
259 | | - <<: *CONTAINER_WITH_DOCKER_DEFINITION |
260 | | - # For now, this autoscan_task need to execute two mvn commands: |
261 | | - # * The build of java-checks-test-sources module which requires Java 23. |
262 | | - # * The tests using Orchestrator and SonarQube that, for now, fail to work using Java 23 |
263 | | - # This is why we have a local Dockerfile that provide the 2 versions of Java, 17 and 23. |
264 | | - cpu: 14 |
265 | | - memory: 8G |
266 | | - maven_cache: |
267 | | - folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
268 | | - <<: *ORCHESTRATOR_CACHE_PREPARATION_DEFINITION |
269 | | - orchestrator_LATEST_RELEASE_cache: |
270 | | - <<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
271 | | - autoscan_script: |
272 | | - - *log_develocity_url_script |
273 | | - - source cirrus-env QA |
274 | | - - source set_maven_build_version $BUILD_NUMBER |
275 | | - - cd java-checks-test-sources |
276 | | - - JAVA_HOME="${JAVA_LATEST_HOME}" mvn clean compile test-compile --batch-mode |
277 | | - - cd ../its/autoscan |
278 | | - - mvn clean package --batch-mode --errors --show-version --activate-profiles it-autoscan -Dsonar.runtimeVersion=LATEST_RELEASE -Dmaven.test.redirectTestOutputToFile=false -Dparallel=methods -DuseUnlimitedThreads=true |
279 | | - cleanup_before_cache_script: cleanup_maven_repository |
280 | | - on_failure: |
281 | | - actual_artifacts: |
282 | | - path: "${CIRRUS_WORKING_DIR}/its/autoscan/target/actual/**/*" |
283 | | - |
284 | 44 | promote_task: |
285 | 45 | depends_on: |
286 | 46 | - build |
287 | | - - test_analyze |
288 | | - - qa_os_win |
289 | | - - sanity |
290 | | - - ruling |
291 | | - - ruling_win |
292 | | - - plugin_qa |
293 | | - - ws_scan |
294 | | - - autoscan |
295 | 47 | <<: *ONLY_SONARSOURCE_QA |
296 | 48 | eks_container: |
297 | 49 | <<: *CONTAINER_DEFINITION |
298 | | - image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest |
299 | 50 | cpu: 2 |
300 | 51 | memory: 1G |
301 | 52 | env: |
302 | | - #promotion cloud function |
303 | 53 | ARTIFACTORY_PROMOTE_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promoter access_token] |
304 | | - GITHUB_TOKEN: VAULT[development/github/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-promotion token] |
305 | 54 | maven_cache: |
306 | 55 | folder: ${CIRRUS_WORKING_DIR}/.m2/repository |
307 | | - script: cirrus_promote_maven |
308 | | - cleanup_before_cache_script: cleanup_maven_repository |
309 | | - |
310 | | -# This task can be used to debug the cache content |
311 | | -inspect_orchestrator_cache_task: |
312 | | - <<: *ONLY_SONARSOURCE_QA |
313 | | - depends_on: ruling # To improve cache usage we should introduce a task to warm the cache. |
314 | | - trigger_type: manual |
315 | | - eks_container: |
316 | | - <<: *CONTAINER_WITH_DOCKER_DEFINITION |
317 | | - cpu: 1 |
318 | | - memory: 1G |
319 | | - <<: *ORCHESTRATOR_CACHE_PREPARATION_DEFINITION |
320 | | - matrix: |
321 | | - - orchestrator_LATEST_RELEASE_cache: |
322 | | - <<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
323 | | - - orchestrator_DEV_cache: |
324 | | - <<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION |
325 | | - inspect_cache_script: | |
326 | | - echo "Inspecting cache ${ORCHESTRATOR_HOME}..." |
327 | | - cd "${ORCHESTRATOR_HOME}" |
328 | | - ls -l |
329 | | - find . -ls |
330 | | - echo "Inspecting cache done." |
| 56 | + main_script: cirrus_promote_maven |
| 57 | + cleanup_before_cache_script: cleanup_maven_repository |
0 commit comments