Skip to content

Commit

Permalink
chore(version): update to version 'v0.9.0'.
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed May 24, 2023
2 parents cef20cc + ac20181 commit 519aa8e
Show file tree
Hide file tree
Showing 179 changed files with 4,179 additions and 2,068 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
plugins: ""
packages: ""
- name: "-full"
plugins: io.kestra.storage:storage-azure:LATEST io.kestra.storage:storage-gcs:LATEST io.kestra.storage:storage-minio:LATEST io.kestra.plugin:plugin-airbyte:LATEST io.kestra.plugin:plugin-amqp:LATEST io.kestra.plugin:plugin-aws:LATEST io.kestra.plugin:plugin-azure:LATEST io.kestra.plugin:plugin-powerbi:LATEST io.kestra.plugin:plugin-pulsar:LATEST io.kestra.plugin:plugin-cassandra:LATEST io.kestra.plugin:plugin-compress:LATEST io.kestra.plugin:plugin-crypto:LATEST io.kestra.plugin:plugin-dbt:LATEST io.kestra.plugin:plugin-debezium-mysql:LATEST io.kestra.plugin:plugin-debezium-postgres:LATEST io.kestra.plugin:plugin-debezium-sqlserver:LATEST io.kestra.plugin:plugin-elasticsearch:LATEST io.kestra.plugin:plugin-fivetran:LATEST io.kestra.plugin:plugin-fs:LATEST io.kestra.plugin:plugin-gcp:LATEST io.kestra.plugin:plugin-googleworkspace:LATEST io.kestra.plugin:plugin-jdbc-clickhouse:LATEST io.kestra.plugin:plugin-jdbc-duckdb:LATEST io.kestra.plugin:plugin-jdbc-mysql:LATEST io.kestra.plugin:plugin-jdbc-oracle:LATEST io.kestra.plugin:plugin-jdbc-pinot:LATEST io.kestra.plugin:plugin-jdbc-postgres:LATEST io.kestra.plugin:plugin-jdbc-redshift:LATEST io.kestra.plugin:plugin-jdbc-rockset:LATEST io.kestra.plugin:plugin-jdbc-snowflake:LATEST io.kestra.plugin:plugin-jdbc-sqlserver:LATEST io.kestra.plugin:plugin-jdbc-trino:LATEST io.kestra.plugin:plugin-jdbc-vertica:LATEST io.kestra.plugin:plugin-jdbc-vectorwise:LATEST io.kestra.plugin:plugin-kafka:LATEST io.kestra.plugin:plugin-kubernetes:LATEST io.kestra.plugin:plugin-mongodb:LATEST io.kestra.plugin:plugin-mqtt:LATEST io.kestra.plugin:plugin-neo4j:LATEST io.kestra.plugin:plugin-notifications:LATEST io.kestra.plugin:plugin-redis:LATEST io.kestra.plugin:plugin-script-groovy:LATEST io.kestra.plugin:plugin-script-jython:LATEST io.kestra.plugin:plugin-script-nashorn:LATEST io.kestra.plugin:plugin-serdes:LATEST io.kestra.plugin:plugin-servicenow:LATEST io.kestra.plugin:plugin-singer:LATEST io.kestra.plugin:plugin-soda:LATEST io.kestra.plugin:plugin-spark:LATEST io.kestra.plugin:plugin-tika:LATEST
plugins: io.kestra.storage:storage-azure:LATEST io.kestra.storage:storage-gcs:LATEST io.kestra.storage:storage-minio:LATEST io.kestra.plugin:plugin-airbyte:LATEST io.kestra.plugin:plugin-amqp:LATEST io.kestra.plugin:plugin-aws:LATEST io.kestra.plugin:plugin-azure:LATEST io.kestra.plugin:plugin-powerbi:LATEST io.kestra.plugin:plugin-pulsar:LATEST io.kestra.plugin:plugin-cassandra:LATEST io.kestra.plugin:plugin-compress:LATEST io.kestra.plugin:plugin-couchbase:LATEST io.kestra.plugin:plugin-crypto:LATEST io.kestra.plugin:plugin-dbt:LATEST io.kestra.plugin:plugin-debezium-mysql:LATEST io.kestra.plugin:plugin-debezium-postgres:LATEST io.kestra.plugin:plugin-debezium-sqlserver:LATEST io.kestra.plugin:plugin-elasticsearch:LATEST io.kestra.plugin:plugin-fivetran:LATEST io.kestra.plugin:plugin-fs:LATEST io.kestra.plugin:plugin-gcp:LATEST io.kestra.plugin:plugin-git:LATEST io.kestra.plugin:plugin-googleworkspace:LATEST io.kestra.plugin:plugin-jdbc-clickhouse:LATEST io.kestra.plugin:plugin-jdbc-duckdb:LATEST io.kestra.plugin:plugin-jdbc-mysql:LATEST io.kestra.plugin:plugin-nats:LATEST io.kestra.plugin:plugin-jdbc-oracle:LATEST io.kestra.plugin:plugin-jdbc-pinot:LATEST io.kestra.plugin:plugin-jdbc-postgres:LATEST io.kestra.plugin:plugin-jdbc-redshift:LATEST io.kestra.plugin:plugin-jdbc-rockset:LATEST io.kestra.plugin:plugin-jdbc-snowflake:LATEST io.kestra.plugin:plugin-jdbc-sqlserver:LATEST io.kestra.plugin:plugin-jdbc-trino:LATEST io.kestra.plugin:plugin-jdbc-vertica:LATEST io.kestra.plugin:plugin-jdbc-vectorwise:LATEST io.kestra.plugin:plugin-kafka:LATEST io.kestra.plugin:plugin-kubernetes:LATEST io.kestra.plugin:plugin-mongodb:LATEST io.kestra.plugin:plugin-mqtt:LATEST io.kestra.plugin:plugin-neo4j:LATEST io.kestra.plugin:plugin-notifications:LATEST io.kestra.plugin:plugin-redis:LATEST io.kestra.plugin:plugin-script-groovy:LATEST io.kestra.plugin:plugin-script-jython:LATEST io.kestra.plugin:plugin-script-nashorn:LATEST io.kestra.plugin:plugin-serdes:LATEST io.kestra.plugin:plugin-servicenow:LATEST io.kestra.plugin:plugin-singer:LATEST io.kestra.plugin:plugin-soda:LATEST io.kestra.plugin:plugin-spark:LATEST io.kestra.plugin:plugin-tika:LATEST
packages: python3 python3-venv python-is-python3 nodejs npm curl zip unzip
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:11-jre
FROM eclipse-temurin:17-jre

ARG KESTRA_PLUGINS=""
ARG APT_PACKAGES=""
Expand Down
27 changes: 14 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id "java"
id 'java-library'
id "idea"
id "com.github.johnrengelman.shadow" version "8.1.0"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "application"

// test
Expand Down Expand Up @@ -36,8 +36,8 @@ idea {
* Main
**********************************************************************************************************************/
mainClassName = "io.kestra.cli.App"
sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17

dependencies {
implementation project(":cli")
Expand All @@ -50,8 +50,8 @@ dependencies {
allprojects {
group "io.kestra"

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17

repositories {
mavenCentral()
Expand All @@ -74,8 +74,8 @@ allprojects {
force("org.slf4j:slf4j-api:1.7.36")

// ugly bug on google cloud plugins
force("com.google.protobuf:protobuf-java:3.21.10")
force("com.google.protobuf:protobuf-java-util:3.21.10")
force("com.google.protobuf:protobuf-java:3.22.3")
force("com.google.protobuf:protobuf-java-util:3.22.3")

// ugly bug for elastic plugins
force("org.apache.httpcomponents:httpclient:4.5.13")
Expand Down Expand Up @@ -120,7 +120,7 @@ allprojects {
// kestra
implementation group: 'com.devskiller.friendly-id', name: 'friendly-id', version: '1.1.0'
implementation 'com.github.jknack:handlebars:4.3.1'
implementation group: 'net.thisptr', name: 'jackson-jq', version: '1.0.0-preview.20220705'
implementation group: 'net.thisptr', name: 'jackson-jq', version: '1.0.0-preview.20230409'

// exposed utils
api group: 'com.google.guava', name: 'guava', version: '31.1-jre'
Expand All @@ -137,8 +137,8 @@ subprojects {
apply plugin: "com.adarshr.test-logger"
apply plugin: "org.gradle.test-retry"

sourceCompatibility = 11
targetCompatibility = 11
sourceCompatibility = 17
targetCompatibility = 17

dependencies {
// lombok
Expand Down Expand Up @@ -223,9 +223,10 @@ jar {
manifest {
attributes (
"Main-Class": mainClassName,
"X-Kestra-Title": project.name,
"X-Kestra-Group": project.group,
"X-Kestra-Version": project.version
"X-Kestra-Name": project.name,
"X-Kestra-Title": project.name,
"X-Kestra-Group": project.group,
"X-Kestra-Version": project.version
)
}
}
Expand Down
7 changes: 7 additions & 0 deletions cli/src/main/java/io/kestra/cli/AbstractCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ch.qos.logback.classic.LoggerContext;
import com.google.common.collect.ImmutableMap;
import io.kestra.cli.commands.servers.ServerCommandInterface;
import io.kestra.cli.services.StartupHookInterface;
import io.micronaut.context.ApplicationContext;
import io.micronaut.context.env.yaml.YamlPropertySourceLoader;
import io.micronaut.core.annotation.Introspected;
Expand Down Expand Up @@ -41,6 +42,9 @@ abstract public class AbstractCommand implements Callable<Integer> {
@Inject
private EndpointDefaultConfiguration endpointConfiguration;

@Inject
private StartupHookInterface startupHook;

@CommandLine.Option(names = {"-v", "--verbose"}, description = "Change log level. Multiple -v options increase the verbosity.")
private boolean[] verbose = new boolean[0];

Expand Down Expand Up @@ -69,6 +73,9 @@ public Integer call() throws Exception {
Thread.currentThread().setName(this.getClass().getDeclaredAnnotation(CommandLine.Command.class).name());
startLogger();
sendServerLog();
if (this.startupHook != null) {
this.startupHook.start(this);
}
startWebserver();

return 0;
Expand Down
11 changes: 11 additions & 0 deletions cli/src/main/java/io/kestra/cli/services/NoOpStartupHook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.kestra.cli.services;

import io.kestra.cli.AbstractCommand;
import jakarta.inject.Singleton;

@Singleton
public class NoOpStartupHook implements StartupHookInterface {
public void start(AbstractCommand abstractCommand) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.kestra.cli.services;

import io.kestra.cli.AbstractCommand;

public interface StartupHookInterface {
void start(AbstractCommand abstractCommand);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ void run() throws IOException, URISyntaxException {

FileUtils.copyFile(
new File(Objects.requireNonNull(PluginListCommandTest.class.getClassLoader()
.getResource("plugins/plugin-template-test-0.6.0-SNAPSHOT.jar")).toURI()),
new File(URI.create("file://" + pluginsPath.toAbsolutePath() + "/plugin-template-test-0.6.0-SNAPSHOT.jar"))
.getResource("plugins/plugin-template-test-0.9.0-SNAPSHOT.jar")).toURI()),
new File(URI.create("file://" + pluginsPath.toAbsolutePath() + "/plugin-template-test-0.9.0-SNAPSHOT.jar"))
);

Path docPath = Files.createTempDirectory(PluginInstallCommandTest.class.getSimpleName());
Expand All @@ -55,12 +55,13 @@ void run() throws IOException, URISyntaxException {
assertThat(directory.isDirectory(), is(true));
assertThat(directory.listFiles().length, is(3));

var readme = directory.toPath().resolve("README.md");
var readme = directory.toPath().resolve("index.md");
assertThat(new String(Files.readAllBytes(readme)), containsString("---\n" +
"title: Plugin template test\n" +
"title: Template test\n" +
"description: \"Plugin template for Kestra\"\n" +
"editLink: false\n\n" +
"---\n" +
"# Plugin template test\n" +
"# Template test\n" +
"\n" +
"Plugin template for Kestra\n" +
"\n" +
Expand All @@ -73,17 +74,18 @@ void run() throws IOException, URISyntaxException {
"Subgroup description\n" +
"### Tasks\n" +
"\n" +
"* [ExampleTask](tasks/io.kestra.plugin.templates.ExampleTask.html)\n" +
"* [ExampleTask](./tasks/io.kestra.plugin.templates.ExampleTask.md)\n" +
"\n" +
"## Guides\n" +
"* [Authentication](guides/authentication.html)\n" +
"* [Authentication](./guides/authentication.md)\n" +
" \n" +
"* [Reporting](guides/reporting.html)\n" +
"* [Reporting](./guides/reporting.md)\n" +
" \n"));

// check @PluginProperty from an interface
var task = directory.toPath().resolve("tasks/io.kestra.plugin.templates.ExampleTask.md");
assertThat(new String(Files.readAllBytes(task)), containsString("### `example`\n" +
String taskDoc = new String(Files.readAllBytes(task));
assertThat(taskDoc, containsString("### `example`\n" +
"\n" +
"* **Type:** ==string==\n" +
"* **Dynamic:** ✔️\n" +
Expand All @@ -92,6 +94,16 @@ void run() throws IOException, URISyntaxException {
"\n" +
"\n" +
"> Example interface\n"));
assertThat(taskDoc, containsString("### `requiredExample`\n" +
"\n" +
"* **Type:** ==string==\n" +
"* **Dynamic:** ❌\n" +
"* **Required:** ✔️\n" +
"* **Min length:** `1`\n" +
"\n" +
"\n" +
"\n" +
"> Required Example interface\n"));

var authenticationGuide = directory.toPath().resolve("guides/authentication.md");
assertThat(new String(Files.readAllBytes(authenticationGuide)), containsString("This is how to authenticate for this plugin:"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ void run() throws IOException, URISyntaxException {

FileUtils.copyFile(
new File(Objects.requireNonNull(PluginListCommandTest.class.getClassLoader()
.getResource("plugins/plugin-template-test-0.6.0-SNAPSHOT.jar")).toURI()),
new File(URI.create("file://" + pluginsPath.toAbsolutePath() + "/plugin-template-test-0.6.0-SNAPSHOT.jar"))
.getResource("plugins/plugin-template-test-0.9.0-SNAPSHOT.jar")).toURI()),
new File(URI.create("file://" + pluginsPath.toAbsolutePath() + "/plugin-template-test-0.9.0-SNAPSHOT.jar"))
);

ByteArrayOutputStream out = new ByteArrayOutputStream();
Expand Down
Binary file not shown.
Binary file not shown.
14 changes: 7 additions & 7 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ dependencies {

// utils
implementation group: 'net.jodah', name: 'failsafe', version: '2.4.4'
implementation 'com.github.oshi:oshi-core:6.4.0'
implementation 'com.github.oshi:oshi-core:6.4.1'
implementation 'io.pebbletemplates:pebble:3.2.0'

// scheduler
implementation group: 'com.cronutils', name: 'cron-utils', version: '9.2.0'
implementation group: 'com.cronutils', name: 'cron-utils', version: '9.2.1'

// process
implementation ('com.github.docker-java:docker-java:3.3.0') {
Expand All @@ -33,17 +33,17 @@ dependencies {
implementation 'com.github.docker-java:docker-java-transport-httpclient5:3.3.0'

// schema
implementation group: 'com.github.victools', name: 'jsonschema-generator', version: '4.28.0'
implementation group: 'com.github.victools', name: 'jsonschema-module-javax-validation', version: '4.28.0'
implementation group: 'com.github.victools', name: 'jsonschema-module-jackson', version: '4.28.0'
implementation group: 'com.github.victools', name: 'jsonschema-module-swagger-2', version: '4.28.0'
implementation group: 'com.github.victools', name: 'jsonschema-generator', version: '4.31.0'
implementation group: 'com.github.victools', name: 'jsonschema-module-javax-validation', version: '4.31.0'
implementation group: 'com.github.victools', name: 'jsonschema-module-jackson', version: '4.31.0'
implementation group: 'com.github.victools', name: 'jsonschema-module-swagger-2', version: '4.31.0'

// test
testImplementation project(':repository-memory')
testImplementation project(':runner-memory')
testImplementation project(':storage-local')

testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.3.1'
testImplementation "io.micronaut:micronaut-http-client"
testImplementation "io.micronaut.rxjava2:micronaut-rxjava2-http-client"
testImplementation "io.micronaut:micronaut-http-server-netty"
Expand Down
85 changes: 85 additions & 0 deletions core/src/main/java/io/kestra/core/docs/ClassDocumentation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package io.kestra.core.docs;

import lombok.*;

import java.util.*;

@AllArgsConstructor
@Getter
@EqualsAndHashCode
@ToString
@NoArgsConstructor
public class ClassDocumentation {
protected Boolean deprecated;
protected String cls;
protected String shortName;
protected String docDescription;
protected String docBody;
protected List<ExampleDoc> docExamples;
protected Map<String, Object> defs = new TreeMap<>();
protected Map<String, Object> inputs = new TreeMap<>();
protected Map<String, Object> propertiesSchema;

protected static Map<String, Object> flatten(Map<String, Object> map, List<String> required) {
map.remove("type");
return flatten(map, required, null);
}

@SuppressWarnings("unchecked")
protected static Map<String, Object> flatten(Map<String, Object> map, List<String> required, String parentName) {
Map<String, Object> result = new TreeMap<>((key1, key2) -> {
boolean key1Required = required.contains(key1);
boolean key2Required = required.contains(key2);
if (key1Required == key2Required) {
return key1.compareTo(key2);
}

return key1Required ? -1 : 1;
});

for (Map.Entry<String, Object> current : map.entrySet()) {
Map<String, Object> finalValue = (Map<String, Object>) current.getValue();
if (required.contains(current.getKey())) {
finalValue.put("$required", true);
}

result.put(flattenKey(current.getKey(), parentName), finalValue);
if (current.getValue() instanceof Map) {
Map<String, Object> value = (Map<String, Object>) current.getValue();

if (value.containsKey("properties")) {
result.putAll(flatten(properties(value), required(value), current.getKey()));
}
}
}

return result;
}

protected static String flattenKey(String current, String parent) {
return (parent != null ? parent + "." : "") + current;
}

@SuppressWarnings("unchecked")
protected static Map<String, Object> properties(Map<String, Object> props) {
Map<String, Object> properties = (Map<String, Object>) props.get("properties");

return properties != null ? properties : new HashMap<>();
}

@SuppressWarnings("unchecked")
protected static List<String> required(Map<String, Object> props) {
if (!props.containsKey("required")) {
return Collections.emptyList();
}

return (List<String>) props.get("required");
}

@AllArgsConstructor
@Getter
public static class ExampleDoc {
String title;
String task;
}
}
Loading

0 comments on commit 519aa8e

Please sign in to comment.