From 5d1ae0cdb43a1f1e6eeb410779e4fa551e582856 Mon Sep 17 00:00:00 2001 From: Leonardo Pilastri Date: Tue, 24 Dec 2024 16:01:52 +0100 Subject: [PATCH 1/2] SCANGRADLE-193 Onboard Develocity --- .cirrus.yml | 8 ++++++++ settings.gradle.kts | 27 +++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 8cbe0d6d..d83e26c5 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -10,6 +10,8 @@ env: ARTIFACTORY_DEPLOY_PASSWORD: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-qa-deployer access_token] ARTIFACTORY_ACCESS_TOKEN: VAULT[development/artifactory/token/${CIRRUS_REPO_OWNER}-${CIRRUS_REPO_NAME}-private-reader access_token] ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa + DEVELOCITY_TOKEN: VAULT[development/kv/data/develocity data.token] + DEVELOCITY_ACCESS_KEY: develocity.sonar.build=${DEVELOCITY_TOKEN} GITHUB_TOKEN: VAULT[development/github/token/licenses-ro token] @@ -51,6 +53,9 @@ setup_gradle_cache_template: &SETUP_GRADLE_CACHE only_sonarsource_qa: &ONLY_SONARSOURCE_QA only_if: $CIRRUS_USER_COLLABORATOR == 'true' && ($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}" + build_task: eks_container: <<: *CONTAINER_DEFINITION_17 @@ -67,6 +72,7 @@ build_task: maven_cache: folder: ${CIRRUS_WORKING_DIR}/.m2/repository script: + - *log_develocity_url_script - source cirrus-env BUILD - source cirrus/define-gradle.sh - mvn -f property-dump-plugin/pom.xml -B install @@ -149,6 +155,7 @@ gradle_qa_task: - GRADLE_VERSION: 7.5.1 ANDROID_GRADLE_VERSION: 7.1.0 script: + - *log_develocity_url_script - ./cirrus/cirrus-qa.sh gradle_qa_java11_task: @@ -168,6 +175,7 @@ gradle_qa_java11_task: - GRADLE_VERSION: 5.6.4 ANDROID_GRADLE_VERSION: 3.5.4 script: + - *log_develocity_url_script - ./cirrus/cirrus-qa.sh promote_task: diff --git a/settings.gradle.kts b/settings.gradle.kts index d404fca7..6e6fb757 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,12 +1,23 @@ rootProject.name = "sonarqube-gradle-plugin" -var isCiServer = System.getenv().containsKey("CIRRUS_CI") -var buildCacheHost = System.getenv().getOrDefault("CIRRUS_HTTP_CACHE_HOST", "localhost:12321") - -buildCache { - remote { - isEnabled = isCiServer - isPush = System.getenv()["GITHUB_BRANCH"] == "master" - url = uri("http://${buildCacheHost}/") +plugins { + id("com.gradle.develocity") version("3.18.2") +} +develocity { + server.set("https://develocity.sonar.build") + buildScan { + capture { + buildLogging.set(!startParameter.taskNames.contains("properties")) + } } } +val isCI: Boolean = System.getenv("CI") != null +buildCache { + local { + isEnabled = !isCI + } + remote(develocity.buildCache) { + isEnabled = true + isPush = isCI + } +} \ No newline at end of file From f0ddcc24c9887e6b6dd612fc838b313d985482c8 Mon Sep 17 00:00:00 2001 From: Leonardo Pilastri Date: Tue, 7 Jan 2025 15:20:10 +0100 Subject: [PATCH 2/2] Add new line --- settings.gradle.kts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index 6e6fb757..b1899df4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -20,4 +20,5 @@ buildCache { isEnabled = true isPush = isCI } -} \ No newline at end of file +} +