Skip to content

Commit

Permalink
Merge 'origin/main' into lucene_snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHegarty committed Nov 29, 2023
2 parents 8502d7a + 3b834b5 commit fa4057d
Show file tree
Hide file tree
Showing 178 changed files with 3,897 additions and 2,082 deletions.
4 changes: 2 additions & 2 deletions .buildkite/scripts/dra-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ fi
echo --- Preparing

# TODO move this to image
sudo apt-get update -y
sudo apt-get install -y libxml2-utils python3.10-venv
sudo NEEDRESTART_MODE=l apt-get update -y
sudo NEEDRESTART_MODE=l apt-get install -y libxml2-utils python3.10-venv

RM_BRANCH="$BRANCH"
if [[ "$BRANCH" == "main" ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public SearchLookup lookup() {
public Set<String> sourcePaths(String name) {
return Set.of(name);
}

@Override
public String parentField(String field) {
throw new UnsupportedOperationException();
}
});
}
throw new IllegalArgumentException("can't read [" + name + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ abstract class AbstractRestResourcesFuncTest extends AbstractGradleFuncTest {
}
"""

subProject(":distribution:archives:integ-test-zip") << "configurations { extracted }"
subProject(":distribution:archives:integ-test-zip") << "configurations.create('extracted')\n"
subProject(":distribution:archives:integ-test-zip") << "configurations.create('default')\n"
}

void setupRestResources(List<String> apis, List<String> tests = [], List<String> xpackTests = []) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class LegacyYamlRestTestPluginFuncTest extends AbstractRestResourcesFuncTest {

def "yamlRestTest does nothing when there are no tests"() {
given:
// RestIntegTestTask not cc compatible due to
configurationCacheCompatible = false
buildFile << """
plugins {
id 'elasticsearch.legacy-yaml-rest-test'
Expand All @@ -43,8 +41,6 @@ class LegacyYamlRestTestPluginFuncTest extends AbstractRestResourcesFuncTest {

def "yamlRestTest executes and copies api and tests to correct source set"() {
given:
// RestIntegTestTask not cc compatible due to
configurationCacheCompatible = false
internalBuild()
buildFile << """
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
Expand All @@ -56,9 +52,10 @@ class LegacyYamlRestTestPluginFuncTest extends AbstractRestResourcesFuncTest {
// can't actually spin up test cluster from this test
tasks.withType(Test).configureEach{ enabled = false }
def clazzpath = sourceSets.yamlRestTest.runtimeClasspath
tasks.register("printYamlRestTestClasspath").configure {
doLast {
println sourceSets.yamlRestTest.runtimeClasspath.asPath
println clazzpath.asPath
}
}
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,12 @@ public void doCall() {
}
});

boolean isModule = GradleUtils.isModuleProject(project.getPath());
boolean isXPackModule = isModule && project.getPath().startsWith(":x-pack");
if (isModule == false || isXPackModule) {
addNoticeGeneration(project, extension);
}
project.afterEvaluate(p -> {
boolean isModule = GradleUtils.isModuleProject(p.getPath());
boolean isXPackModule = isModule && p.getPath().startsWith(":x-pack");
if (isModule == false || isXPackModule) {
addNoticeGeneration(p, extension);
}

@SuppressWarnings("unchecked")
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.file.SourceDirectorySet;
import org.gradle.api.internal.file.FileOperations;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.PathSensitive;
Expand All @@ -43,7 +43,7 @@
* A task to create a notice file which includes dependencies' notices.
*/
@CacheableTask
public class NoticeTask extends DefaultTask {
public abstract class NoticeTask extends DefaultTask {

@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
Expand All @@ -57,19 +57,17 @@ public class NoticeTask extends DefaultTask {
/**
* Directories to include notices from
*/
private final ListProperty<File> licensesDirs;
@Internal
abstract ListProperty<File> getLicenseDirs();

private final FileOperations fileOperations;
private ObjectFactory objectFactory;

@Inject
public NoticeTask(BuildLayout buildLayout, ProjectLayout projectLayout, FileOperations fileOperations, ObjectFactory objectFactory) {
this.objectFactory = objectFactory;
public NoticeTask(BuildLayout buildLayout, ProjectLayout projectLayout, FileOperations fileOperations) {
this.fileOperations = fileOperations;
setDescription("Create a notice file from dependencies");
// Default licenses directory is ${projectDir}/licenses (if it exists)
licensesDirs = objectFactory.listProperty(File.class);
licensesDirs.add(projectLayout.getProjectDirectory().dir("licenses").getAsFile());
getLicenseDirs().add(projectLayout.getProjectDirectory().dir("licenses").getAsFile());
inputFile = new File(buildLayout.getRootDirectory(), "NOTICE.txt");
outputFile = projectLayout.getBuildDirectory().dir("notices/" + getName()).get().file("NOTICE.txt").getAsFile();
}
Expand All @@ -78,7 +76,7 @@ public NoticeTask(BuildLayout buildLayout, ProjectLayout projectLayout, FileOper
* Add notices from the specified directory.
*/
public void licensesDir(File licensesDir) {
licensesDirs.add(licensesDir);
getLicenseDirs().add(licensesDir);
}

public void source(Object source) {
Expand Down Expand Up @@ -185,7 +183,7 @@ public FileCollection getNoticeFiles() {
}

private List<File> existingLicenseDirs() {
return licensesDirs.get().stream().filter(d -> d.exists()).collect(Collectors.toList());
return getLicenseDirs().get().stream().filter(d -> d.exists()).collect(Collectors.toList());
}

@InputFiles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":modules:percolator");
map.put(LegacyRestTestBasePlugin.class, ":modules:rank-eval");
map.put(LegacyRestTestBasePlugin.class, ":modules:reindex");
map.put(LegacyRestTestBasePlugin.class, ":modules:repository-s3");
map.put(LegacyRestTestBasePlugin.class, ":modules:repository-url");
map.put(LegacyRestTestBasePlugin.class, ":modules:transport-netty4");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-icu");
Expand Down Expand Up @@ -138,11 +137,9 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:multi-cluster-tests-with-security");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:native-multi-node-tests");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ml:qa:single-node-tests");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:repositories-metering-api:qa:s3");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:hdfs");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:minio");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:s3");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:searchable-snapshots:qa:url");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:tls-basic");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:multi-node");
Expand All @@ -151,11 +148,9 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:fs");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:license-enforcing");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:s3");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:hdfs");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:minio");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:s3");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:multi-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:no-sql");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:jdbc:single-node");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@
import org.gradle.api.specs.NotSpec;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.Sync;
import org.gradle.api.tasks.TaskContainer;
import org.gradle.api.tasks.bundling.Zip;

import java.util.Collections;

import javax.inject.Inject;

import static org.elasticsearch.gradle.internal.RestrictedBuildApiService.BUILD_API_RESTRICTIONS_SYS_PROPERTY;
Expand Down Expand Up @@ -131,11 +128,7 @@ public void apply(Project project) {
}

private void configureCacheability(StandaloneRestIntegTestTask testTask) {
TaskContainer tasks = project.getTasks();
Spec<Task> taskSpec = t -> tasks.withType(StandaloneRestIntegTestTask.class)
.stream()
.filter(task -> task != testTask)
.anyMatch(task -> Collections.disjoint(task.getClusters(), testTask.getClusters()) == false);
Spec<Task> taskSpec = task -> testTask.getClusters().stream().anyMatch(ElasticsearchCluster::isShared);
testTask.getOutputs()
.doNotCacheIf(
"Caching disabled for this task since it uses a cluster shared by other tasks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void apply(Project project) {
NamedDomainObjectContainer<ElasticsearchCluster> clusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
clusters.all(c -> {
clusters.configureEach(c -> {
if (BuildParams.isInFipsJvm()) {
c.setting("xpack.security.transport.ssl.key", "test-node.key");
c.keystore("xpack.security.transport.ssl.secure_key_passphrase", "test-node-key-password");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class TestClustersPluginFuncTest extends AbstractGradleFuncTest {

then:
result.output.contains("Task ':myTask' is not up-to-date because:\n" +
" Input property 'clusters.myCluster\$0.nodes.\$0.$propertyName'")
" Input property 'clusters.myCluster\$0.$propertyName'")
result.output.contains("elasticsearch-keystore script executed!")
assertEsOutputContains("myCluster", "Starting Elasticsearch process")
assertEsOutputContains("myCluster", "Stopping node")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void apply(Project project) {
}

private void setupDistributionContainer(Project project, Property<Boolean> dockerAvailable) {

distributionsContainer = project.container(ElasticsearchDistribution.class, name -> {
Configuration fileConfiguration = project.getConfigurations().create(DISTRO_CONFIG_PREFIX + name);
Configuration extractedConfiguration = project.getConfigurations().create(DISTRO_EXTRACTED_CONFIG_PREFIX + name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public String toString() {
private final Property<Boolean> failIfUnavailable;
private final Property<Boolean> preferArchive;
private final ConfigurableFileCollection extracted;
private Action<ElasticsearchDistribution> distributionFinalizer;
private transient Action<ElasticsearchDistribution> distributionFinalizer;
private boolean frozen = false;

ElasticsearchDistribution(
Expand Down
Loading

0 comments on commit fa4057d

Please sign in to comment.