-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: vamsi-amazon <[email protected]>
- Loading branch information
Showing
114 changed files
with
515 additions
and
4,284 deletions.
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 { | ||
@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,5 @@ | ||
# Copyright OpenSearch Contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
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.