From 8a91f64f9af3df510019e110d7339b8b9c6be8fd Mon Sep 17 00:00:00 2001 From: Steve Marion Date: Thu, 14 Nov 2024 16:55:28 +0100 Subject: [PATCH] SONAR-23626 publish Community Build and SonarQube Server independently. Co-authored-by: Alain Kermis Co-authored-by: Matteo Mara --- build.gradle | 38 +++++++++++++-------- plugins/sonar-education-plugin/build.gradle | 2 +- plugins/sonar-xoo-plugin/build.gradle | 2 +- server/sonar-db-core/build.gradle | 2 +- sonar-application/build.gradle | 2 +- sonar-core/build.gradle | 2 +- sonar-markdown/build.gradle | 2 +- sonar-plugin-api-impl/build.gradle | 2 +- sonar-scanner-engine/build.gradle | 2 +- sonar-scanner-protocol/build.gradle | 2 +- sonar-testing-harness/build.gradle | 2 +- sonar-ws/build.gradle | 2 +- 12 files changed, 35 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index ffad3b3e6c2..f0109c28be6 100644 --- a/build.gradle +++ b/build.gradle @@ -63,6 +63,7 @@ allprojects { ext { release = project.hasProperty('release') && project.getProperty('release') + deployCommunity = project.hasProperty('deployCommunity') && (project.getProperty('deployCommunity') == 'true') official = project.hasProperty('official') && project.getProperty('official') } @@ -139,7 +140,23 @@ allprojects { artifactory { clientConfig.setIncludeEnvVars(true) clientConfig.setEnvVarsExcludePatterns('*pass*,*psw*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*login*,*key*,*signing*,*auth*,*pwd*') + clientConfig.publisher.setFilterExcludedArtifactsFromBuild(true) contextUrl = System.getenv('ARTIFACTORY_URL') + + //if property deployCommunity is true set the value to sonar-enterprise-sqcb + //otherwise set it to sqs + if (deployCommunity) { + clientConfig.info.setBuildName('sonar-enterprise-sqcb') + clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH', + "${project.group}:sonar-application:zip,") + } else { + clientConfig.info.setBuildName('sonar-enterprise-sqs') + clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH', + "com.sonarsource.sonarqube:sonarqube-developer:zip," + + "com.sonarsource.sonarqube:sonarqube-datacenter:zip," + + "com.sonarsource.sonarqube:sonarqube-enterprise:zip") + } + publish { repository { repoKey = System.getenv('ARTIFACTORY_DEPLOY_REPO') @@ -148,27 +165,20 @@ allprojects { } defaults { properties = [ - 'build.name': 'sonar-enterprise', - 'build.number': System.getenv('BUILD_NUMBER'), - 'pr.branch.target': System.getenv('GITHUB_BASE_BRANCH'), - 'pr.number': System.getenv('PULL_REQUEST'), - 'vcs.branch': ghBranch, - 'vcs.revision': System.getenv('GIT_SHA1'), - 'version': version + 'build.name' : 'sonar-enterprise-sqcb', + 'build.number' : System.getenv('BUILD_NUMBER'), + 'pr.branch.target': System.getenv('GITHUB_BASE_BRANCH'), + 'pr.number' : System.getenv('PULL_REQUEST'), + 'vcs.branch' : ghBranch, + 'vcs.revision' : System.getenv('GIT_SHA1'), + 'version' : version ] publications('mavenJava') publishPom = true publishIvy = false } } - clientConfig.info.setBuildName('sonar-enterprise') clientConfig.info.setBuildNumber(System.getenv('BUILD_NUMBER')) - // Define the artifacts to be deployed to https://binaries.sonarsource.com on releases - clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH', - "${project.group}:sonar-application:zip," + - "com.sonarsource.sonarqube:sonarqube-developer:zip," + - "com.sonarsource.sonarqube:sonarqube-datacenter:zip," + - "com.sonarsource.sonarqube:sonarqube-enterprise:zip") // The name of this variable is important because it's used by the delivery process when extracting version from Artifactory build info. clientConfig.info.addEnvironmentProperty('PROJECT_VERSION', "${version}") } diff --git a/plugins/sonar-education-plugin/build.gradle b/plugins/sonar-education-plugin/build.gradle index 23675c0c6c5..98bab88f73f 100644 --- a/plugins/sonar-education-plugin/build.gradle +++ b/plugins/sonar-education-plugin/build.gradle @@ -30,7 +30,7 @@ jar { } } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { diff --git a/plugins/sonar-xoo-plugin/build.gradle b/plugins/sonar-xoo-plugin/build.gradle index f12ceadcdf8..3bdcfa27b1b 100644 --- a/plugins/sonar-xoo-plugin/build.gradle +++ b/plugins/sonar-xoo-plugin/build.gradle @@ -33,7 +33,7 @@ jar { } } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { diff --git a/server/sonar-db-core/build.gradle b/server/sonar-db-core/build.gradle index 1fd40cd6a70..9353704a08e 100644 --- a/server/sonar-db-core/build.gradle +++ b/server/sonar-db-core/build.gradle @@ -57,7 +57,7 @@ test { systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl') } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity // Used by core plugins publishing { diff --git a/sonar-application/build.gradle b/sonar-application/build.gradle index c0e626f650c..50f06c839ad 100644 --- a/sonar-application/build.gradle +++ b/sonar-application/build.gradle @@ -373,7 +373,7 @@ assemble.dependsOn cleanLocalUnzippedDir artifacts { zip zip } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity def bomFile = layout.buildDirectory.file('reports/bom.json') cyclonedxBom { diff --git a/sonar-core/build.gradle b/sonar-core/build.gradle index 6413e9101e5..5c922dc1ae8 100644 --- a/sonar-core/build.gradle +++ b/sonar-core/build.gradle @@ -40,7 +40,7 @@ dependencies { } // Used by sonar-db-core to run DB Unit Tests -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { mavenJava(MavenPublication) { diff --git a/sonar-markdown/build.gradle b/sonar-markdown/build.gradle index 4e7c2fc790c..b2c00376d02 100644 --- a/sonar-markdown/build.gradle +++ b/sonar-markdown/build.gradle @@ -15,7 +15,7 @@ dependencies { testImplementation 'org.assertj:assertj-core' } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { diff --git a/sonar-plugin-api-impl/build.gradle b/sonar-plugin-api-impl/build.gradle index 2417c1f89fa..978379e5f13 100644 --- a/sonar-plugin-api-impl/build.gradle +++ b/sonar-plugin-api-impl/build.gradle @@ -39,7 +39,7 @@ processResources { ] } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { diff --git a/sonar-scanner-engine/build.gradle b/sonar-scanner-engine/build.gradle index de0f9f12d19..f9252430adc 100644 --- a/sonar-scanner-engine/build.gradle +++ b/sonar-scanner-engine/build.gradle @@ -83,7 +83,7 @@ license { excludes(["**/Fake.java", "**/Fake.groovy", "org/sonar/scanner/cpd/ManyStatements.java", "org/sonar/scm/git/expected-blame/**/*"]) } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity // Used by core plugins publishing { diff --git a/sonar-scanner-protocol/build.gradle b/sonar-scanner-protocol/build.gradle index 43ea08b6c59..4402ce004ec 100644 --- a/sonar-scanner-protocol/build.gradle +++ b/sonar-scanner-protocol/build.gradle @@ -44,7 +44,7 @@ task fatJar(type: Jar) { build.dependsOn fatJar // Used by sonar-db-core to run DB Unit Tests -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { mavenJava(MavenPublication) { diff --git a/sonar-testing-harness/build.gradle b/sonar-testing-harness/build.gradle index 0ab5cc940d8..a46a55fb568 100644 --- a/sonar-testing-harness/build.gradle +++ b/sonar-testing-harness/build.gradle @@ -19,7 +19,7 @@ dependencies { compileOnlyApi 'com.github.spotbugs:spotbugs-annotations' } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { mavenJava(MavenPublication) { diff --git a/sonar-ws/build.gradle b/sonar-ws/build.gradle index e33277140ef..5549917b93c 100644 --- a/sonar-ws/build.gradle +++ b/sonar-ws/build.gradle @@ -39,7 +39,7 @@ dependencies { testFixturesApi 'commons-io:commons-io' } -artifactoryPublish.skip = false +artifactoryPublish.skip = !deployCommunity publishing { publications { -- 2.39.5