Skip to content

Commit

Permalink
Merge branch 'deletepit' of github.com:bharath-techie/OpenSearch into…
Browse files Browse the repository at this point in the history
… listallpits
  • Loading branch information
bharath-techie committed May 13, 2022
2 parents c537034 + fe4e41a commit 0e46975
Show file tree
Hide file tree
Showing 3,148 changed files with 16,139 additions and 3,040 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .ci/bwcVersions
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ BWC_VERSION:
- "1.3.0"
- "1.3.1"
- "1.3.2"
- "1.3.3"
- "2.0.0"
- "2.1.0"
17 changes: 12 additions & 5 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
## Maintainers
- [Current Maintainers](#current-maintainers)
- [Emeritus](#emeritus)

## Current Maintainers

| Maintainer | GitHub ID | Affiliation |
| --------------- | --------- | ----------- |
| Abbas Hussain | [abbashus](https://github.com/abbashus) | Amazon |
| Anas Alkouz | [anasalkouz](https://github.com/anasalkouz) | Amazon |
| Andrew Ross | [andrross](https://github.com/andrross)| Amazon |
| Andriy Redko | [reta](https://github.com/reta) | Aiven |
| Bukhtawar Khan | [Bukhtawar](https://github.com/Bukhtawar) | Amazon |
| Charlotte Henkle | [CEHENKLE](https://github.com/CEHENKLE) | Amazon |
| Daniel "dB." Doubrovkine | [dblock](https://github.com/dblock) | Amazon |
| Gopala Krishna Ambareesh | [krishna-ggk](https://github.com/krishna-ggk) |Amazon |
| Himanshu Setia | [setiah](https://github.com/setiah) | Amazon |
| Itiyama Sadana | [itiyamas](https://github.com/itiyamas) | Amazon |
| Kartik Ganesh | [kartg](https://github.com/kartg) | Amazon |
| Kunal Kotwani | [kotwanikunal](https://github.com/kotwanikunal) | Amazon |
| Marc Handalian | [mch2](https://github.com/mch2) | Amazon |
| Megha Sai Kavikondala | [meghasaik](https://github.com/meghasaik) | Amazon |
| Nick Knize | [nknize](https://github.com/nknize) | Amazon |
| Owais Kazi | [owaiskazi19](https://github.com/owaiskazi19) | Amazon |
| Rabi Panda | [adnapibar](https://github.com/adnapibar) | Amazon |
Expand All @@ -23,7 +25,12 @@
| Shweta Thareja |[shwetathareja](https://github.com/shwetathareja) | Amazon |
| Tianli Feng | [tlfeng](https://github.com/tlfeng) | Amazon |
| Vacha Shah | [VachaShah](https://github.com/VachaShah) | Amazon |
| Vengadanathan Srinivasan | [vengadanathan-s](https://github.com/vengadanathan-s) | Amazon |
| Xue Zhou | [xuezhou25](https://github.com/xuezhou25) | Amazon |

## Emeritus

| Maintainer | GitHub ID | Affiliation |
| --------------- | --------- | ----------- |
| Megha Sai Kavikondala | [meghasaik](https://github.com/meghasaik) | Amazon |

[This document](https://github.com/opensearch-project/.github/blob/main/MAINTAINERS.md) explains what maintainers do in this repo, and how they should be doing it. If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ plugins {
id 'lifecycle-base'
id 'opensearch.docker-support'
id 'opensearch.global-build-info'
id "com.diffplug.spotless" version "6.4.2" apply false
id "com.diffplug.spotless" version "6.5.2" apply false
id "org.gradle.test-retry" version "1.3.2" apply false
id "test-report-aggregation"
id 'jacoco-report-aggregation'
Expand Down Expand Up @@ -278,6 +278,7 @@ allprojects {
// see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959
javadoc.options.encoding = 'UTF8'
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
javadoc.options.tags = ["opensearch.internal", "opensearch.api", "opensearch.experimental"]
}

// support for reproducible builds
Expand Down Expand Up @@ -387,7 +388,7 @@ gradle.projectsEvaluated {
}
}
}

dependencies {
subprojects.findAll { it.pluginManager.hasPlugin('java') }.forEach {
testReportAggregation it
Expand All @@ -413,7 +414,7 @@ subprojects {
// eclipse configuration
allprojects {
apply plugin: 'eclipse'

// Name all the non-root projects after their path so that paths get grouped together when imported into eclipse.
if (path != ':') {
eclipse.project.name = path
Expand Down Expand Up @@ -573,12 +574,12 @@ subprojects {

reporting {
reports {
testAggregateTestReport(AggregateTestReport) {
testAggregateTestReport(AggregateTestReport) {
testType = TestSuiteType.UNIT_TEST
}
}
}

tasks.named(JavaBasePlugin.CHECK_TASK_NAME) {
dependsOn tasks.named('testAggregateTestReport', TestReport)
dependsOn tasks.named('testAggregateTestReport', TestReport)
}
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ dependencies {
testFixturesApi "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"
testFixturesApi gradleApi()
testFixturesApi gradleTestKit()
testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone:2.32.0'
testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone:2.33.2'
testImplementation "org.mockito:mockito-core:${props.getProperty('mockito')}"
integTestImplementation('org.spockframework:spock-core:2.1-groovy-3.0') {
exclude module: "groovy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ public String call() throws Exception {
publication.artifact(project.getTasks().getByName("sourcesJar"));
publication.artifact(project.getTasks().getByName("javadocJar"));
}

generatePomTask.configure(
t -> t.dependsOn(String.format("generatePomFileFor%sPublication", Util.capitalize(publication.getName())))
);
}

generatePomTask.configure(
t -> t.dependsOn(String.format("generatePomFileFor%sPublication", Util.capitalize(publication.getName())))
);
});

}
Expand Down
38 changes: 27 additions & 11 deletions buildSrc/src/main/java/org/opensearch/gradle/pluginzip/Publish.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
*/
package org.opensearch.gradle.pluginzip;

import java.util.*;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.publish.Publication;
import org.gradle.api.publish.PublishingExtension;
import org.gradle.api.publish.maven.MavenPublication;
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;

import java.nio.file.Path;
import org.gradle.api.Task;

public class Publish implements Plugin<Project> {
private Project project;

public final static String EXTENSION_NAME = "zipmavensettings";
public final static String PUBLICATION_NAME = "pluginZip";
public final static String STAGING_REPO = "zipStaging";
Expand All @@ -37,15 +37,27 @@ public static void configMaven(Project project) {
});
});
publishing.publications(publications -> {
publications.create(PUBLICATION_NAME, MavenPublication.class, mavenZip -> {
final Publication publication = publications.findByName(PUBLICATION_NAME);
if (publication == null) {
publications.create(PUBLICATION_NAME, MavenPublication.class, mavenZip -> {
String zipGroup = "org.opensearch.plugin";
String zipArtifact = project.getName();
String zipVersion = getProperty("version", project);
mavenZip.artifact(project.getTasks().named("bundlePlugin"));
mavenZip.setGroupId(zipGroup);
mavenZip.setArtifactId(zipArtifact);
mavenZip.setVersion(zipVersion);
});
} else {
final MavenPublication mavenZip = (MavenPublication) publication;
String zipGroup = "org.opensearch.plugin";
String zipArtifact = project.getName();
String zipVersion = getProperty("version", project);
mavenZip.artifact(project.getTasks().named("bundlePlugin"));
mavenZip.setGroupId(zipGroup);
mavenZip.setArtifactId(zipArtifact);
mavenZip.setVersion(zipVersion);
});
}
});
});
}
Expand All @@ -62,13 +74,17 @@ static String getProperty(String name, Project project) {

@Override
public void apply(Project project) {
this.project = project;
project.afterEvaluate(evaluatedProject -> { configMaven(project); });
project.getGradle().getTaskGraph().whenReady(graph -> {
if (graph.hasTask(LOCALMAVEN)) {
project.getTasks().getByName(PLUGIN_ZIP_PUBLISH_POM_TASK).setEnabled(false);
project.afterEvaluate(evaluatedProject -> {
configMaven(project);
Task validatePluginZipPom = project.getTasks().findByName("validatePluginZipPom");
if (validatePluginZipPom != null) {
project.getTasks().getByName("validatePluginZipPom").dependsOn("generatePomFileForNebulaPublication");
}
Task publishPluginZipPublicationToZipStagingRepository = project.getTasks()
.findByName("publishPluginZipPublicationToZipStagingRepository");
if (publishPluginZipPublicationToZipStagingRepository != null) {
publishPluginZipPublicationToZipStagingRepository.dependsOn("generatePomFileForNebulaPublication");
}

});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
public class DistroTestPlugin implements Plugin<Project> {
private static final String SYSTEM_JDK_VERSION = "8u242+b08";
private static final String SYSTEM_JDK_VENDOR = "adoptopenjdk";
private static final String GRADLE_JDK_VERSION = "17.0.2+8";
private static final String GRADLE_JDK_VERSION = "17.0.3+7";
private static final String GRADLE_JDK_VENDOR = "adoptium";

// all distributions used by distro tests. this is temporary until tests are per distribution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,42 @@
import org.gradle.testfixtures.ProjectBuilder;
import org.gradle.api.Project;
import org.opensearch.gradle.test.GradleUnitTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.IOException;
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository;
import java.io.File;
import org.gradle.testkit.runner.BuildResult;
import java.io.FileWriter;
import java.io.Writer;
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;
import static org.junit.Assert.assertEquals;
import java.nio.file.Files;

import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;

import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.FileReader;
import org.gradle.api.tasks.bundling.Zip;

import java.util.List;
import java.util.ArrayList;

public class PublishTests extends GradleUnitTestCase {
private TemporaryFolder projectDir;

@Before
public void setUp() throws IOException {
projectDir = new TemporaryFolder();
projectDir.create();
}

@After
public void tearDown() {
projectDir.delete();
}

@Test
public void testZipPublish() throws IOException, XmlPullParserException {
Expand All @@ -48,14 +67,14 @@ public void testZipPublish() throws IOException, XmlPullParserException {
assertTrue(project.getTasks().getNames().contains(zipPublishTask));
assertNotNull("Task to generate: ", project.getTasks().getByName(zipPublishTask));
// Run Gradle functional tests, but calling a build.gradle file, that resembles the plugin publish behavior
File projectDir = new File("build/functionalTest");

// Create a sample plugin zip file
File sampleZip = new File("build/functionalTest/sample-plugin.zip");
Files.createDirectories(projectDir.toPath());
File sampleZip = new File(projectDir.getRoot(), "sample-plugin.zip");
Files.createFile(sampleZip.toPath());
writeString(new File(projectDir, "settings.gradle"), "");
writeString(projectDir.newFile("settings.gradle"), "");
// Generate the build.gradle file
String buildFileContent = "apply plugin: 'maven-publish' \n"
+ "apply plugin: 'java' \n"
+ "publishing {\n"
+ " repositories {\n"
+ " maven {\n"
Expand All @@ -72,25 +91,31 @@ public void testZipPublish() throws IOException, XmlPullParserException {
+ " }\n"
+ " }\n"
+ "}";
writeString(new File(projectDir, "build.gradle"), buildFileContent);
writeString(projectDir.newFile("build.gradle"), buildFileContent);
// Execute the task publishPluginZipPublicationToZipStagingRepository
List<String> allArguments = new ArrayList<String>();
allArguments.add("build");
allArguments.add(zipPublishTask);
GradleRunner runner = GradleRunner.create();
runner.forwardOutput();
runner.withPluginClasspath();
runner.withArguments(zipPublishTask);
runner.withProjectDir(projectDir);
runner.withArguments(allArguments);
runner.withProjectDir(projectDir.getRoot());
BuildResult result = runner.build();
// Check if task publishMavenzipPublicationToZipstagingRepository has ran well
assertEquals(SUCCESS, result.task(":" + zipPublishTask).getOutcome());
// check if the zip has been published to local staging repo
assertTrue(
new File("build/functionalTest/local-staging-repo/org/opensearch/plugin/sample-plugin/2.0.0.0/sample-plugin-2.0.0.0.zip")
new File(projectDir.getRoot(), "local-staging-repo/org/opensearch/plugin/sample-plugin/2.0.0.0/sample-plugin-2.0.0.0.zip")
.exists()
);
assertEquals(SUCCESS, result.task(":" + "build").getOutcome());
// Parse the maven file and validate the groupID to org.opensearch.plugin
MavenXpp3Reader reader = new MavenXpp3Reader();
Model model = reader.read(
new FileReader("build/functionalTest/local-staging-repo/org/opensearch/plugin/sample-plugin/2.0.0.0/sample-plugin-2.0.0.0.pom")
new FileReader(
new File(projectDir.getRoot(), "local-staging-repo/org/opensearch/plugin/sample-plugin/2.0.0.0/sample-plugin-2.0.0.0.pom")
)
);
assertEquals(model.getGroupId(), "org.opensearch.plugin");
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ opensearch = 3.0.0
lucene = 9.2.0-snapshot-f4f1f70

bundled_jdk_vendor = adoptium
bundled_jdk = 17.0.2+8
bundled_jdk = 17.0.3+7



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,9 @@ static void addSearchRequestParams(Params params, SearchRequest searchRequest) {
params.withIndicesOptions(searchRequest.indicesOptions());
}
params.withSearchType(searchRequest.searchType().name().toLowerCase(Locale.ROOT));
if (searchRequest.pointInTimeBuilder() == null) {
if (searchRequest.pointInTimeBuilder() != null) {
params.putParam("ccs_minimize_roundtrips", "false");
} else {
params.putParam("ccs_minimize_roundtrips", Boolean.toString(searchRequest.isCcsMinimizeRoundtrips()));
}
if (searchRequest.getPreFilterShardSize() != null) {
Expand All @@ -466,9 +468,8 @@ static Request searchScroll(SearchScrollRequest searchScrollRequest) throws IOEx

static Request createPit(CreatePitRequest createPitRequest) throws IOException {
Params params = new Params();

params.putParam(RestCreatePitAction.ALLOW_PARTIAL_PIT_CREATION, "true");
params.putParam(RestCreatePitAction.KEEP_ALIVE, "1d");
params.putParam(RestCreatePitAction.ALLOW_PARTIAL_PIT_CREATION, Boolean.toString(createPitRequest.shouldAllowPartialPitCreation()));
params.putParam(RestCreatePitAction.KEEP_ALIVE, createPitRequest.getKeepAlive());
params.withIndicesOptions(createPitRequest.indicesOptions());
Request request = new Request(HttpPost.METHOD_NAME, endpoint(createPitRequest.indices(), "_search/point_in_time"));
request.addParameters(params.asMap());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,12 @@ private String getOpenSearchUrl(
stagingHash
);
} else {
baseUrl = String.format(Locale.ROOT, "https://artifacts.opensearch.org/releases/plugins/%s/%s", pluginId, version);
baseUrl = String.format(
Locale.ROOT,
"https://artifacts.opensearch.org/releases/plugins/%s/%s",
pluginId,
Build.CURRENT.getQualifiedVersion()
);
}
final String platformUrl = String.format(
Locale.ROOT,
Expand Down
Loading

0 comments on commit 0e46975

Please sign in to comment.