Skip to content

Commit

Permalink
Added support for building -SNAPSHOTs.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jan 22, 2024
1 parent a57bdfc commit 7ec9d38
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,44 @@ Build a distribution.
./gradlew assemble
```

This produces `build/distributions/opensearch-api.zip`.
This produces `./build/distributions/opensearch-api-3.0.0.0-SNAPSHOT.zip`.

### Install

Check out OpenSearch code, run it once with `./gradlew run`.

Install the plugin, you may need to adjust `darwin-arm64-tar` below to your platform, and use the location of your plugin zip.
Install the plugin, you may need to adjust `darwin-arm64-tar` below to your platform, and use the location of your plugin zip (mine is `~/source/opensearch-project/opensearch-api/dblock-opensearch-api`).

```sh
$ ./distribution/archives/darwin-arm64-tar/build/install/opensearch-3.0.0-SNAPSHOT/bin/opensearch-plugin install file:///Users/dblock/source/opensearch-project/opensearch-api/dblock-opensearch-api/build/distributions/opensearch-api.zip
$ ./distribution/archives/darwin-arm64-tar/build/install/opensearch-3.0.0-SNAPSHOT/bin/opensearch-plugin install file:///Users/dblock/source/opensearch-project/opensearch-api/dblock-opensearch-api/build/distributions/opensearch-api-3.0.0.0-SNAPSHOT.zip

-> Installed opensearch-api with folder name opensearch-api
```

When you run OpenSearch with `./gradlew run` you should see the plugin loaded in the logs.

```
[2023-09-27T08:35:48,627][INFO ][o.o.p.PluginsService] [runTask-0] loaded plugin [opensearch-api]
[2024-01-22T10:58:58,338][INFO ][o.o.p.PluginsService] [runTask-0] loaded plugin [opensearch-api]
```

### Test

```sh
$ curl http://localhost:9200/_plugins/api
$ curl http://localhost:9200/_plugins/api | jq
```

Returns an OpenAPI spec.

```json
{
"openapi": "3.0.1",
"info": {
"title": "opensearch",
"description": "The OpenSearch Project: https://opensearch.org/",
"version": "3.0.0-SNAPSHOT"
},
...
}
```

### Uninstall
Expand All @@ -52,4 +66,4 @@ This code is licensed under the Apache 2.0 License. See [LICENSE.txt](LICENSE.tx

## Copyright

Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
Copyright Daniel Doubrovkine (dB.), and OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
14 changes: 11 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def pluginDescription = 'OpenSearch API plugin.'
def projectPath = 'org.opensearch'
def pathToPlugin = 'plugin.api'
def pluginClassName = 'APIPlugin'
group = "APIPluginGroup"

group = "org.dblock"

tasks.register("preparePluginPathDirs") {
mustRunAfter clean
Expand All @@ -37,8 +38,9 @@ publishing {
}
developers {
developer {
name = "OpenSearch"
url = "https://github.com/dblock/opensearch-api"
id = 'dblock'
name = "Daniel Doubrovkine (dB.)"
url = "https://code.dblock.org"
}
}
}
Expand Down Expand Up @@ -66,6 +68,7 @@ javadoc.enabled = false
buildscript {
ext {
opensearch_version = System.getProperty("opensearch.version", "3.0.0-SNAPSHOT")
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
}

repositories {
Expand All @@ -80,6 +83,11 @@ buildscript {
}
}

version = opensearch_version - "-SNAPSHOT" + ".0"
if (isSnapshot) {
version += "-SNAPSHOT"
}

repositories {
mavenLocal()
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
Expand Down

0 comments on commit 7ec9d38

Please sign in to comment.