Skip to content

Commit

Permalink
SONARJAVA-5244 Onboard sonar-java on Develocity (#4963)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardo-pilastri-sonarsource authored Dec 18, 2024
1 parent 8a69039 commit ded14e9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
18 changes: 14 additions & 4 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ env:
ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa
ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token]
GITHUB_TOKEN: VAULT[development/github/token/licenses-ro token]
GRADLE_ENTERPRISE_USERNAME: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.username]
GRADLE_ENTERPRISE_PASSWORD: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.password]
GRADLE_ENTERPRISE_URL: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.url]
GRADLE_ENTERPRISE_KEY: VAULT[development/team/sonarqube/kv/data/gradle-enterprise data.access-key]
DEVELOCITY_TOKEN: VAULT[development/kv/data/develocity data.token]
DEVELOCITY_ACCESS_KEY: develocity.sonar.build=${DEVELOCITY_TOKEN}
# Use bash (instead of sh on linux or cmd.exe on windows)
CIRRUS_SHELL: bash
# Allows to run builds for the 50 last commits in a branch:
Expand Down Expand Up @@ -47,6 +45,10 @@ 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-.*")

log_develocity_url_script: &log_develocity_url_script |
echo "Develocity URL: https://develocity.sonar.build/scans?search.publicHostnames=cirrus-ci-task-${CIRRUS_TASK_ID}"


common_build_definition: &COMMON_BUILD_DEFINITION
eks_container:
<<: *CONTAINER_DEFINITION
Expand Down Expand Up @@ -82,13 +84,15 @@ orchestrator_cache_elements_definition: &ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION
build_task:
<<: *COMMON_BUILD_DEFINITION
build_script:
- *log_develocity_url_script
- source cirrus-env BUILD
- regular_mvn_build_deploy_analyze -Dmaven.test.skip=true -Dsonar.skip=true -pl '!java-checks-test-sources/default,!java-checks-test-sources/aws'
cleanup_before_cache_script: cleanup_maven_repository

test_analyze_task:
<<: *COMMON_BUILD_DEFINITION
build_script:
- *log_develocity_url_script
- source cirrus-env BUILD
# ignore duplications in the SE engine plugin, as it will be moved away from sonar-java at some point
- 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/**
Expand Down Expand Up @@ -128,6 +132,7 @@ qa_os_win_task:
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
build_script:
- *log_develocity_url_script
- source cirrus-env CI
- mvn.cmd clean verify
cleanup_before_cache_script: cleanup_maven_repository
Expand Down Expand Up @@ -157,6 +162,7 @@ plugin_qa_task:
submodules_script:
- git submodule update --init --recursive
qa_script:
- *log_develocity_url_script
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- cd its/plugin
Expand All @@ -175,6 +181,7 @@ sanity_task:
maven_cache:
folder: ${CIRRUS_WORKING_DIR}/.m2/repository
sanity_script:
- *log_develocity_url_script
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- cd java-checks-test-sources
Expand Down Expand Up @@ -205,6 +212,7 @@ ruling_task:
- PROFILE: without-sonarqube-project
- PROFILE: only-sonarqube-project
ruling_script:
- *log_develocity_url_script
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- cd its/ruling
Expand Down Expand Up @@ -232,6 +240,7 @@ ruling_win_task:
- PROFILE: without-sonarqube-project
- PROFILE: only-sonarqube-project
ruling_script:
- *log_develocity_url_script
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- init_git_submodules its/sources
Expand All @@ -258,6 +267,7 @@ autoscan_task:
orchestrator_LATEST_RELEASE_cache:
<<: *ORCHESTRATOR_CACHE_ELEMENTS_DEFINITION
autoscan_script:
- *log_develocity_url_script
- source cirrus-env QA
- source set_maven_build_version $BUILD_NUMBER
- cd java-checks-test-sources
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ Desktop.ini

.java-version
.mvn/.gradle-enterprise/gradle-enterprise-workspace-id
.mvn/.develocity/
13 changes: 13 additions & 0 deletions .mvn/develocity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<develocity>
<server>
<url>https://develocity.sonar.build</url>
</server>
<buildCache>
<local>
<storeEnabled>#{env['CI'] == null}</storeEnabled>
</local>
<remote>
<storeEnabled>#{env['CI'] != null}</storeEnabled>
</remote>
</buildCache>
</develocity>
4 changes: 2 additions & 2 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<extensions>
<extension>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<version>1.19.3</version>
<artifactId>develocity-maven-extension</artifactId>
<version>1.22.2</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
Expand Down
14 changes: 0 additions & 14 deletions .mvn/gradle-enterprise.xml

This file was deleted.

0 comments on commit ded14e9

Please sign in to comment.