Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog Post: OpenSearch plugin zips now in Maven repo #930

Merged
merged 14 commits into from
Aug 25, 2022
Merged
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ end
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

gem "rouge"

gem "webrick", "~> 1.7"
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ GEM
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)
webrick (1.7.0)

PLATFORMS
ruby
Expand All @@ -91,6 +92,7 @@ DEPENDENCIES
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
webrick (~> 1.7)

BUNDLED WITH
2.3.5
2.3.18
8 changes: 8 additions & 0 deletions _authors/prudhvigodithi.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Prudhvi Godithi
short_name: prudhvigodithi
linkedin: 'prudhvi-godithi'
photo: '/assets/media/authors/prudhvigodithi.jpg'
---

**Prudhvi Godithi** is a System Enginner at AWS working on the OpenSearch project.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to "is an AWS System Engineer working on the OpenSearch project."

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
layout: post
title: "OpenSearch plugin zips now in Maven repo"
authors:
- prudhvigodithi
date: 2022-07-24 01:01:01 -0700
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prudhvigodithi since this has been in edit for a while - please update this date

categories:
- technical-post
twittercard:
description: "Details on how to consume OpenSearch plugin zips from maven repo and the process involved in shipping them to the maven repo."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize both instances of "Maven". Additionally, should it be "Details on how to consume OpenSearch plugin zips from a Maven repo and the process involved in shipping them to a Maven repo."?

---

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the Summary section and used that description as the Intro.

Suggested change
Starting with the release of OpenSearch `2.1.0`, OpenSearch plugin zips are now signed and published to a central Apache Maven [repo](https://repo1.maven.org/maven2/org/opensearch/plugin/). Using the [Release zips Maven Repo](https://repo1.maven.org/maven2/org/opensearch/plugin/) and [Snapshot zips Maven Repo](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/) URL’s, OpenSearch plugin zips can now be consumed as a dependency to build other plugins or fetched as standalone components for your OpenSearch cluster.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sentence Reformation:

Starting with the release of OpenSearch 2.1.0, OpenSearch plugin zips are now signed and published to a central Apache Maven repo. Using the Release zips and Snapshot zips Maven Repo URL’s, OpenSearch plugin zips can now be consumed as a dependency to build other plugins or fetched as standalone components for your OpenSearch cluster.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In "Maven Repo URL's", change to "Maven repo URLs".

### Motivation and Current Challenges:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Motivation and Current Challenges:
## Motivation


The plugins zips that are used as dependencies cannot be downloaded dynamically during runtime, as they are not part of version controlled maven system. Only the respective Java jars are available to download using maven coordinates. This forces a user to now to use a dependency plugin zip of some random version built on a developer desktop, which is not reliable, also the tests executed as part of this build zip cannot be accurate, so eventually for few plugins the local build zip is forced to check in to the plugin repo to facilitate the plugin availability for dependency, this is one of the challenge faced by the community. Coming to the download part of plugins as separate isolated components via a cached mechanism like maven is not possible, with this challenge users had to pre-bake the random built zip to the project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The plugins zips that are used as dependencies cannot be downloaded dynamically during runtime, as they are not part of version controlled maven system. Only the respective Java jars are available to download using maven coordinates. This forces a user to now to use a dependency plugin zip of some random version built on a developer desktop, which is not reliable, also the tests executed as part of this build zip cannot be accurate, so eventually for few plugins the local build zip is forced to check in to the plugin repo to facilitate the plugin availability for dependency, this is one of the challenge faced by the community. Coming to the download part of plugins as separate isolated components via a cached mechanism like maven is not possible, with this challenge users had to pre-bake the random built zip to the project.
Before OpenSearch 2.1, plugin zips used as dependencies could not be downloaded dynamically during runtime, because plugin zips were not a part of the version-controlled Maven system. The only mechanism for plugin downloads was OpenSearch respective Java jars fetched through Maven coordinates. The Java jars forced users who wanted more control over their OpenSearch plugin configuration to use a random plugin version built on a developer desktop, instead of a more reliable version-controlled plugin.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we re-form the sentence to match the meaning as follows

Before OpenSearch 2.1, plugin zips used as dependencies could not be downloaded dynamically during runtime, because plugin zips were not a part of the version-controlled Maven system. Only the respective Java jars are available to download using maven coordinates. This forces a user to now to use a dependency plugin zip of some random version built on a developer desktop, instead of a more reliable version-controlled plugin.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the commas after "runtime" and "desktop". Capitalize the second instance of "Maven".


Starting with release `2.1.0` OpenSearch plugin zips are now signed and published to central maven repo, with `groupID` as [org.opensearch.plugin](https://repo1.maven.org/maven2/org/opensearch/plugin/). These zips can now be fetched as individual components by directly downloading using maven coordinates or by clickstream from central maven repo which can be later cached to the desired user local maven repo. The snapshot version of the zips can be fetched from nexus maven repo with the same `groupID` as [org.opensearch.plugin](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Starting with release `2.1.0` OpenSearch plugin zips are now signed and published to central maven repo, with `groupID` as [org.opensearch.plugin](https://repo1.maven.org/maven2/org/opensearch/plugin/). These zips can now be fetched as individual components by directly downloading using maven coordinates or by clickstream from central maven repo which can be later cached to the desired user local maven repo. The snapshot version of the zips can be fetched from nexus maven repo with the same `groupID` as [org.opensearch.plugin](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/).
Furthermore, tests executed against as part ofthe OpenSearch build process from zip were not accurate, as each local build zip had to check against the plugin repo in order to ensure that plugin's availability. These restrictions were challenging to our community, since those wishing to use plugin zips as separate isolated components via a cached mechanism proved to be impossible.

Copy link
Member Author

@prudhvigodithi prudhvigodithi Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, small change though

Furthermore, to facilitate the plugin availability as dependency, the plugin zip's are forced to check in to the plugin repo and so tests executed as part of the OpenSearch build process are not accurate. These restrictions were challenging to our community, since those wishing to use plugin zips as separate isolated components via a cached mechanism proved to be impossible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add "a" between "as" and "dependency" ("as a dependency"). Change "zip's" to "zips" (no apostrophe). Change to "...to the plugin repo, so tests...". Remove the comma after "community". Change "since those wishing to use" to "since using".


### Maven publish task with custom gradle plugin.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed the order of the "Benefits" and "Gradle" sections.

Suggested change
### Maven publish task with custom gradle plugin.
## Benefits of plugin zips in Maven


The publishing of zips to central maven repo had been possible with custom gradle plugin `opensearch.pluginzip`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The publishing of zips to central maven repo had been possible with custom gradle plugin `opensearch.pluginzip`.
With Maven, plugin zips can now be retrieved by:
- Downloading each plugin directly using their respective Maven coordinates
- Using clickstream from the central Maven repo, which can be cached later to a local Maven repo.
- Fetching the development `Snapshot` version with same Mavin `groupID` as [org.opensearch.plugin](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some additional change to last point

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a terminating period to the first list item. In the second list item, should it be "a clickstream"? In the third list item, change "with same Mavin" to "with the same Maven".

Starting with release `2.1.0` all OpenSearch gradle supported plugins will have custom gradle plugin `opensearch.pluginzip` applied to the gradle project, this will create a new task `publishPluginZipPublicationToZipStagingRepository` which does all the heavy lifting in identifying the distribution plugin zip, setting the maven coordinates, generating the POM file, updating the user passed POM fields and publishing it to maven repo. More details and inner workings of the plugin can found at [opensearch-plugins](https://github.com/opensearch-project/opensearch-plugins/blob/main/BUILDING.md#opensearchpluginzip).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Starting with release `2.1.0` all OpenSearch gradle supported plugins will have custom gradle plugin `opensearch.pluginzip` applied to the gradle project, this will create a new task `publishPluginZipPublicationToZipStagingRepository` which does all the heavy lifting in identifying the distribution plugin zip, setting the maven coordinates, generating the POM file, updating the user passed POM fields and publishing it to maven repo. More details and inner workings of the plugin can found at [opensearch-plugins](https://github.com/opensearch-project/opensearch-plugins/blob/main/BUILDING.md#opensearchpluginzip).
Using OpenSearch plugin zips through Maven offers the following benefits:
- Plugins zip in the central Maven repo is already signed with `.asc`, `.md5`, `.sha1`, `.sha256`, `.sha512` extensions.
- Users are no longer required to to check in zips to any `src/` files, since zips can be fetched with the right `groupID`, `artifactID` and `version`.
- Tests and CI workflows can directly run against the Maven repo, instead of requiring a manual download.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Tests and CI workflows can directly run against the zips from Maven repo, instead of requiring a manual download.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the first list item, change to "Plugin zips in the central Maven repo are already signed with...". Add "and" after the last comma. In the second list item, remove the comma after "files" and add a comma after "'artifactID'". In the third list item, change to "Tests and CI workflows can run directly against the Maven repo instead of requiring a manual download."



**Figure 1**: Workflow that ship generated plugin zips to maven
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Figure 1**: Workflow that ship generated plugin zips to maven


![Figure 1: Workflow that ship zips to maven]({{ site.baseurl }}/assets/media/blog-images/2022-07-24-opensearch-plugin-zips-now-in-maven-repo/figure1.png){: .img-fluid }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
![Figure 1: Workflow that ship zips to maven]({{ site.baseurl }}/assets/media/blog-images/2022-07-24-opensearch-plugin-zips-now-in-maven-repo/figure1.png){: .img-fluid }


### Benefits of plugin zips in maven:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Benefits of plugin zips in maven:
### Maven zip publication and gradle

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heading change as Maven zip publication with Gradle


* The plugin dependencies can now be fetched using the right maven coordinates from maven repo and a user need not use a zip of some random version built on a developer desktop.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The plugin dependencies can now be fetched using the right maven coordinates from maven repo and a user need not use a zip of some random version built on a developer desktop.
## Maven zip publication and gradle
OpenSearch publishes plugin zips using a custom gradle plugin `opensearch.pluginzip`. With OpenSearch 2.1, all OpenSearch gradle supported plugins create a new task, `publishPluginZipPublicationToZipStagingRepository`. The task performs all the heavy lifting for users by:
- Identifying the distribution plugin zip
- Setting the Maven coordinates
- Generating the POM file
- Updating the user-generated PM fields
- Publishing the task to your Maven repo
You can find more details about the inner workings of OpenSearch plugins in the [opensearch-plugins repo](https://github.com/opensearch-project/opensearch-plugins/blob/main/BUILDING.md#opensearchpluginzip).
**Figure**: Workflow that ship generated plugin zips to maven
![Figure: Workflow that ship zips to maven]({{ site.baseurl }}/assets/media/blog-images/2022-07-24-opensearch-plugin-zips-now-in-maven-repo/figure1.png){: .img-fluid }

Copy link
Member Author

@prudhvigodithi prudhvigodithi Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heading change as Maven zip publication with Gradle

Add 2.1 in code quotes.

A small adjustment in 4th, 5th point as follows:

  • Updating with the user passed POM fields
  • Publishing the zip to your Maven repo

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize all instances of "Gradle". Line 33: Add a comma after "OpenSearch publishes plugin zips using a custom Gradle plugin,". Change to "Gradle-supported". Add terminating periods to all list items. The fourth list item should read "Updating the user-generated POM fields." The Figure caption should read "Workflow that ships generated plugin zips to Maven".

* The development dependent `SNAPSHOT` version zips can be directly fetched from maven using the dependency mechanism.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The development dependent `SNAPSHOT` version zips can be directly fetched from maven using the dependency mechanism.

* Not required to check in the zips manually to any `src/` folders, as zips can now be fetched using the right `grounID`, `artifactID` and `version`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Not required to check in the zips manually to any `src/` folders, as zips can now be fetched using the right `grounID`, `artifactID` and `version`.

* The published zips to central maven repo are signed with `.asc`, `.md5`, `.sha1`, `.sha256`, `.sha512` extensions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The published zips to central maven repo are signed with `.asc`, `.md5`, `.sha1`, `.sha256`, `.sha512` extensions.

* The tests and CI workflows can directly run against the zips fetched from maven repo, instead of requiring a manual download and checking into the project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The tests and CI workflows can directly run against the zips fetched from maven repo, instead of requiring a manual download and checking into the project.


### Consume plugin zips from maven:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Consume plugin zips from maven:
## Consume plugin zips from Maven


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can fetch and use OpenSearch plugin zips from Maven in three ways:

**Using mvn cli:**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "Using the Maven CLI"? Remove the colon (:) from the heading.


Consume from Central Maven repo:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to "Consume from the central Maven repo:".

```
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=https://repo1.maven.org/maven2 -Dartifact=org.opensearch.plugin:opensearch-job-scheduler:2.1.0.0:zip
```
Consume from Snapshot Maven repo:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add "the" before "Snapshot".

```
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=https://aws.oss.sonatype.org/content/repositories/snapshots -Dartifact=org.opensearch.plugin:opensearch-job-scheduler:2.1.0.0-SNAPSHOT:zip
```

**Gradle Project: using build.gradle file**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to "Gradle project: Using the build.gradle file".


```
dependencies {
classpath "org.opensearch.plugin:opensearch-job-scheduler:2.1.0.0@zip"
classpath "org.opensearch.plugin:opensearch-knn:2.1.0.0@zip"
}
```

**Maven Project: using pom.xml file**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to "Maven project: Using the pom.xml file".


```
<dependencies>
<dependency>
<groupId>org.opensearch.plugin</groupId>
<artifactId>opensearch-job-scheduler</artifactId>
<version>2.1.0.0</version>
<packaging>zip</packaging>
</dependency>
</dependencies>
```

### Summary:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Summary:

Using the maven [Release zips Maven Repo](https://repo1.maven.org/maven2/org/opensearch/plugin/) and [Snapshot zips Maven Repo](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/) URL’s, the plugin zips can be consumed and used as dependency to build other plugins and can also be fetched as standalone components to install them to the OpenSearch cluster.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Using the maven [Release zips Maven Repo](https://repo1.maven.org/maven2/org/opensearch/plugin/) and [Snapshot zips Maven Repo](https://aws.oss.sonatype.org/content/repositories/snapshots/org/opensearch/plugin/) URL’s, the plugin zips can be consumed and used as dependency to build other plugins and can also be fetched as standalone components to install them to the OpenSearch cluster.

Binary file added assets/media/authors/prudhvigodithi.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.