hibernate-orm/gradle/gradle-enterprise.gradle
Yoann Rodière b34462138d Remove non-fonctional "JOB_NAME" custom value in build scans
It doesn't seem to work as we get "JOB null" on every build scan.
Even if it worked, it would most likely only display the top-level job,
e.g. `hibernate-orm-pipeline` on Jenkins, which doesn't give much
information.
2024-03-21 10:59:24 -05:00

57 lines
1.7 KiB
Groovy

/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Applies details for `https://ge.hibernate.org`
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ext {
isCiEnvironment = isJenkins() || isGitHubActions() || isGenericCi()
populateRemoteBuildCache = getSetting( "POPULATE_REMOTE_GRADLE_CACHE" ).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);
}
gradleEnterprise {
server = 'https://ge.hibernate.org'
buildScan {
captureTaskInputFiles = true
publishAlways()
publishIfAuthenticated()
uploadInBackground = !settings.ext.isCiEnvironment
tag "JDK ${JavaVersion.current().toString()}"
String db = rootProject.hasProperty( 'db' ) ? rootProject.properties.db : 'h2'
tag db
value 'database', db
if ( rootProject.hasProperty( 'ci.node' ) ) {
tag rootProject.property('ci.node')
}
}
}