Skip to content

Commit

Permalink
[NO-JIRA] Get repox authentication working for Sonar devs
Browse files Browse the repository at this point in the history
  • Loading branch information
dorian-burihabwa-sonarsource committed Apr 12, 2024
1 parent 8cecd40 commit f4a129e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,19 @@ allprojects {
mavenLocal()
val repository = if (project.hasProperty("qa")) "sonarsource-qa" else "sonarsource"
maven {
credentials {
username = System.getenv("ARTIFACTORY_PRIVATE_USERNAME")
password = System.getenv("ARTIFACTORY_PRIVATE_PASSWORD")
}
url = uri("https://repox.jfrog.io/repox/${repository}")

// The environment variables ARTIFACTORY_PRIVATE_USERNAME and ARTIFACTORY_PRIVATE_PASSWORD are used in QA
// On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties
val artifactoryUsername = System.getenv("ARTIFACTORY_PRIVATE_USERNAME") ?: project.findProperty("artifactoryUsername") ?: ""
val artifactoryPassword = System.getenv("ARTIFACTORY_PRIVATE_PASSWORD") ?: project.findProperty("artifactoryPassword") ?: ""

if (artifactoryUsername is String && artifactoryUsername.isNotEmpty() && artifactoryPassword is String && artifactoryPassword.isNotEmpty()) {
credentials {
username = artifactoryUsername
password = artifactoryPassword
}
}
}
}
}
Expand Down

0 comments on commit f4a129e

Please sign in to comment.