Skip to content

Commit

Permalink
[NO JIRA] Improve CI performance by splitting build task into 'compil…
Browse files Browse the repository at this point in the history
…e' and 'test and analysis' (#4574)
  • Loading branch information
alban-auzeill authored Nov 24, 2023
1 parent c571291 commit e2bee08
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ win_vm_definition: &WINDOWS_VM_DEFINITION
only_sonarsource_qa: &ONLY_SONARSOURCE_QA
only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*")

build_task:
common_build_definition: &COMMON_BUILD_DEFINITION
eks_container:
<<: *CONTAINER_DEFINITION
image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j19-latest
Expand All @@ -61,15 +61,23 @@ build_task:
DEPLOY_PULL_REQUEST: true
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository

build_compile_task:
<<: *COMMON_BUILD_DEFINITION
build_script:
- source cirrus-env BUILD
- regular_mvn_build_deploy_analyze -Dsonar.analysisCache.enabled=true
- regular_mvn_build_deploy_analyze -Dmaven.test.skip=true -Dsonar.skip=true
cleanup_before_cache_script: cleanup_maven_repository

build_test_analyze_task:
<<: *COMMON_BUILD_DEFINITION
build_script:
- source cirrus-env BUILD
- PULL_REQUEST_SHA=$GIT_SHA1 regular_mvn_build_deploy_analyze -P-deploy-sonarsource,-release,-sign -Dmaven.deploy.skip=true -Dsonar.analysisCache.enabled=true
- ./check-license-compliance.sh
cleanup_before_cache_script: cleanup_maven_repository

ws_scan_task:
depends_on:
- build
<<: *ONLY_SONARSOURCE_QA
eks_container:
<<: *CONTAINER_DEFINITION
Expand All @@ -84,16 +92,14 @@ ws_scan_task:
whitesource_script:
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- mvn clean install -DskipTests -pl '!java-checks-test-sources,!java-checks-test-sources/default,!java-checks-test-sources/aws'
- mvn clean install -Dmaven.test.skip=true -pl '!java-checks-test-sources,!java-checks-test-sources/default,!java-checks-test-sources/aws'
- source ws_scan.sh
allow_failures: "true"
always:
ws_artifacts:
path: "whitesource/**/*"

qa_os_win_task:
depends_on:
- build
<<: *WINDOWS_VM_DEFINITION
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
Expand All @@ -104,7 +110,7 @@ qa_os_win_task:

plugin_qa_task:
depends_on:
- build
- build_compile
<<: *ONLY_SONARSOURCE_QA
eks_container:
<<: *CONTAINER_DEFINITION
Expand All @@ -129,7 +135,7 @@ plugin_qa_task:

sanity_task:
depends_on:
- build
- build_compile
<<: *ONLY_SONARSOURCE_QA
eks_container:
<<: *CONTAINER_DEFINITION
Expand All @@ -147,7 +153,7 @@ sanity_task:

ruling_task:
depends_on:
- build
- build_compile
<<: *ONLY_SONARSOURCE_QA
eks_container:
<<: *CONTAINER_DEFINITION
Expand Down Expand Up @@ -175,7 +181,7 @@ ruling_task:

ruling_win_task:
depends_on:
- build
- build_compile
<<: *ONLY_SONARSOURCE_QA
<<: *WINDOWS_VM_DEFINITION
maven_cache:
Expand All @@ -196,7 +202,7 @@ ruling_win_task:

autoscan_task:
depends_on:
- build
- build_compile
<<: *ONLY_SONARSOURCE_QA
eks_container:
<<: *CONTAINER_DEFINITION
Expand All @@ -218,6 +224,8 @@ autoscan_task:

promote_task:

Check warning on line 225 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L225

task "promote" depends on task "ws_scan", but their only_if conditions are different

Check warning on line 225 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L225

task "promote" depends on task "ws_scan", but their only_if conditions are different
depends_on:
- build_compile
- build_test_analyze
- qa_os_win
- sanity
- ruling
Expand Down

0 comments on commit e2bee08

Please sign in to comment.