You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2024/01/15 18:28:00 UTC
(solr) branch main updated: Build: validation.git.failOnModified default to isCIBuild (#2196)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new b5db1791649 Build: validation.git.failOnModified default to isCIBuild (#2196)
b5db1791649 is described below
commit b5db179164919df657845f5e71f9fe0f0a1c86d8
Author: David Smiley <ds...@apache.org>
AuthorDate: Mon Jan 15 13:27:54 2024 -0500
Build: validation.git.failOnModified default to isCIBuild (#2196)
---
gradle/globals.gradle | 2 +-
gradle/validation/git-status.gradle | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gradle/globals.gradle b/gradle/globals.gradle
index f08a033b118..48131b3003b 100644
--- a/gradle/globals.gradle
+++ b/gradle/globals.gradle
@@ -168,6 +168,6 @@ allprojects {
// detect if we run in CI environment by looking at existence of env vars:
// "CI": Github (https://docs.github.com/en/actions/learn-github-actions/environment-variables)
// anything starting with "JENKINS_" or "HUDSON_": Jenkins/Hudson (https://jenkins.thetaphi.de/env-vars.html/)
- isCIBuild = System.getenv().keySet().find { it ==~ /(?i)((JENKINS|HUDSON)(_\w+)?|CI)/ } != null
+ isCIBuild = System.getenv().keySet().any { it ==~ /(?i)((JENKINS|HUDSON)(_\w+)?|CI)/ }
}
}
diff --git a/gradle/validation/git-status.gradle b/gradle/validation/git-status.gradle
index 5ce6195bf93..b34cf831ef7 100644
--- a/gradle/validation/git-status.gradle
+++ b/gradle/validation/git-status.gradle
@@ -103,8 +103,18 @@ configure(rootProject) {
files.collect {file -> " - ${file} ${fileStatus}" }
}.sort()
- def checkProp = "validation.git.failOnModified"
- failOrWarn(checkProp, "Working copy is not a clean git checkout", offenders)
+ if (offenders ) {
+ def propName = "validation.git.failOnModified"
+ def shouldFail = Boolean.valueOf(propertyOrDefault(propName, isCIBuild))
+ def msg = "Working copy is not a clean git checkout" +
+ (shouldFail ? " (skip with -P${propName}=false)" : "") + ":\n${offenders.join("\n")}"
+
+ if (shouldFail) {
+ throw new GradleException(msg)
+ } else {
+ logger.warn("NOTE: ${msg}")
+ }
+ }
}
}
}