31 lines
742 B
Groovy
31 lines
742 B
Groovy
ext {
|
|
isCiEnvironment = isJenkins() || isGitHubActions() || isGenericCi()
|
|
populateRemoteBuildCache = getSetting( "POPULATE_REMOTE" ).isPresent()
|
|
}
|
|
|
|
private static boolean isJenkins() {
|
|
return getSetting( "JENKINS_URL" ).isPresent()
|
|
}
|
|
|
|
private static boolean isGitHubActions() {
|
|
return getSetting( "GITHUB_ACTIONS" ).isPresent()
|
|
}
|
|
|
|
private static boolean isGenericCi() {
|
|
return System.getenv("CI") != null || System.getProperty("CI") != null
|
|
}
|
|
|
|
static java.util.Optional<String> getSetting(String name) {
|
|
def envVar = System.getenv(name)
|
|
if ( envVar != null ) {
|
|
return java.util.Optional.of(envVar);
|
|
}
|
|
|
|
def sysProp = System.getProperty(name)
|
|
return java.util.Optional.ofNullable(sysProp);
|
|
}
|
|
|
|
|
|
|
|
|