-
Notifications
You must be signed in to change notification settings - Fork 141
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
Version 2.0 #507
Merged
Merged
Version 2.0 #507
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
- rename* | ||
|
||
env: | ||
OD_VERSION: 1.3.0.0 | ||
OD_VERSION: 2.0.0.0 | ||
|
||
jobs: | ||
upload-odbc: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,4 @@ gen | |
*/.venv | ||
*/__pycache__ | ||
*.iml | ||
.DS_Store |
2 changes: 1 addition & 1 deletion
2
bi-connectors/TableauConnector/opensearch_sql_jdbc/manifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apply plugin: 'groovy' | ||
apply plugin: 'java' | ||
|
||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation gradleApi() | ||
implementation localGroovy() | ||
} |
18 changes: 18 additions & 0 deletions
18
buildSrc/src/main/groovy/com/wiredforcode/spawn/DefaultSpawnTask.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.wiredforcode.gradle.spawn | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.Internal | ||
|
||
|
||
class DefaultSpawnTask extends DefaultTask { | ||
|
||
@Internal | ||
String pidLockFileName = '.pid.lock' | ||
@Internal | ||
String directory = '.' | ||
|
||
@Internal | ||
File getPidFile() { | ||
return new File(directory, pidLockFileName) | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
buildSrc/src/main/groovy/com/wiredforcode/spawn/KillProcessTask.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.wiredforcode.gradle.spawn | ||
|
||
import org.gradle.api.tasks.TaskAction | ||
|
||
class KillProcessTask extends DefaultSpawnTask { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented here. |
||
@TaskAction | ||
void kill() { | ||
def pidFile = getPidFile() | ||
if(!pidFile.exists()) { | ||
logger.quiet "No server running!" | ||
return | ||
} | ||
|
||
def pid = pidFile.text | ||
def process = "kill $pid".execute() | ||
|
||
try { | ||
process.waitFor() | ||
} finally { | ||
pidFile.delete() | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
buildSrc/src/main/groovy/com/wiredforcode/spawn/SpawnPlugin.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.wiredforcode.gradle.spawn | ||
|
||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
|
||
class SpawnPlugin implements Plugin<Project> { | ||
@Override | ||
void apply(Project project) { | ||
project.with { | ||
ext.SpawnProcessTask = SpawnProcessTask | ||
ext.KillProcessTask = KillProcessTask | ||
|
||
task('spawnProcess', type: SpawnProcessTask) | ||
task('killProcess', type: KillProcessTask) | ||
} | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
buildSrc/src/main/groovy/com/wiredforcode/spawn/SpawnProcessTask.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package com.wiredforcode.gradle.spawn | ||
|
||
import org.gradle.api.GradleException | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.Internal | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
class SpawnProcessTask extends DefaultSpawnTask { | ||
@Input | ||
String command | ||
@Input | ||
String ready | ||
@Internal | ||
List<Closure> outputActions = new ArrayList<Closure>() | ||
|
||
@Input | ||
Map<String, String> environmentVariables = new HashMap<String, String>() | ||
|
||
void environmentVariable(String key, Object value) { | ||
environmentVariables.put(key, String.valueOf(value)) | ||
} | ||
|
||
SpawnProcessTask() { | ||
description = "Spawn a new server process in the background." | ||
} | ||
|
||
void withOutput(Closure outputClosure) { | ||
outputActions.add(outputClosure) | ||
} | ||
|
||
@TaskAction | ||
void spawn() { | ||
if (!(command && ready)) { | ||
throw new GradleException("Ensure that mandatory fields command and ready are set.") | ||
} | ||
|
||
def pidFile = getPidFile() | ||
if (pidFile.exists()) throw new GradleException("Server already running!") | ||
|
||
def process = buildProcess(directory, command) | ||
waitToProcessReadyOrClosed(process) | ||
} | ||
|
||
private void waitToProcessReadyOrClosed(Process process) { | ||
boolean isReady = waitUntilIsReadyOrEnd(process) | ||
if (isReady) { | ||
stampLockFile(pidFile, process) | ||
} else { | ||
checkForAbnormalExit(process) | ||
} | ||
} | ||
|
||
private void checkForAbnormalExit(Process process) { | ||
try { | ||
process.waitFor() | ||
def exitValue = process.exitValue() | ||
if (exitValue) { | ||
throw new GradleException("The process terminated unexpectedly - status code ${exitValue}") | ||
} | ||
} catch (IllegalThreadStateException ignored) { | ||
} | ||
} | ||
|
||
private boolean waitUntilIsReadyOrEnd(Process process) { | ||
def line | ||
def reader = new BufferedReader(new InputStreamReader(process.getInputStream())) | ||
boolean isReady = false | ||
while (!isReady && (line = reader.readLine()) != null) { | ||
logger.quiet line | ||
runOutputActions(line) | ||
if (line.contains(ready)) { | ||
logger.quiet "$command is ready." | ||
isReady = true | ||
} | ||
} | ||
isReady | ||
} | ||
|
||
def runOutputActions(String line) { | ||
outputActions.each { Closure<String> outputAction -> | ||
outputAction.call(line) | ||
} | ||
} | ||
|
||
private Process buildProcess(String directory, String command) { | ||
def builder = new ProcessBuilder(command.split(' ')) | ||
builder.redirectErrorStream(true) | ||
builder.environment().putAll(environmentVariables) | ||
builder.directory(new File(directory)) | ||
builder.start() | ||
} | ||
|
||
private File stampLockFile(File pidFile, Process process) { | ||
pidFile << extractPidFromProcess(process) | ||
} | ||
|
||
private int extractPidFromProcess(Process process) { | ||
def pidField = process.class.getDeclaredField('pid') | ||
pidField.accessible = true | ||
|
||
return pidField.getInt(process) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
buildSrc/src/main/resources/META-INF/gradle-plugins/com.wiredforcode.spawn.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
implementation-class=com.wiredforcode.gradle.spawn.SpawnPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file renamed
BIN
+16.2 MB
...ommons/opensearch-ml-1.3.0.0-SNAPSHOT.zip → ...ommons/opensearch-ml-2.0.0.0-SNAPSHOT.zip
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
# Copyright OpenSearch Contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
vmmusings marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this change is required by all plugin? if so, could you add related issue/pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using a third party plugin to spawn and kill process in doctest module. The plugin is around 5 years old and there is no active development. As part of Gradle 7 upgrade spawn plugin is throwing errors. As part of fix, imported the plugin code to buildSrc and upgraded to Gradle 7.[The only way for upgrading unmaintained third party plugins]. I couldn't find another well maintained plugin to replace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#303. Will add to the description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. could we create an issue to tracking move this dependency later. ideally, we should not depend on it.