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

Support ES version 7.7.0 #58

Merged
merged 20 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/push-job-sched-jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: '13'
java-version: '14'
dbbaughe marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload Job-Scheduler Jar to Maven
env:
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
14 changes: 14 additions & 0 deletions sample-extension-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,17 @@ 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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this a bit more reliable by checking if the sample plugin comes before job scheduler plugin and if so then removing/adding? Otherwise if it changes again next version this will break again.

Copy link
Author

Choose a reason for hiding this comment

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

I think I can make this change in this version. There is no doubt it will make the plugin installation order much more reliable, but is not that important. The whole afterEvaluate block is a temporary workaround, and I believe the plugins should not be installed in this way forever, so the afterEvaluate block won't last long. An ideal case is in next version, the testClusters Gradle plugin get changed and this problem get fixed, and this gradle file get restored.

Copy link
Author

Choose a reason for hiding this comment

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

Looking forward to hear opinions from other reviewers as well.

testClusters.integTest.nodes.each { node ->
def plugins = node.plugins
def firstPlugin = plugins.get(0)
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