Skip to content

Commit

Permalink
Add Gradle init script to configure artifactoy (#40412)
Browse files Browse the repository at this point in the history
The script will be use in CI to configure our own Artifactory instance
so CI does not depend on external network resources nor do we generate
excessive load on these resources.
In case the repo is not accessible Gradle should fall back to using the
public ones.
  • Loading branch information
alpar-t committed Mar 26, 2019
1 parent 6c337a5 commit b4b69d2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .ci/init.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFACTORY_TOKEN == null) {
throw new GradleException("Using init script without configuration")
} else {
logger.info("Using elastic artifactory repos")
settingsEvaluated { settings ->
settings.pluginManagement {
repositories {
maven {
url "https://artifactory.elstc.co/artifactory/gradle-plugins"
credentials {
username System.env.ELASTIC_ARTIFACTORY_USERNAME
password System.env.ELASTIC_ARTIFACTORY_TOKEN
}
}
gradlePluginPortal()
}
}
}
projectsLoaded {
allprojects {
buildscript {
repositories {
maven {
url "https://artifactory.elstc.co/artifactory/gradle-release/"
credentials {
username System.env.ELASTIC_ARTIFACTORY_USERNAME
password System.env.ELASTIC_ARTIFACTORY_TOKEN
}
}
}
}
repositories {
maven {
url "https://artifactory.elstc.co/artifactory/gradle-release/"
credentials {
username System.env.ELASTIC_ARTIFACTORY_USERNAME
password System.env.ELASTIC_ARTIFACTORY_TOKEN
}
}
}
}
}
}

0 comments on commit b4b69d2

Please sign in to comment.