]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21476 Fix JFrog authentication with vault
authorJacek Poreda <jacek.poreda@sonarsource.com>
Mon, 22 Jan 2024 16:00:10 +0000 (17:00 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 30 Jan 2024 15:02:01 +0000 (15:02 +0000)
(cherry picked from commit 4e1f32cb541d3cb5efdbaa5443f088b2d6baaf48)

build.gradle
server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java

index 10c51e2f8eff2ae99ae6bc20ff64c4084ca56430..7ecd7e2ba1de0da17b87350edd3bf9d9e7c43cf9 100644 (file)
@@ -68,18 +68,32 @@ allprojects {
       // On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties
       def artifactoryUsername = System.env.'ARTIFACTORY_PRIVATE_USERNAME' ?: (project.hasProperty('artifactoryUsername') ? project.getProperty('artifactoryUsername') : '')
       def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD' ?: (project.hasProperty('artifactoryPassword') ? project.getProperty('artifactoryPassword') : '')
-      if (artifactoryUsername && artifactoryPassword) {
-        credentials {
-          username artifactoryUsername
-          password artifactoryPassword
-        }
-      } else {
+      if (!artifactoryUsername || ! artifactoryPassword) {
+
         // Workaround for artifactory
         // https://www.jfrog.com/jira/browse/RTFACT-13797
         repository = 'public'
       }
       url "https://repox.jfrog.io/repox/${repository}"
     }
+    ivy {
+          if (artifactoryUsername && artifactoryPassword) {
+              url "${artifactoryUrl}/sonarsource-bucket"
+
+              patternLayout {
+                artifact '/[organisation]/[module]/[module]-[revision].[ext]'
+              }
+          } else {
+              // For public build
+              url "https://artifacts.elastic.co/downloads/"
+
+              patternLayout {
+                artifact '/[organisation]/[module]-[revision].[ext]'
+              }
+          }
+
+          metadataSources { artifact() }
+    }
   }
 
   task allDependencies {
index 71b4990f0055583f6aa952ef58c6ef0709ee07d4..dce3f1fdcb8253e81c2a98a749939cdcdfcf7ef3 100644 (file)
@@ -44,6 +44,7 @@ public class CreateDb {
   private static void createDb(Consumer<Configuration> execute) {
     Configuration configuration = Configuration.builder()
       .addSystemProperties()
+      .addEnvVariables()
       .setProperty("orchestrator.keepDatabase", "false")
       .build();