Quellcode durchsuchen

Provide hints to Gradle Task.onlyIf declarations (#94953)

* Update gradle enterprise plugin to show skip reasons in build scans
* Unify OS specific handling in build logic
Rene Groeschke vor 2 Jahren
Ursprung
Commit
e735455431
44 geänderte Dateien mit 115 neuen und 104 gelöschten Zeilen
  1. 2 1
      build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/BuildToolsConventionsPlugin.java
  2. 1 1
      build-tools-internal/src/main/groovy/elasticsearch.bwc-test.gradle
  3. 3 3
      build-tools-internal/src/main/groovy/elasticsearch.stable-api.gradle
  4. 3 3
      build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/AntFixtureStop.groovy
  5. 5 6
      build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/test/AntFixture.groovy
  6. 3 3
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcSetupExtension.java
  7. 3 3
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalBwcGitPlugin.java
  8. 5 0
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/BuildParams.java
  9. 2 2
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTask.java
  10. 9 4
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java
  11. 1 1
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/testfixtures/TestFixturesPlugin.java
  12. 2 2
      build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/util/HdfsUtils.java
  13. 2 2
      build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/EmptyDirTaskTests.java
  14. 4 4
      build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTaskTests.java
  15. 5 5
      distribution/docker/build.gradle
  16. 8 8
      distribution/packages/build.gradle
  17. 3 3
      gradle/verification-metadata.xml
  18. 2 3
      modules/ingest-geoip/build.gradle
  19. 3 5
      modules/reindex/build.gradle
  20. 2 2
      plugins/repository-hdfs/build.gradle
  21. 1 1
      qa/mixed-cluster/build.gradle
  22. 1 1
      qa/os/windows-2012r2/build.gradle
  23. 1 1
      qa/os/windows-2016/build.gradle
  24. 1 1
      settings.gradle
  25. 1 1
      test/external-modules/build.gradle
  26. 1 1
      test/external-modules/die-with-dignity/build.gradle
  27. 1 1
      test/framework/build.gradle
  28. 1 1
      x-pack/plugin/async-search/qa/rest/build.gradle
  29. 1 1
      x-pack/plugin/ccr/qa/build.gradle
  30. 1 1
      x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle
  31. 1 1
      x-pack/plugin/deprecation/qa/rest/build.gradle
  32. 3 1
      x-pack/plugin/eql/qa/correctness/build.gradle
  33. 1 1
      x-pack/plugin/eql/qa/mixed-node/build.gradle
  34. 1 1
      x-pack/plugin/identity-provider/qa/idp-rest-tests/build.gradle
  35. 5 5
      x-pack/plugin/searchable-snapshots/qa/hdfs/build.gradle
  36. 1 1
      x-pack/plugin/security/qa/basic-enable-security/build.gradle
  37. 8 6
      x-pack/plugin/snapshot-repo-test-kit/qa/hdfs/build.gradle
  38. 1 1
      x-pack/plugin/sql/qa/jdbc/security/with-ssl/build.gradle
  39. 1 1
      x-pack/plugin/sql/qa/mixed-node/build.gradle
  40. 4 6
      x-pack/plugin/sql/qa/server/security/with-ssl/build.gradle
  41. 2 2
      x-pack/qa/mixed-tier-cluster/build.gradle
  42. 2 4
      x-pack/qa/repository-old-versions/build.gradle
  43. 1 1
      x-pack/qa/rolling-upgrade-multi-cluster/build.gradle
  44. 6 2
      x-pack/qa/saml-idp-tests/build.gradle

+ 2 - 1
build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/BuildToolsConventionsPlugin.java

@@ -25,7 +25,8 @@ public class BuildToolsConventionsPlugin implements Plugin<Project> {
         project.getPlugins().apply(LicenseHeadersPrecommitPlugin.class);
         int defaultParallel = ParallelDetector.findDefaultParallel(project);
         project.getTasks().withType(Test.class).configureEach(test -> {
-            test.onlyIf((t) -> Util.getBooleanProperty("tests.fips.enabled", false) == false);
+            test.onlyIf("FIPS mode disabled",
+                    (t) -> Util.getBooleanProperty("tests.fips.enabled", false) == false);
             test.setMaxParallelForks(defaultParallel);
         });
         // we put all our distributable files under distributions

+ 1 - 1
build-tools-internal/src/main/groovy/elasticsearch.bwc-test.gradle

@@ -33,7 +33,7 @@ tasks.register("bwcTest") {
 
 plugins.withType(ElasticsearchTestBasePlugin) {
   tasks.withType(Test).matching { it.name ==~ /v[0-9\.]+#.*/ }.configureEach {
-    onlyIf { project.bwc_tests_enabled }
+    onlyIf("BWC tests enabled") { project.bwc_tests_enabled }
     nonInputProperties.systemProperty 'tests.bwc', 'true'
   }
 }

+ 3 - 3
build-tools-internal/src/main/groovy/elasticsearch.stable-api.gradle

@@ -1,4 +1,4 @@
-import org.apache.tools.ant.taskdefs.condition.Os
+import org.elasticsearch.gradle.OS
 import org.elasticsearch.gradle.Version
 import org.elasticsearch.gradle.VersionProperties
 import org.elasticsearch.gradle.internal.BwcVersions
@@ -45,8 +45,8 @@ BuildParams.bwcVersions.withIndexCompatible({ it.onOrAfter(Version.fromString(ex
   }
 
   jarApiComparisonTask.configure {
-    onlyIf {
-      !Os.isFamily(Os.FAMILY_WINDOWS)
+    onlyIf("OS != windows") {
+      OS.current() != OS.WINDOWS
     }
   }
 }

+ 3 - 3
build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/AntFixtureStop.groovy

@@ -8,8 +8,8 @@
 
 package org.elasticsearch.gradle.internal
 
-import org.apache.tools.ant.taskdefs.condition.Os
 import org.elasticsearch.gradle.LoggedExec
+import org.elasticsearch.gradle.OS
 import org.elasticsearch.gradle.internal.test.AntFixture
 import org.gradle.api.file.FileSystemOperations
 import org.gradle.api.file.ProjectLayout
@@ -32,12 +32,12 @@ abstract class AntFixtureStop extends LoggedExec implements FixtureStop {
         assert this.fixture == null
         this.fixture = fixture;
         final Object pid = "${ -> this.fixture.pid }"
-        onlyIf { fixture.pidFile.exists() }
+        onlyIf("pidFile exists") { fixture.pidFile.exists() }
         doFirst {
             logger.info("Shutting down ${fixture.name} with pid ${pid}")
         }
 
-        if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+        if (OS.current() == OS.WINDOWS) {
             getExecutable().set('Taskkill')
             args('/PID', pid, '/F')
         } else {

+ 5 - 6
build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/test/AntFixture.groovy

@@ -8,10 +8,9 @@
 
 package org.elasticsearch.gradle.internal.test
 
-import org.apache.tools.ant.taskdefs.condition.Os
+import org.elasticsearch.gradle.OS
 import org.elasticsearch.gradle.internal.AntFixtureStop
 import org.elasticsearch.gradle.internal.AntTask
-import org.elasticsearch.gradle.internal.test.Fixture
 import org.gradle.api.GradleException
 import org.gradle.api.tasks.Internal
 import org.gradle.api.tasks.TaskProvider
@@ -95,7 +94,7 @@ class AntFixture extends AntTask implements Fixture {
         // We need to choose which executable we are using. In shell mode, or when we
         // are spawning and thus using the wrapper script, the executable is the shell.
         if (useShell || spawn) {
-            if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+            if (OS.current() == OS.WINDOWS) {
                 realExecutable = 'cmd'
                 realArgs.add('/C')
                 realArgs.add('"') // quote the entire command
@@ -111,7 +110,7 @@ class AntFixture extends AntTask implements Fixture {
             realArgs.add(wrapperScript)
             realArgs.addAll(arguments)
         }
-        if (Os.isFamily(Os.FAMILY_WINDOWS) && (useShell || spawn)) {
+        if (OS.current() == OS.WINDOWS && (useShell || spawn)) {
             realArgs.add('"')
         }
         commandString.eachLine { line -> logger.info(line) }
@@ -183,7 +182,7 @@ class AntFixture extends AntTask implements Fixture {
         wrapperScript.parentFile.mkdirs()
         String argsPasser = '"$@"'
         String exitMarker = "; if [ \$? != 0 ]; then touch run.failed; fi"
-        if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+        if (OS.current() == OS.WINDOWS) {
             argsPasser = '%*'
             exitMarker = "\r\n if \"%errorlevel%\" neq \"0\" ( type nul >> run.failed )"
         }
@@ -267,7 +266,7 @@ class AntFixture extends AntTask implements Fixture {
     /** Returns a file that wraps around the actual command when {@code spawn == true}. */
     @Internal
     protected File getWrapperScript() {
-        return new File(cwd, Os.isFamily(Os.FAMILY_WINDOWS) ? 'run.bat' : 'run')
+        return new File(cwd, (OS.current() == OS.WINDOWS) ? 'run.bat' : 'run')
     }
 
     /** Returns a file that the wrapper script writes when the command failed. */

+ 3 - 3
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcSetupExtension.java

@@ -9,8 +9,8 @@
 package org.elasticsearch.gradle.internal;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.tools.ant.taskdefs.condition.Os;
 import org.elasticsearch.gradle.LoggedExec;
+import org.elasticsearch.gradle.OS;
 import org.elasticsearch.gradle.Version;
 import org.elasticsearch.gradle.internal.info.BuildParams;
 import org.gradle.api.Action;
@@ -74,12 +74,12 @@ public class BwcSetupExtension {
                 return getJavaHome(Integer.parseInt(minimumCompilerVersion));
             }));
 
-            if (BuildParams.isCi() && Os.isFamily(Os.FAMILY_WINDOWS) == false) {
+            if (BuildParams.isCi() && OS.current() != OS.WINDOWS) {
                 // TODO: Disabled for now until we can figure out why files are getting corrupted
                 // loggedExec.getEnvironment().put("GRADLE_RO_DEP_CACHE", System.getProperty("user.home") + "/gradle_ro_cache");
             }
 
-            if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+            if (OS.current() == OS.WINDOWS) {
                 loggedExec.getExecutable().set("cmd");
                 loggedExec.args("/C", "call", new File(checkoutDir.get(), "gradlew").toString());
             } else {

+ 3 - 3
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalBwcGitPlugin.java

@@ -68,7 +68,7 @@ public class InternalBwcGitPlugin implements Plugin<Project> {
 
         TaskContainer tasks = project.getTasks();
         TaskProvider<LoggedExec> createCloneTaskProvider = tasks.register("createClone", LoggedExec.class, createClone -> {
-            createClone.onlyIf(task -> this.gitExtension.getCheckoutDir().get().exists() == false);
+            createClone.onlyIf("git checkout dir missing", task -> this.gitExtension.getCheckoutDir().get().exists() == false);
             createClone.commandLine("git", "clone", buildLayout.getRootDirectory(), gitExtension.getCheckoutDir().get());
         });
 
@@ -83,7 +83,7 @@ public class InternalBwcGitPlugin implements Plugin<Project> {
 
         TaskProvider<LoggedExec> addRemoteTaskProvider = tasks.register("addRemote", LoggedExec.class, addRemote -> {
             addRemote.dependsOn(findRemoteTaskProvider);
-            addRemote.onlyIf(task -> ((boolean) extraProperties.get("remoteExists")) == false);
+            addRemote.onlyIf("remote exists", task -> ((boolean) extraProperties.get("remoteExists")) == false);
             addRemote.getWorkingDir().set(gitExtension.getCheckoutDir().get());
             String remoteRepo = remote.get();
             // for testing only we can override the base remote url
@@ -103,7 +103,7 @@ public class InternalBwcGitPlugin implements Plugin<Project> {
                 }
                 throw new GradleException("tests.bwc.git_fetch_latest must be [true] or [false] but was [" + fetchProp + "]");
             });
-            fetchLatest.onlyIf(t -> isOffline == false && gitFetchLatest.get());
+            fetchLatest.onlyIf("online and gitFetchLatest == true", t -> isOffline == false && gitFetchLatest.get());
             fetchLatest.dependsOn(addRemoteTaskProvider);
             fetchLatest.getWorkingDir().set(gitExtension.getCheckoutDir().get());
             fetchLatest.commandLine("git", "fetch", "--all");

+ 5 - 0
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/info/BuildParams.java

@@ -10,6 +10,7 @@ package org.elasticsearch.gradle.internal.info;
 import org.elasticsearch.gradle.internal.BwcVersions;
 import org.gradle.api.Action;
 import org.gradle.api.JavaVersion;
+import org.gradle.api.Task;
 import org.gradle.api.provider.Provider;
 import org.gradle.jvm.toolchain.JavaToolchainSpec;
 
@@ -92,6 +93,10 @@ public class BuildParams {
         return value(inFipsJvm);
     }
 
+    public static void withFipsEnabledOnly(Task task) {
+        task.onlyIf("FIPS mode disabled", task1 -> isInFipsJvm() == false);
+    }
+
     public static String getGitRevision() {
         return value(gitRevision);
     }

+ 2 - 2
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTask.java

@@ -7,7 +7,7 @@
  */
 package org.elasticsearch.gradle.internal.precommit;
 
-import org.apache.tools.ant.taskdefs.condition.Os;
+import org.elasticsearch.gradle.OS;
 import org.gradle.api.DefaultTask;
 import org.gradle.api.GradleException;
 import org.gradle.api.file.FileCollection;
@@ -88,7 +88,7 @@ public abstract class FilePermissionsTask extends DefaultTask {
 
     @TaskAction
     public void checkInvalidPermissions() throws IOException {
-        if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+        if (OS.current() == OS.WINDOWS) {
             throw new StopExecutionException();
         }
         List<String> failures = getFiles().getFiles()

+ 9 - 4
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java

@@ -127,7 +127,8 @@ public abstract class AbstractYamlRestCompatTestPlugin implements Plugin<Project
                             .resolve(RELATIVE_API_PATH)
                     )
                 );
-                task.onlyIf(t -> isEnabled(extraProperties));
+                onlyIfBwcEnabled(task, extraProperties);
+                // task.onlyIf(t -> isEnabled(extraProperties));
             });
 
         // copy compatible rest tests
@@ -165,7 +166,7 @@ public abstract class AbstractYamlRestCompatTestPlugin implements Plugin<Project
                     )
                 );
                 task.dependsOn(copyCompatYamlSpecTask);
-                task.onlyIf(t -> isEnabled(extraProperties));
+                onlyIfBwcEnabled(task, extraProperties);
             });
 
         // copy both local source set apis and compat apis to a single location to be exported as an artifact
@@ -189,7 +190,7 @@ public abstract class AbstractYamlRestCompatTestPlugin implements Plugin<Project
                 task.getSourceDirectory().set(copyCompatYamlTestTask.flatMap(CopyRestTestsTask::getOutputResourceDir));
                 task.getOutputDirectory()
                     .set(project.getLayout().getBuildDirectory().dir(compatTestsDir.resolve("transformed").toString()));
-                task.onlyIf(t -> isEnabled(extraProperties));
+                onlyIfBwcEnabled(task, extraProperties);
             });
 
         // Register compat rest resources with source set
@@ -234,7 +235,7 @@ public abstract class AbstractYamlRestCompatTestPlugin implements Plugin<Project
 
             // run compatibility tests after "normal" tests
             testTask.mustRunAfter(project.getTasks().named(LegacyYamlRestTestPlugin.SOURCE_SET_NAME));
-            testTask.onlyIf(t -> isEnabled(extraProperties));
+            onlyIfBwcEnabled(testTask, extraProperties);
         });
 
         setupYamlRestTestDependenciesDefaults(project, yamlCompatTestSourceSet, true);
@@ -260,6 +261,10 @@ public abstract class AbstractYamlRestCompatTestPlugin implements Plugin<Project
 
     public abstract Class<? extends Plugin<Project>> getBasePlugin();
 
+    private void onlyIfBwcEnabled(Task task, ExtraPropertiesExtension extraProperties) {
+        task.onlyIf("BWC tests disabled", t -> isEnabled(extraProperties));
+    }
+
     private boolean isEnabled(ExtraPropertiesExtension extraProperties) {
         Object bwcEnabled = extraProperties.getProperties().get("bwc_tests_enabled");
         return bwcEnabled == null || (Boolean) bwcEnabled;

+ 1 - 1
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/testfixtures/TestFixturesPlugin.java

@@ -181,7 +181,7 @@ public class TestFixturesPlugin implements Plugin<Project> {
     }
 
     private void maybeSkipTask(Provider<DockerSupportService> dockerSupport, Task task) {
-        task.onlyIf(spec -> {
+        task.onlyIf("docker compose is available", spec -> {
             boolean isComposeAvailable = dockerSupport.get().getDockerAvailability().isComposeAvailable();
             if (isComposeAvailable == false) {
                 LOGGER.info("Task {} requires docker-compose but it is unavailable. Task will be skipped.", task.getPath());

+ 2 - 2
build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/util/HdfsUtils.java

@@ -8,7 +8,7 @@
 
 package org.elasticsearch.gradle.internal.util;
 
-import org.apache.tools.ant.taskdefs.condition.Os;
+import org.elasticsearch.gradle.OS;
 import org.gradle.api.Project;
 import org.gradle.api.logging.Logging;
 
@@ -24,7 +24,7 @@ public class HdfsUtils {
             Logging.getLogger(HdfsUtils.class).warn("hdfs Fixture unsupported since there are spaces in the path: '" + projectPath + "'");
             return false;
         }
-        return (Os.isFamily(Os.FAMILY_WINDOWS) == false) ? true : isHadoopWindowsInstallationAvailable();
+        return (OS.current() != OS.WINDOWS) ? true : isHadoopWindowsInstallationAvailable();
     }
 
     private static boolean isHadoopWindowsInstallationAvailable() {

+ 2 - 2
build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/EmptyDirTaskTests.java

@@ -7,7 +7,7 @@
  */
 package org.elasticsearch.gradle.internal;
 
-import org.apache.tools.ant.taskdefs.condition.Os;
+import org.elasticsearch.gradle.OS;
 import org.gradle.api.Project;
 import org.gradle.testfixtures.ProjectBuilder;
 import org.junit.Test;
@@ -46,7 +46,7 @@ public class EmptyDirTaskTests {
 
     @Test
     public void testCreateEmptyDirNoPermissions() throws Exception {
-        assumeFalse("Functionality is Unix specific", Os.isFamily(Os.FAMILY_WINDOWS));
+        assumeFalse("Functionality is Unix specific", OS.current() == OS.WINDOWS);
 
         Project project = ProjectBuilder.builder().build();
         EmptyDirTask emptyDirTask = project.getTasks().create("emptyDirTask", EmptyDirTask.class);

+ 4 - 4
build-tools-internal/src/test/java/org/elasticsearch/gradle/internal/precommit/FilePermissionsTaskTests.java

@@ -7,7 +7,7 @@
  */
 package org.elasticsearch.gradle.internal.precommit;
 
-import org.apache.tools.ant.taskdefs.condition.Os;
+import org.elasticsearch.gradle.OS;
 import org.elasticsearch.gradle.util.GradleUtils;
 import org.gradle.api.GradleException;
 import org.gradle.api.Project;
@@ -30,7 +30,7 @@ public class FilePermissionsTaskTests {
 
     @Test
     public void testCheckPermissionsWhenAnExecutableFileExists() throws Exception {
-        assumeFalse("Functionality is Unix specific", Os.isFamily(Os.FAMILY_WINDOWS));
+        assumeFalse("Functionality is Unix specific", OS.current() == OS.WINDOWS);
 
         Project project = createProject();
 
@@ -51,7 +51,7 @@ public class FilePermissionsTaskTests {
 
     @Test
     public void testCheckPermissionsWhenNoFileExists() throws Exception {
-        assumeFalse("Functionality is Unix specific", Os.isFamily(Os.FAMILY_WINDOWS));
+        assumeFalse("Functionality is Unix specific", OS.current() == OS.WINDOWS);
 
         Project project = createProject();
 
@@ -66,7 +66,7 @@ public class FilePermissionsTaskTests {
 
     @Test
     public void testCheckPermissionsWhenNoExecutableFileExists() throws Exception {
-        assumeFalse("Functionality is Unix specific", Os.isFamily(Os.FAMILY_WINDOWS));
+        assumeFalse("Functionality is Unix specific", OS.current() == OS.WINDOWS);
 
         Project project = createProject();
 

+ 5 - 5
distribution/docker/build.gradle

@@ -282,7 +282,7 @@ void addBuildDockerContextTask(Architecture architecture, DockerBase base) {
         rename ~/((?:file|metric)beat)-.*\.tar\.gz$/, "\$1-${VersionProperties.elasticsearch}.tar.gz"
       }
 
-      onlyIf { isArchitectureSupported(architecture) }
+      onlyIf("$architecture supported") { isArchitectureSupported(architecture) }
     }
 
   if (base == DockerBase.IRON_BANK) {
@@ -329,7 +329,7 @@ void addTransformDockerContextTask(Architecture architecture, DockerBase base) {
       inputs.property(k, { v.toString() })
     }
 
-    onlyIf { isArchitectureSupported(architecture) }
+    onlyIf("$architecture supported") { isArchitectureSupported(architecture) }
   }
 
   // Register transformed context as a project artifact
@@ -401,7 +401,7 @@ void addBuildDockerImageTask(Architecture architecture, DockerBase base) {
         baseImages = [base.image]
       }
 
-      onlyIf { isArchitectureSupported(architecture) }
+      onlyIf("$architecture supported") { isArchitectureSupported(architecture) }
     }
 
   if (base != DockerBase.IRON_BANK && base != DockerBase.CLOUD && base != DockerBase.CLOUD_ESS) {
@@ -448,7 +448,7 @@ void addBuildEssDockerImageTask(Architecture architecture) {
       tags = generateTags(base, architecture)
       platform = architecture.dockerPlatform
 
-      onlyIf { isArchitectureSupported(architecture) }
+      onlyIf("$architecture supported") { isArchitectureSupported(architecture) }
     }
 
   tasks.named("assemble").configure {
@@ -518,7 +518,7 @@ subprojects { Project subProject ->
         tarFile,
         "elasticsearch${base.suffix}:${architecture.classifier}"
       dependsOn(parent.path + ":" + buildTaskName)
-      onlyIf { isArchitectureSupported(architecture) }
+      onlyIf("$architecture supported") { isArchitectureSupported(architecture) }
     }
 
     exportDockerImages.configure {

+ 8 - 8
distribution/packages/build.gradle

@@ -83,7 +83,7 @@ plugins {
 // is the same
 def commonPackageConfig(String type, String architecture) {
   return {
-    onlyIf {
+    onlyIf("not running on windows") {
       OS.current().equals(OS.WINDOWS) == false
     }
     dependsOn "process${type.capitalize()}Files"
@@ -392,13 +392,13 @@ subprojects {
     tasks.named("check").configure { dependsOn "checkExtraction" }
     if (project.name.contains('deb')) {
       tasks.named("checkExtraction").configure {
-        onlyIf dpkgExists
+        onlyIf("dpkg exists", dpkgExists)
         commandLine 'dpkg-deb', '-x', "${-> buildDist.get().outputs.files.filter(debFilter).singleFile}", packageExtractionDir
       }
     } else {
       assert project.name.contains('rpm')
       tasks.named("checkExtraction").configure {
-        onlyIf rpmExists
+         onlyIf("rpm exists", rpmExists)
         final File rpmDatabase = new File(extractionDir, 'rpm-database')
         commandLine 'rpm',
           '--badreloc',
@@ -422,7 +422,7 @@ subprojects {
     tasks.named("check").configure { dependsOn "checkLicense" }
     if (project.name.contains('deb')) {
       tasks.named("checkLicense").configure {
-        onlyIf dpkgExists
+        onlyIf("dpkg exists", dpkgExists)
         doLast {
           Path copyrightPath
           String expectedLicense
@@ -441,7 +441,7 @@ subprojects {
     } else {
       assert project.name.contains('rpm')
       tasks.named("checkLicense").configure {
-        onlyIf rpmExists
+        onlyIf("rpm exists", rpmExists)
         doLast {
           String licenseFilename
           licenseFilename = "ELASTIC-LICENSE-2.0.txt"
@@ -454,7 +454,7 @@ subprojects {
 
     tasks.register("checkNotice") {
       dependsOn buildDist, "checkExtraction"
-      onlyIf {
+      onlyIf("${project.name.contains('deb') ? 'dpkg' : 'rpm'} exists") {
         (project.name.contains('deb') && dpkgExists.call(it)) || (project.name.contains('rpm') && rpmExists.call(it))
       }
       doLast {
@@ -474,7 +474,7 @@ subprojects {
 
     if (project.name.contains('deb')) {
       checkLicenseMetadataTaskProvider.configure { LoggedExec exec ->
-        onlyIf dpkgExists
+        onlyIf("dpkg exists", dpkgExists)
         exec.commandLine 'dpkg-deb', '--info', "${-> buildDist.get().outputs.files.filter(debFilter).singleFile}"
         exec.getCaptureOutput().set(true)
         doLast {
@@ -504,7 +504,7 @@ subprojects {
     } else {
       assert project.name.contains('rpm')
       checkLicenseMetadataTaskProvider.configure { LoggedExec exec ->
-        onlyIf rpmExists
+        onlyIf("rpm exists", rpmExists)
         exec.commandLine 'rpm', '-qp', '--queryformat', '%{License}', "${-> buildDist.get().outputs.files.singleFile}"
         exec.getCaptureOutput().set(true)
         doLast {

+ 3 - 3
gradle/verification-metadata.xml

@@ -619,9 +619,9 @@
             <sha256 value="48234cd74e35d91a31a683820a35b5b6d11b55527f32a5b162c6757408b95d7a" origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="com.gradle" name="gradle-enterprise-gradle-plugin" version="3.11.4">
-         <artifact name="gradle-enterprise-gradle-plugin-3.11.4.jar">
-            <sha256 value="b4041a80894cfb0906d28bacf3dbba1a3b1c875ed5a2028b20bcd135d86bcb4d" origin="Generated by Gradle"/>
+      <component group="com.gradle" name="gradle-enterprise-gradle-plugin" version="3.12.6">
+         <artifact name="gradle-enterprise-gradle-plugin-3.12.6.jar">
+            <sha256 value="d4b66fe6c77b6d4ffa5c9001eec881b16e4df0c58f75fa652cb1c9279c879e52" origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="com.h2database" name="h2" version="1.4.197">

+ 2 - 3
modules/ingest-geoip/build.gradle

@@ -6,7 +6,6 @@
  * Side Public License, v 1.
  */
 
-import org.apache.tools.ant.taskdefs.condition.Os
 import org.elasticsearch.gradle.OS
 
 apply plugin: 'elasticsearch.internal-yaml-rest-test'
@@ -53,7 +52,7 @@ tasks.withType(JavaCompile).configureEach {
   options.compilerArgs << '-Xlint:-classfile'
 }
 
-if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+if (OS.current() == OS.WINDOWS) {
   tasks.named("test").configure {
     // Windows cannot cleanup database files properly unless it loads everything on heap.
     // See https://github.com/maxmind/MaxMind-DB-Reader-java#file-lock-on-windows for more information
@@ -62,7 +61,7 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
 }
 
 tasks.named("internalClusterTest") {
-  onlyIf { OS.current() != OS.WINDOWS }
+  onlyIf("OS != windows") { OS.current() != OS.WINDOWS }
 }
 
 tasks.named("forbiddenPatterns").configure {

+ 3 - 5
modules/reindex/build.gradle

@@ -6,14 +6,12 @@
  * Side Public License, v 1.
  */
 
-import org.apache.tools.ant.taskdefs.condition.Os
 import org.elasticsearch.gradle.Architecture
 import org.elasticsearch.gradle.OS
 import org.elasticsearch.gradle.Version
 import org.elasticsearch.gradle.internal.info.BuildParams
 import org.elasticsearch.gradle.internal.test.AntFixture
 import org.elasticsearch.gradle.transform.UnzipTransform
-import org.gradle.api.internal.artifacts.ArtifactAttributes
 
 apply plugin: 'elasticsearch.test-with-dependencies'
 apply plugin: 'elasticsearch.jdk-download'
@@ -93,12 +91,12 @@ jdks {
   }
 }
 
-if (Os.isFamily(Os.FAMILY_MAC) && Architecture.current() == Architecture.AARCH64) {
+if (OS.current() == OS.MAC && Architecture.current() == Architecture.AARCH64) {
   jdks.legacy.vendor = 'zulu'
   jdks.legacy.distributionVersion = '8.56.0.23'
 }
 
-if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+if (OS.current() == OS.WINDOWS) {
   logger.warn("Disabling reindex-from-old tests because we can't get the pid file on windows")
   tasks.named("javaRestTest").configure {
     systemProperty "tests.fromOld", "false"
@@ -121,7 +119,7 @@ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
   });
 
   def versions = ['2', '1', '090']
-  if (Os.isFamily(Os.FAMILY_MAC)) {
+  if (OS.current() == OS.MAC) {
     // 0.90 fails sometimes on mac, given that it is so old, let us disable it
     // see: https://github.com/elastic/elasticsearch/issues/51202
     versions = ['2', '1']

+ 2 - 2
plugins/repository-hdfs/build.gradle

@@ -121,7 +121,7 @@ for (int hadoopVersion = minTestedHadoopVersion; hadoopVersion <= maxTestedHadoo
             env 'CLASSPATH', "${-> project.configurations.getByName("hdfs" + hadoopVer + "Fixture").asPath}"
 
             maxWaitInSeconds 60
-            onlyIf { BuildParams.inFipsJvm == false }
+            BuildParams.withFipsEnabledOnly(it)
             waitCondition = { fixture, ant ->
                 // the hdfs.MiniHDFS fixture writes the ports file when
                 // it's ready, so we can just wait for the file to exist
@@ -273,7 +273,7 @@ tasks.withType(RestIntegTestTask).configureEach { testTask ->
     if (disabledIntegTestTaskNames.contains(name)) {
         enabled = false;
     }
-    onlyIf { BuildParams.inFipsJvm == false }
+    BuildParams.withFipsEnabledOnly(testTask)
 
     if (name.contains("Secure")) {
         if (disabledIntegTestTaskNames.contains(name) == false) {

+ 1 - 1
qa/mixed-cluster/build.gradle

@@ -57,7 +57,7 @@ BuildParams.bwcVersions.withWireCompatible { bwcVersion, baseName ->
         nonInputProperties.systemProperty('tests.clustername', baseName)
       }
       systemProperty 'tests.path.repo', "${buildDir}/cluster/shared/repo/${baseName}"
-      onlyIf { project.bwc_tests_enabled }
+      onlyIf("BWC tests disabled") { project.bwc_tests_enabled }
     }
 
     tasks.register(bwcTaskName(bwcVersion)) {

+ 1 - 1
qa/os/windows-2012r2/build.gradle

@@ -8,6 +8,6 @@ if (boxId != null) {
 } else {
   // box id was not supplied, so disable the distro tests
   tasks.withType(GradleDistroTestTask).configureEach {
-    onlyIf { false }
+    onlyIf("Project property vagrant.windows-2012r2.id set") { false }
   }
 }

+ 1 - 1
qa/os/windows-2016/build.gradle

@@ -8,6 +8,6 @@ if (boxId != null) {
 } else {
   // box id was not supplied, so disable the distro tests
   tasks.withType(GradleDistroTestTask).configureEach {
-    onlyIf { false }
+    enabled = false
   }
 }

+ 1 - 1
settings.gradle

@@ -6,7 +6,7 @@ pluginManagement {
 }
 
 plugins {
-  id "com.gradle.enterprise" version "3.11.4"
+  id "com.gradle.enterprise" version "3.12.6"
 }
 
 includeBuild "build-conventions"

+ 1 - 1
test/external-modules/build.gradle

@@ -12,6 +12,6 @@ subprojects {
   }
 
   tasks.named('yamlRestTest').configure {
-    it.onlyIf { BuildParams.isSnapshotBuild() }
+    it.onlyIf("snapshot build") { BuildParams.isSnapshotBuild() }
   }
 }

+ 1 - 1
test/external-modules/die-with-dignity/build.gradle

@@ -13,7 +13,7 @@ esplugin {
 GradleUtils.extendSourceSet(project, "main", "javaRestTest", tasks.named("javaRestTest"))
 
 tasks.named("javaRestTest").configure {
-  it.onlyIf { BuildParams.isSnapshotBuild() }
+  it.onlyIf("snapshot build") { BuildParams.isSnapshotBuild() }
   systemProperty 'tests.security.manager', 'false'
   systemProperty 'tests.system_call_filter', 'false'
   nonInputProperties.systemProperty 'log', testClusters.named("javaRestTest").map(c -> c.singleNode().getServerLog())

+ 1 - 1
test/framework/build.gradle

@@ -93,5 +93,5 @@ tasks.register("verifyVersions") {
 
 tasks.named('splitPackagesAudit').configure {
   // for now we always run tests with the classpath, so we are ok with split packages for tests
-  onlyIf { false }
+  enabled = false
 }

+ 1 - 1
x-pack/plugin/async-search/qa/rest/build.gradle

@@ -23,5 +23,5 @@ testClusters.configureEach {
 
 // Test clusters run with security disabled
 tasks.named("yamlRestTest") {
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 }

+ 1 - 1
x-pack/plugin/ccr/qa/build.gradle

@@ -10,6 +10,6 @@ subprojects {
   tasks.withType(Test).configureEach {
     // These fail in CI but only when run as part of checkPart2 and not individually.
     // Tracked in : https://github.com/elastic/elasticsearch/issues/66661
-    onlyIf { BuildParams.inFipsJvm == false }
+    BuildParams.withFipsEnabledOnly(it)
   }
 }

+ 1 - 1
x-pack/plugin/deprecation/qa/early-deprecation-rest/build.gradle

@@ -35,6 +35,6 @@ testClusters.configureEach {
 
 // Test clusters run with security disabled
 tasks.named("javaRestTest") {
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 }
 

+ 1 - 1
x-pack/plugin/deprecation/qa/rest/build.gradle

@@ -34,5 +34,5 @@ testClusters.configureEach {
 
 // Test clusters run with security disabled
 tasks.named("javaRestTest") {
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 }

+ 3 - 1
x-pack/plugin/eql/qa/correctness/build.gradle

@@ -41,7 +41,9 @@ def runTaskCluster = testClusters.register('runTask') {
 }
 
 tasks.named('javaRestTest').configure {
-  onlyIf { serviceAccountFile && BuildParams.inFipsJvm == false }
+  onlyIf("FIPS mode disabled and service accoutn file available") {
+      serviceAccountFile && BuildParams.inFipsJvm == false
+  }
 
   testLogging {
     showStandardStreams = true

+ 1 - 1
x-pack/plugin/eql/qa/mixed-node/build.gradle

@@ -43,7 +43,7 @@ BuildParams.bwcVersions.withWireCompatible(v -> v.onOrAfter("7.10.0") &&
             nonInputProperties.systemProperty('tests.rest.cluster', cluster.map(c -> c.allHttpSocketURI.join(",")))
             nonInputProperties.systemProperty('tests.clustername', baseName)
         }
-        onlyIf { project.bwc_tests_enabled }
+        onlyIf("BWC tests disabled") { project.bwc_tests_enabled }
     }
 
     tasks.register(bwcTaskName(bwcVersion)) {

+ 1 - 1
x-pack/plugin/identity-provider/qa/idp-rest-tests/build.gradle

@@ -49,6 +49,6 @@ testClusters.configureEach {
 
 // We don't support the IDP in FIPS-140 mode, so no need to run java rest tests
 tasks.named("javaRestTest").configure {
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 }
 

+ 5 - 5
x-pack/plugin/searchable-snapshots/qa/hdfs/build.gradle

@@ -5,7 +5,7 @@
  * 2.0.
  */
 
-import org.apache.tools.ant.taskdefs.condition.Os
+import org.elasticsearch.gradle.OS
 import org.elasticsearch.gradle.internal.info.BuildParams
 import org.elasticsearch.gradle.internal.test.RestIntegTestTask
 import org.elasticsearch.gradle.internal.util.ports.ReservedPortRange
@@ -70,7 +70,7 @@ for (String fixtureName : ['hdfsFixture', 'secureHdfsFixture']) {
     executable = "${BuildParams.runtimeJavaHome}/bin/java"
     env 'CLASSPATH', "${-> project.configurations.hdfsFixture.asPath}"
     maxWaitInSeconds 60
-    onlyIf { BuildParams.inFipsJvm == false }
+    BuildParams.withFipsEnabledOnly(it)
     waitCondition = { fixture, ant ->
       // the hdfs.MiniHDFS fixture writes the ports file when
       // it's ready, so we can just wait for the file to exist
@@ -107,7 +107,7 @@ tasks.named("javaRestTest").configure {
   def hdfsPort = project.getExtensions().getByType(ReservedPortRange).getOrAllocate("hdfsFixture")
   systemProperty 'test.hdfs.uri', "hdfs://localhost:$hdfsPort"
   nonInputProperties.systemProperty 'test.hdfs.path', '/user/elasticsearch/test/searchable_snapshots/simple'
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 }
 
 tasks.register("javaRestTestSecure", RestIntegTestTask) {
@@ -123,7 +123,7 @@ tasks.register("javaRestTestSecure", RestIntegTestTask) {
   )
   testClassesDirs = sourceSets.javaRestTest.output.classesDirs
   classpath = sourceSets.javaRestTest.runtimeClasspath
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 }
 tasks.named("check").configure { dependsOn("javaRestTestSecure") }
 
@@ -149,7 +149,7 @@ testClusters.matching { it.name == "javaRestTestSecure" }.configureEach {
 
 // Determine HDFS Fixture compatibility for the current build environment.
 boolean fixtureSupported = false
-if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+if (OS.current() != OS.WINDOWS) {
   // hdfs fixture will not start without hadoop native libraries on windows
   String nativePath = System.getenv("HADOOP_HOME")
   if (nativePath != null) {

+ 1 - 1
x-pack/plugin/security/qa/basic-enable-security/build.gradle

@@ -16,7 +16,7 @@ dependencies {
 
 tasks.named("javaRestTest").configure {
   // This test cluster is using a BASIC license and FIPS 140 mode is not supported in BASIC
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 
   usesDefaultDistribution()
 }

+ 8 - 6
x-pack/plugin/snapshot-repo-test-kit/qa/hdfs/build.gradle

@@ -6,7 +6,7 @@
  */
 
 
-import org.apache.tools.ant.taskdefs.condition.Os
+import org.elasticsearch.gradle.OS
 import org.elasticsearch.gradle.internal.info.BuildParams
 import org.elasticsearch.gradle.internal.test.RestIntegTestTask
 import org.elasticsearch.gradle.internal.util.ports.ReservedPortRange
@@ -71,7 +71,7 @@ for (String fixtureName : ['hdfsFixture', 'secureHdfsFixture']) {
     executable = "${BuildParams.runtimeJavaHome}/bin/java"
     env 'CLASSPATH', "${-> project.configurations.hdfsFixture.asPath}"
     maxWaitInSeconds 60
-    onlyIf { BuildParams.inFipsJvm == false }
+    BuildParams.withFipsEnabledOnly(it)
     waitCondition = { fixture, ant ->
       // the hdfs.MiniHDFS fixture writes the ports file when
       // it's ready, so we can just wait for the file to exist
@@ -81,7 +81,7 @@ for (String fixtureName : ['hdfsFixture', 'secureHdfsFixture']) {
 
     // If it's a secure fixture, then depend on Kerberos Fixture and principals + add the krb5conf to the JVM options
     if (name.equals('secureHdfsFixture')) {
-      onlyIf { BuildParams.runtimeJavaVersion < JavaVersion.VERSION_16 }
+      onlyIf("Only runtime java version < 16") { BuildParams.runtimeJavaVersion < JavaVersion.VERSION_16 }
       miniHDFSArgs.addAll(["--add-exports", "java.security.jgss/sun.security.krb5=ALL-UNNAMED"])
       miniHDFSArgs.add("-Djava.security.krb5.conf=${krb5conf}")
     }
@@ -109,7 +109,7 @@ tasks.named("javaRestTest").configure {
   def hdfsPort = project.getExtensions().getByType(ReservedPortRange).getOrAllocate("hdfsFixture")
   systemProperty 'test.hdfs.uri', "hdfs://localhost:$hdfsPort"
   nonInputProperties.systemProperty 'test.hdfs.path', '/user/elasticsearch/test/repository_test_kit/simple'
-  onlyIf { BuildParams.inFipsJvm == false }
+  BuildParams.withFipsEnabledOnly(it)
 }
 
 tasks.register("javaRestTestSecure", RestIntegTestTask) {
@@ -123,7 +123,9 @@ tasks.register("javaRestTestSecure", RestIntegTestTask) {
     "test.krb5.keytab.hdfs",
     project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("hdfs", "hdfs_hdfs.build.elastic.co.keytab")
   )
-  onlyIf { BuildParams.inFipsJvm == false && BuildParams.runtimeJavaVersion < JavaVersion.VERSION_16}
+  onlyIf("FIPS mode disabled and runtime java < 16") {
+    BuildParams.inFipsJvm == false && BuildParams.runtimeJavaVersion < JavaVersion.VERSION_16
+  }
   testClassesDirs = sourceSets.javaRestTest.output.classesDirs
   classpath = sourceSets.javaRestTest.runtimeClasspath
 }
@@ -147,7 +149,7 @@ testClusters.matching { it.name == "javaRestTestSecure" }.configureEach {
 
 // Determine HDFS Fixture compatibility for the current build environment.
 boolean fixtureSupported = false
-if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+if (OS.current() == OS.WINDOWS) {
   // hdfs fixture will not start without hadoop native libraries on windows
   String nativePath = System.getenv("HADOOP_HOME")
   if (nativePath != null) {

+ 1 - 1
x-pack/plugin/sql/qa/jdbc/security/with-ssl/build.gradle

@@ -11,5 +11,5 @@ testClusters.configureEach {
 
 // JDBC client can only be configured for SSL with keystores, but we can't use JKS/PKCS12 keystores in FIPS 140-2 mode.
 tasks.withType(Test).configureEach {
-  onlyIf { BuildParams.inFipsJvm == false}
+  BuildParams.withFipsEnabledOnly(it)
 }

+ 1 - 1
x-pack/plugin/sql/qa/mixed-node/build.gradle

@@ -51,7 +51,7 @@ BuildParams.bwcVersions.withWireCompatible(v -> v.onOrAfter("7.10.3") &&
           nonInputProperties.systemProperty('tests.clustername', baseName)
 
     }
-    onlyIf { project.bwc_tests_enabled }
+    onlyIf("BWC tests disabled") { project.bwc_tests_enabled }
   }
 
   tasks.register(bwcTaskName(bwcVersion)) {

+ 4 - 6
x-pack/plugin/sql/qa/server/security/with-ssl/build.gradle

@@ -3,12 +3,10 @@ import org.elasticsearch.gradle.internal.info.BuildParams
 apply plugin: 'elasticsearch.test-with-ssl'
 
 tasks.named("javaRestTest").configure {
-  onlyIf {
-    // Do not attempt to form a cluster in a FIPS JVM, as doing so with a JKS keystore will fail.
-    // TODO Revisit this when SQL CLI client can handle key/certificate instead of only Keystores.
-    // https://github.com/elastic/elasticsearch/issues/32306
-    BuildParams.inFipsJvm == false
-  }
+  // Do not attempt to form a cluster in a FIPS JVM, as doing so with a JKS keystore will fail.
+  // TODO Revisit this when SQL CLI client can handle key/certificate instead of only Keystores.
+  // https://github.com/elastic/elasticsearch/issues/32306
+  BuildParams.withFipsEnabledOnly(it)
 }
 
 testClusters.matching { it.name == "javaRestTest" }.configureEach {

+ 2 - 2
x-pack/qa/mixed-tier-cluster/build.gradle

@@ -42,7 +42,7 @@ BuildParams.bwcVersions.withWireCompatible(v -> v.onOrAfter("7.9.0") &&
       nonInputProperties.systemProperty('tests.rest.cluster', baseCluster.map(c->c.allHttpSocketURI.join(",")))
       nonInputProperties.systemProperty('tests.clustername', baseName)
     }
-    onlyIf { project.bwc_tests_enabled }
+    onlyIf("BWC tests disabled") { project.bwc_tests_enabled }
   }
 
   tasks.register(bwcTaskName(bwcVersion)) {
@@ -54,7 +54,7 @@ tasks.withType(Test).configureEach {
   classpath = sourceSets.javaRestTest.runtimeClasspath
   testClassesDirs = sourceSets.javaRestTest.output.classesDirs
   // Security is explicitly disabled, do not run tests in FIPS mode
-  onlyIf { BuildParams.inFipsJvm == false}
+  BuildParams.withFipsEnabledOnly(it)
   // TODO: AwaitsFix - https://github.com/elastic/elasticsearch/issues/94881
   enabled = false
 }

+ 2 - 4
x-pack/qa/repository-old-versions/build.gradle

@@ -5,7 +5,6 @@
  * 2.0.
  */
 
-import org.apache.tools.ant.taskdefs.condition.Os
 import org.elasticsearch.gradle.Architecture
 import org.elasticsearch.gradle.OS
 import org.elasticsearch.gradle.Version
@@ -14,7 +13,6 @@ import org.elasticsearch.gradle.internal.info.BuildParams
 import org.elasticsearch.gradle.internal.test.AntFixture
 import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
 import org.elasticsearch.gradle.transform.UnzipTransform
-import org.gradle.api.internal.artifacts.ArtifactAttributes
 
 apply plugin: 'elasticsearch.jdk-download'
 apply plugin: 'elasticsearch.internal-testclusters'
@@ -48,12 +46,12 @@ restResources {
   }
 }
 
-if (Os.isFamily(Os.FAMILY_MAC) && Architecture.current() == Architecture.AARCH64) {
+if (OS.current() == OS.MAC && Architecture.current() == Architecture.AARCH64) {
   jdks.legacy.vendor = 'zulu'
   jdks.legacy.distributionVersion = '8.56.0.23'
 }
 
-if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+if (OS.current() != OS.WINDOWS) {
   logger.warn("Disabling repository-old-versions tests because we can't get the pid file on windows")
 } else {
   /* Register a gradle artifact transformation to unpack resolved elasticsearch distributions. We only resolve

+ 1 - 1
x-pack/qa/rolling-upgrade-multi-cluster/build.gradle

@@ -92,5 +92,5 @@ BuildParams.bwcVersions.withWireCompatible { bwcVersion, baseName ->
 
 // Security is explicitly disabled, do not run tests in FIPS mode
 tasks.withType(Test).configureEach {
-  onlyIf { BuildParams.inFipsJvm == false}
+  BuildParams.withFipsEnabledOnly(it)
 }

+ 6 - 2
x-pack/qa/saml-idp-tests/build.gradle

@@ -17,7 +17,9 @@ String outputDir = "${project.buildDir}/generated-resources/${project.name}"
 tasks.register("copyIdpFiles", Sync) {
   dependsOn idpFixtureProject.postProcessFixture
   // Don't attempt to get ephemeral ports when Docker is not available
-  onlyIf { idpFixtureProject.postProcessFixture.state.skipped == false }
+  onlyIf(idpFixtureProject.postProcessFixture.path + " not skipped") {
+    idpFixtureProject.postProcessFixture.state.skipped == false
+  }
   from idpFixtureProject.files('idp/shibboleth-idp/credentials/idp-browser.pem', 'idp/shibboleth-idp/metadata/idp-metadata.xml',
     'idp/shibboleth-idp/credentials/sp-signing.key', 'idp/shibboleth-idp/credentials/sp-signing.crt');
   into outputDir
@@ -31,7 +33,9 @@ tasks.register("copyIdpFiles", Sync) {
 
 tasks.named("javaRestTest").configure {
   classpath += files(tasks.named("copyIdpFiles"))
-  onlyIf { idpFixtureProject.postProcessFixture.state.skipped == false }
+  onlyIf(idpFixtureProject.postProcessFixture.path + " not skipped") {
+    idpFixtureProject.postProcessFixture.state.skipped == false
+  }
 }
 
 testClusters.matching { it.name == "javaRestTest" }.configureEach {