Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Support ES version 7.7.0 (#58)
Browse files Browse the repository at this point in the history
* Support ES version 7.7.0

* A hack to reorder the plugins installation in testCluster

* Update the requirement of JDK 14 in README and workflow files

* Update the Release Notes
  • Loading branch information
ftianli-amzn authored May 20, 2020
1 parent 8edc0c5 commit d16b08b
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/push-job-sched-jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: '13'
java-version: '14'

- name: Upload Job-Scheduler Jar to Maven
env:
passphrase: ${{ secrets.PASSPHRASE }}
run: |
cd ..
export JAVA13_HOME=$JAVA_HOME
export JAVA14_HOME=$JAVA_HOME
aws s3 cp s3://opendistro-docs/github-actions/pgp-public-key .
aws s3 cp s3://opendistro-docs/github-actions/pgp-private-key .
Expand All @@ -41,4 +41,4 @@ jobs:
cd job-scheduler/spi
../gradlew publishShadowPublicationToSonatype-stagingRepository -Dcompiler.java=13 -Dbuild.snapshot=false -Djavax.net.ssl.trustStore=$JAVA_HOME/lib/security/cacerts
../gradlew publishShadowPublicationToSonatype-stagingRepository -Dcompiler.java=14 -Dbuild.snapshot=false -Djavax.net.ssl.trustStore=$JAVA_HOME/lib/security/cacerts
2 changes: 1 addition & 1 deletion .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
strategy:
matrix:
java: [13]
java: [14]
# Job name
name: Build Job-scheduler with JDK ${{ matrix.java }}
# This job runs on Linux
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
java: [13]
java: [14]
# Job name
name: Build Job Scheduler with JDK ${{ matrix.java }}
# This job runs on macos
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ monitoring the shard allocation by calling Elasticsearch API and post the output
The JobScheduler plugin uses the [Gradle](https://docs.gradle.org/4.10.2/userguide/userguide.html)
build system.
1. Checkout this package from version control.
1. To build from command line set `JAVA_HOME` to point to a JDK >=13
1. To build from command line set `JAVA_HOME` to point to a JDK >=14
1. Run `./gradlew build`

Then you will find the built artifact located at `build/distributions` directory
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

buildscript {
ext {
es_version = System.getProperty("es.version", "7.6.1")
es_version = System.getProperty("es.version", "7.7.0")
}

repositories {
Expand All @@ -28,7 +28,7 @@ buildscript {
}

plugins {
id 'nebula.ospackage' version "8.2.0"
id 'nebula.ospackage' version "8.3.0"
id 'java-library'
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# permissions and limitations under the License.
#

version = 1.6.0
version = 1.8.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Mar 23 20:49:14 PDT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
11 changes: 9 additions & 2 deletions opendistro-elasticsearch-job-scheduler.release-notes
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
## version 1.6.0.0 (Current)
## version 1.8.0.0 (Current)

### New Features
* Adds support for Elasticsearch 7.7.0 - [PR #58](https://github.com/opendistro-for-elasticsearch/job-scheduler/pull/58)

## 2020-05-05, version 1.7.0.0

## 2020-03-30, version 1.6.0.0

### Notable Changes
* Feature [PR #46](https://github.com/opendistro-for-elasticsearch/job-scheduler/pull/46) Support ES version 7.6.1

## version 1.4.0.0
## 2020-02-07, version 1.4.0.0

### Notable Changes
* Feature [PR #31](https://github.com/opendistro-for-elasticsearch/job-scheduler/pull/31) Support ES version 7.4.2
Expand Down
16 changes: 16 additions & 0 deletions sample-extension-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,19 @@ testClusters.integTest {
// need to install job-scheduler first, need to assemble job-scheduler first
plugin file("${rootProject.getBuildDir()}/distributions/${rootProject.getName()}-${project.getVersion()}.zip")
}

// As of ES 7.7 the sample-extension-plugin is being added to the list of plugins for the testCluster during build before
// the job-scheduler plugin is causing build failures.
// The job-scheduler zip is added explicitly above but the sample-extension-plugin is added implicitly at some time during evaluation.
// Will need to do a deep dive to find out exactly what task adds the sample-extension-plugin and add job-scheduler there but a temporary hack is to
// reorder the plugins list after evaluation but prior to task execution when the plugins are installed.
afterEvaluate {
testClusters.integTest.nodes.each { node ->
def plugins = node.plugins
def firstPlugin = plugins.get(0)
if (firstPlugin.provider == project.bundlePlugin.archiveFile) {
plugins.remove(0)
plugins.add(firstPlugin)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public class SampleExtensionPlugin extends Plugin implements ActionPlugin, JobSc
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
NamedXContentRegistry xContentRegistry, Environment environment,
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry) {
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
IndexNameExpressionResolver indexNameExpressionResolver) {
SampleJobRunner jobRunner = SampleJobRunner.getJobRunnerInstance();
jobRunner.setClusterService(clusterService);
jobRunner.setThreadPool(threadPool);
Expand Down Expand Up @@ -145,6 +146,6 @@ private Instant parseInstantValue(XContentParser parser) throws IOException {
public List<RestHandler> getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter,
IndexNameExpressionResolver indexNameExpressionResolver, Supplier<DiscoveryNodes> nodesInCluster) {
return Collections.singletonList(new SampleExtensionRestHandler(restController));
return Collections.singletonList(new SampleExtensionRestHandler());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.RestStatus;

import java.io.IOException;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
* A sample rest handler that supports schedule and deschedule job operation
Expand All @@ -50,16 +52,19 @@
public class SampleExtensionRestHandler extends BaseRestHandler {
public static final String WATCH_INDEX_URI = "/_opendistro/scheduler_sample/watch";

public SampleExtensionRestHandler(RestController restController) {
restController.registerHandler(RestRequest.Method.POST, WATCH_INDEX_URI, this);
restController.registerHandler(RestRequest.Method.DELETE, WATCH_INDEX_URI, this);
}

@Override
public String getName() {
return "Sample JobScheduler extension handler";
}

@Override
public List<Route> routes() {
return Collections.unmodifiableList(Arrays.asList(
new Route(RestRequest.Method.POST, WATCH_INDEX_URI),
new Route(RestRequest.Method.DELETE, WATCH_INDEX_URI)
));
}

@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
if (request.method().equals(RestRequest.Method.POST)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
Expand Down Expand Up @@ -76,7 +77,8 @@ public JobSchedulerPlugin() {
public Collection<Object> createComponents(Client client, ClusterService clusterService, ThreadPool threadPool,
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
NamedXContentRegistry xContentRegistry, Environment environment,
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry) {
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry,
IndexNameExpressionResolver indexNameExpressionResolver) {
this.lockService = new LockService(client, clusterService);
this.scheduler = new JobScheduler(threadPool, this.lockService);
this.sweeper = initSweeper(environment.settings(), client, clusterService, threadPool, xContentRegistry,
Expand Down

0 comments on commit d16b08b

Please sign in to comment.