From a43974379efbe7ea7d757a8fe7aa97a481802c24 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Wed, 25 Sep 2019 14:33:26 +0300 Subject: [PATCH] Disable the use of artifactory in CI (#47100) --- .ci/init.gradle | 54 ++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/.ci/init.gradle b/.ci/init.gradle index e5c71eb5881b4..13b59da433be4 100644 --- a/.ci/init.gradle +++ b/.ci/init.gradle @@ -10,6 +10,8 @@ initscript { } } +boolean USE_ARTIFACTORY=false + ['VAULT_ADDR', 'VAULT_ROLE_ID', 'VAULT_SECRET_ID'].each { if (System.env."$it" == null) { throw new GradleException("$it must be set!") @@ -37,39 +39,44 @@ final Vault vault = new Vault( ) .withRetries(5, 1000) -final Map artifactoryCredentials = vault.logical() - .read("secret/elasticsearch-ci/artifactory.elstc.co") - .getData(); -logger.info("Using elastic artifactory repos") -Closure configCache = { - return { - name "artifactory-gradle-release" - url "https://artifactory.elstc.co/artifactory/gradle-release" - credentials { - username artifactoryCredentials.get("username") - password artifactoryCredentials.get("token") +if (USE_ARTIFACTORY) { + final Map artifactoryCredentials = vault.logical() + .read("secret/elasticsearch-ci/artifactory.elstc.co") + .getData(); + logger.info("Using elastic artifactory repos") + Closure configCache = { + return { + name "artifactory-gradle-release" + url "https://artifactory.elstc.co/artifactory/gradle-release" + credentials { + username artifactoryCredentials.get("username") + password artifactoryCredentials.get("token") + } } } -} -settingsEvaluated { settings -> - settings.pluginManagement { - repositories { - maven configCache() + settingsEvaluated { settings -> + settings.pluginManagement { + repositories { + maven configCache() + } } } -} -projectsLoaded { - allprojects { - buildscript { + projectsLoaded { + allprojects { + buildscript { + repositories { + maven configCache() + } + } repositories { maven configCache() } } - repositories { - maven configCache() - } } +} + +projectsLoaded { rootProject { project.pluginManager.withPlugin('com.gradle.build-scan') { buildScan.server = 'https://gradle-enterprise.elastic.co' @@ -77,6 +84,7 @@ projectsLoaded { } } + final String buildCacheUrl = System.getProperty('org.elasticsearch.build.cache.url') final boolean buildCachePush = Boolean.valueOf(System.getProperty('org.elasticsearch.build.cache.push', 'false'))