diff --git a/.ci/init.gradle b/.ci/init.gradle index 28a04308d184f..36eec780a6071 100644 --- a/.ci/init.gradle +++ b/.ci/init.gradle @@ -12,14 +12,16 @@ 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!") +if (System.getenv('VAULT_ADDR') == null) { + throw new GradleException("You must set the VAULT_ADDR environment variable to use this init script.") +} - } +if (System.getenv('VAULT_ROLE_ID') == null && System.getenv('VAULT_SECRET_ID') == null && System.getenv('VAULT_TOKEN') == null) { + throw new GradleException("You must set either the VAULT_ROLE_ID and VAULT_SECRET_ID environment variables, " + + "or the VAULT_TOKEN environment variable to use this init script.") } -final String vaultToken = new Vault( +final String vaultToken = System.getenv('VAULT_TOKEN') ?: new Vault( new VaultConfig() .address(System.env.VAULT_ADDR) .engineVersion(1)