mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
feat(cicd): Introduce github action
* Github action main workflow * Publish package & main jar to Bintray * Slack notification
This commit is contained in:
186
.github/workflows/main.yml
vendored
Normal file
186
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
name: Main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- feat/cicd
|
||||
tags:
|
||||
- v*
|
||||
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java: ['11']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Services
|
||||
- name: Build the docker-compose stack
|
||||
run: docker-compose -f docker-compose.yml up -d
|
||||
|
||||
# Caches
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
- name: Gradle wrapper cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-wrapper-${{ hashFiles('**/*.gradle') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-wrapper-
|
||||
- name: Npm cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
- name: Node cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: node
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('ui/*.gradle') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
# JDK
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
|
||||
# Gradle check
|
||||
- name: Build with Gradle
|
||||
env:
|
||||
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
|
||||
run: |
|
||||
echo $GOOGLE_SERVICE_ACCOUNT | base64 -d > ~/.gcp-service-account.json
|
||||
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/.gcp-service-account.json
|
||||
./gradlew classes --parallel --no-daemon
|
||||
./gradlew check --no-daemon
|
||||
# --parallel
|
||||
|
||||
# Shadow Jar
|
||||
- name: Shadow jar
|
||||
if: success() && matrix.java == '11'
|
||||
run: ./gradlew shadowJar --no-daemon
|
||||
|
||||
- name: Upload jar
|
||||
uses: actions/upload-artifact@v1
|
||||
if: success() && matrix.java == '11'
|
||||
with:
|
||||
name: jar
|
||||
path: build/libs/
|
||||
|
||||
# Slack
|
||||
- name: Slack notification
|
||||
uses: 8398a7/action-slack@v2
|
||||
if: always()
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
username: Github Actions
|
||||
icon_emoji: ':octocat:'
|
||||
channel: '#kestra'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
|
||||
publish:
|
||||
name: Publish package
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Caches
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
- name: Gradle wrapper cache
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-wrapper-${{ hashFiles('**/*.gradle') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-wrapper-
|
||||
|
||||
# Java
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
|
||||
- name: Publish package to GitHub
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
|
||||
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
|
||||
run: ./gradlew bintrayUpload --parallel --no-daemon
|
||||
|
||||
# Slack
|
||||
- name: Slack notification
|
||||
uses: 8398a7/action-slack@v2
|
||||
if: failure()
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
username: Github Actions
|
||||
icon_emoji: ':octocat:'
|
||||
channel: '#kestra'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
|
||||
docker:
|
||||
name: Publish docker
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Download jar
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: jar
|
||||
- name: Copy jar to image
|
||||
run: cp jar/*.jar docker/app/libs/kestra.jar
|
||||
- name: Publish to Docker Hub
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: kestra/kestra
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
# Slack
|
||||
- name: Slack notification
|
||||
uses: 8398a7/action-slack@v2
|
||||
if: failure()
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
username: Github Actions
|
||||
icon_emoji: ':octocat:'
|
||||
channel: '#kestra'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM openjdk:11-slim
|
||||
|
||||
WORKDIR /app
|
||||
COPY docker /
|
||||
ENV MICRONAUT_CONFIG_FILES=/app/confs/application.yml
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["--help"]
|
||||
@@ -4,6 +4,8 @@
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
<p align="center">
|
||||
<img width="460" src="ui/src/assets/logo.svg" alt="Kestra workflow orchestrator" />
|
||||
|
||||
180
build.gradle
180
build.gradle
@@ -1,6 +1,6 @@
|
||||
buildscript {
|
||||
ext {
|
||||
micronautVersion = "1.2.6"
|
||||
micronautVersion = "1.2.8"
|
||||
confluentVersion = "5.3.1"
|
||||
kafkaVersion = "2.3.0"
|
||||
lombokVersion = "1.18.10"
|
||||
@@ -10,19 +10,22 @@ buildscript {
|
||||
plugins {
|
||||
// micronaut
|
||||
id "java"
|
||||
id "net.ltgt.apt-eclipse" version "0.21"
|
||||
id "net.ltgt.apt-idea" version "0.21"
|
||||
id 'java-library'
|
||||
id "idea"
|
||||
id "com.github.johnrengelman.shadow" version "5.2.0"
|
||||
id "application"
|
||||
|
||||
// test
|
||||
id 'com.adarshr.test-logger' version '2.0.0'
|
||||
|
||||
// help
|
||||
// helper
|
||||
id "com.github.ben-manes.versions" version "0.27.0"
|
||||
|
||||
// front
|
||||
id 'org.siouan.frontend' version '1.3.0'
|
||||
|
||||
// release
|
||||
id "com.jfrog.bintray" version "1.8.4" apply false
|
||||
}
|
||||
|
||||
idea {
|
||||
@@ -43,13 +46,13 @@ dependencies {
|
||||
testCompile project(":cli")
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************************************************\
|
||||
* All projects
|
||||
* Dependencies
|
||||
**********************************************************************************************************************/
|
||||
allprojects {
|
||||
group "org.kestra"
|
||||
version "0.1"
|
||||
|
||||
sourceCompatibility = 11
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -57,30 +60,25 @@ allprojects {
|
||||
}
|
||||
|
||||
// micronaut
|
||||
apply plugin:"java"
|
||||
apply plugin:"net.ltgt.apt-eclipse"
|
||||
apply plugin:"net.ltgt.apt-idea"
|
||||
apply plugin: "jacoco"
|
||||
|
||||
// test
|
||||
apply plugin:"com.adarshr.test-logger"
|
||||
apply plugin: "java"
|
||||
apply plugin: "java-library"
|
||||
apply plugin: "idea"
|
||||
|
||||
configurations {
|
||||
// for dependencies that are needed for development only
|
||||
developmentOnly
|
||||
developmentOnly // for dependencies that are needed for development only
|
||||
}
|
||||
|
||||
// dependencies
|
||||
dependencies {
|
||||
// logs
|
||||
runtime "ch.qos.logback:logback-classic:1.2.3"
|
||||
compile group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.12.1'
|
||||
runtime group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.12.1'
|
||||
|
||||
// utils
|
||||
annotationProcessor "org.projectlombok:lombok:" + lombokVersion
|
||||
compile group: 'com.google.guava', name: 'guava', version: '28.1-jre'
|
||||
api group: 'com.google.guava', name: 'guava', version: '28.1-jre'
|
||||
compileOnly 'org.projectlombok:lombok:' + lombokVersion
|
||||
compile 'com.github.jknack:handlebars:4.1.2'
|
||||
implementation 'com.github.jknack:handlebars:4.1.2'
|
||||
|
||||
// micronaut
|
||||
annotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
|
||||
@@ -90,18 +88,30 @@ allprojects {
|
||||
implementation "io.micronaut:micronaut-inject"
|
||||
implementation "io.micronaut:micronaut-validation"
|
||||
implementation "io.micronaut:micronaut-runtime"
|
||||
compile 'io.micronaut:micronaut-views'
|
||||
compile group: 'io.micronaut.data', name: 'micronaut-data-model', version: '1.0.0.M5'
|
||||
implementation 'io.micronaut:micronaut-views'
|
||||
implementation "io.micronaut.data:micronaut-data-model:1.0.0.M5"
|
||||
|
||||
// jackson
|
||||
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
|
||||
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.10.1'
|
||||
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names', version: '2.10.1'
|
||||
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.1'
|
||||
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.10.1'
|
||||
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names', version: '2.10.1'
|
||||
|
||||
// test
|
||||
// kestra
|
||||
implementation group: 'com.devskiller.friendly-id', name: 'friendly-id', version: '1.1.0'
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************\
|
||||
* Test
|
||||
**********************************************************************************************************************/
|
||||
subprojects {
|
||||
apply plugin: "com.adarshr.test-logger"
|
||||
|
||||
dependencies {
|
||||
testAnnotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
|
||||
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
|
||||
testImplementation platform("io.micronaut:micronaut-bom:$micronautVersion")
|
||||
testImplementation "io.micronaut:micronaut-inject"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
testImplementation "io.micronaut.test:micronaut-test-junit5"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-engine"
|
||||
@@ -110,24 +120,19 @@ allprojects {
|
||||
// hamcrest
|
||||
testImplementation 'org.hamcrest:hamcrest:2.2'
|
||||
testImplementation 'org.hamcrest:hamcrest-library:2.2'
|
||||
testCompile group: 'org.exparity', name: 'hamcrest-date', version: '2.0.7'
|
||||
testImplementation group: 'org.exparity', name: 'hamcrest-date', version: '2.0.7'
|
||||
|
||||
// kestra
|
||||
compile group: 'com.devskiller.friendly-id', name: 'friendly-id', version: '1.1.0'
|
||||
}
|
||||
|
||||
// test
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
|
||||
testLogging {
|
||||
exceptionFormat = "full"
|
||||
}
|
||||
}
|
||||
|
||||
testlogger {
|
||||
theme 'mocha-parallel'
|
||||
showExceptions true
|
||||
showFullStackTraces true
|
||||
showCauses true
|
||||
slowThreshold 2000
|
||||
showStandardStreams true
|
||||
showPassedStandardStreams false
|
||||
@@ -138,7 +143,7 @@ allprojects {
|
||||
/**********************************************************************************************************************\
|
||||
* Micronaut
|
||||
**********************************************************************************************************************/
|
||||
tasks.withType(JavaCompile){
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.compilerArgs.add("-parameters")
|
||||
}
|
||||
@@ -164,6 +169,7 @@ jar {
|
||||
|
||||
shadowJar {
|
||||
mergeServiceFiles()
|
||||
archiveClassifier.set(null)
|
||||
}
|
||||
|
||||
shadowJar.dependsOn "assembleFrontend"
|
||||
@@ -173,6 +179,8 @@ shadowJar.dependsOn "assembleFrontend"
|
||||
* Jacoco
|
||||
**********************************************************************************************************************/
|
||||
subprojects {
|
||||
apply plugin: "jacoco"
|
||||
|
||||
test {
|
||||
finalizedBy jacocoTestReport
|
||||
}
|
||||
@@ -188,7 +196,7 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
task jacoco(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
|
||||
task jacoco(type: JacocoReport) {
|
||||
dependsOn = subprojects.test
|
||||
|
||||
getAdditionalSourceDirs().setFrom(files(subprojects.sourceSets.main.allSource.srcDirs))
|
||||
@@ -201,4 +209,106 @@ task jacoco(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
|
||||
xml.enabled = true
|
||||
csv.enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************\
|
||||
* Standalone
|
||||
**********************************************************************************************************************/
|
||||
task runStandalone(type: JavaExec) {
|
||||
group = "application"
|
||||
classpath = project(":cli").sourceSets.main.runtimeClasspath
|
||||
main = mainClassName
|
||||
args 'standalone'
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************\
|
||||
* Publish
|
||||
**********************************************************************************************************************/
|
||||
|
||||
subprojects {
|
||||
javadoc {
|
||||
options {
|
||||
locale = 'en_US'
|
||||
encoding = 'UTF-8'
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
archiveClassifier.set('sources')
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
archiveClassifier.set('javadoc')
|
||||
from javadoc
|
||||
}
|
||||
|
||||
def getSnapshotVersion = { ->
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine 'git', 'log', '-n', '1', '--pretty=format:%ad-%h', '--date=format:%Y%m%d-%H%M%S'
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim()
|
||||
}
|
||||
|
||||
ext {
|
||||
isBuildSnapshot = version.toString().endsWith("-SNAPSHOT")
|
||||
if (isBuildSnapshot) {
|
||||
project.version = project.version.replaceAll(/-SNAPSHOT$/, "-" + getSnapshotVersion())
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: "maven-publish"
|
||||
apply plugin: "com.jfrog.bintray"
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
BintrayMavenPublication(MavenPublication) {
|
||||
version project.version
|
||||
|
||||
if (project.name.contains('cli')) {
|
||||
groupId "org.kestra"
|
||||
artifactId "kestra"
|
||||
|
||||
artifact shadowJar
|
||||
} else {
|
||||
from components.java
|
||||
|
||||
groupId project.group
|
||||
artifactId project.name
|
||||
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = System.getenv('BINTRAY_USER')
|
||||
key = System.getenv('BINTRAY_KEY')
|
||||
publications = ['BintrayMavenPublication']
|
||||
publish = true
|
||||
dryRun = false
|
||||
pkg {
|
||||
userOrg = 'kestra'
|
||||
name = project.name.contains('cli') ? "kestra" : project.name
|
||||
repo = project.ext.isBuildSnapshot ? 'maven-snapshot' : 'maven'
|
||||
websiteUrl = 'https://kestra.io'
|
||||
issueTrackerUrl = 'https://github.com/kestra-io/kestra/issues'
|
||||
vcsUrl = 'https://github.com/kestra-io/kestra'
|
||||
licenses = ['Apache-2.0']
|
||||
publicDownloadNumbers = true
|
||||
githubRepo = 'kestra-io/kestra'
|
||||
githubReleaseNotesFile = 'README.md'
|
||||
version {
|
||||
name = project.version
|
||||
released = new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ")
|
||||
vcsTag = "v" + project.version
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
sourceCompatibility = 11
|
||||
|
||||
dependencies {
|
||||
// micronaut
|
||||
compile "info.picocli:picocli"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.kestra.cli.commands;
|
||||
|
||||
import io.micronaut.context.ApplicationContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.kestra.cli.AbstractCommand;
|
||||
import org.kestra.core.exceptions.MissingRequiredInput;
|
||||
@@ -36,16 +37,7 @@ public class TestCommand extends AbstractCommand {
|
||||
CommandLine.Model.CommandSpec spec;
|
||||
|
||||
@Inject
|
||||
private MemoryRunner runner;
|
||||
|
||||
@Inject
|
||||
private LocalFlowRepositoryLoader repositoryLoader;
|
||||
|
||||
@Inject
|
||||
private FlowRepositoryInterface flowRepository;
|
||||
|
||||
@Inject
|
||||
private RunnerUtils runnerUtils;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
public TestCommand() {
|
||||
super(false);
|
||||
@@ -55,6 +47,11 @@ public class TestCommand extends AbstractCommand {
|
||||
public void run() {
|
||||
super.run();
|
||||
|
||||
MemoryRunner runner = applicationContext.getBean(MemoryRunner.class);
|
||||
LocalFlowRepositoryLoader repositoryLoader = applicationContext.getBean(LocalFlowRepositoryLoader.class);
|
||||
FlowRepositoryInterface flowRepository = applicationContext.getBean(FlowRepositoryInterface.class);
|
||||
RunnerUtils runnerUtils = applicationContext.getBean(RunnerUtils.class);
|
||||
|
||||
Map<String, String> inputs = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < this.inputs.size(); i=i+2) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.kestra.cli.commands.servers;
|
||||
|
||||
import io.micronaut.context.ApplicationContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.kestra.cli.AbstractCommand;
|
||||
import org.kestra.core.repositories.LocalFlowRepositoryLoader;
|
||||
@@ -18,7 +19,7 @@ abstract public class AbstractServerCommand extends AbstractCommand {
|
||||
CommandLine.Model.CommandSpec spec;
|
||||
|
||||
@Inject
|
||||
private LocalFlowRepositoryLoader localFlowRepositoryLoader;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@CommandLine.Option(names = {"-f", "--flow-path"}, description = "the flow path (when runinng with an memory flow repository)")
|
||||
private File flowPath;
|
||||
@@ -31,6 +32,7 @@ abstract public class AbstractServerCommand extends AbstractCommand {
|
||||
public void run() {
|
||||
if (flowPath != null) {
|
||||
try {
|
||||
LocalFlowRepositoryLoader localFlowRepositoryLoader = applicationContext.getBean(LocalFlowRepositoryLoader.class);
|
||||
localFlowRepositoryLoader.load(this.flowPath);
|
||||
} catch (IOException e) {
|
||||
throw new CommandLine.ParameterException(this.spec.commandLine(), "Invalid flow path", e);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.kestra.cli.commands.servers;
|
||||
|
||||
import io.micronaut.context.ApplicationContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.kestra.core.runners.StandAloneRunner;
|
||||
import org.kestra.core.utils.Await;
|
||||
@@ -14,14 +15,15 @@ import javax.inject.Inject;
|
||||
@Slf4j
|
||||
public class StandAloneCommand extends AbstractServerCommand {
|
||||
@Inject
|
||||
private StandAloneRunner standAloneRunner;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
|
||||
StandAloneRunner standAloneRunner = applicationContext.getBean(StandAloneRunner.class);
|
||||
standAloneRunner.run();
|
||||
|
||||
Await.until(() -> !this.standAloneRunner.isRunning());
|
||||
Await.until(() -> !standAloneRunner.isRunning());
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,6 @@ import javax.inject.Inject;
|
||||
)
|
||||
@Slf4j
|
||||
public class WebServerCommand extends AbstractServerCommand {
|
||||
@CommandLine.Spec
|
||||
CommandLine.Model.CommandSpec spec;
|
||||
|
||||
@Inject
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
sourceCompatibility = 11
|
||||
configurations {
|
||||
tests
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// log
|
||||
@@ -14,7 +16,7 @@ dependencies {
|
||||
compile group: 'net.jodah', name: 'failsafe', version: '2.3.1'
|
||||
|
||||
// test
|
||||
testCompile project(':repository-memory').sourceSets.main.output
|
||||
testCompile project(':runner-memory').sourceSets.main.output
|
||||
testCompile project(':storage-local').sourceSets.main.output
|
||||
testCompile project(':repository-memory')
|
||||
testCompile project(':runner-memory')
|
||||
testCompile project(':storage-local')
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class Execution {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the current execution is on error & normal tasks
|
||||
* Determine if the current execution is on error & normal tasks
|
||||
* Used only from the flow
|
||||
* @param resolvedTasks normal tasks
|
||||
* @param resolvedErrors errors tasks
|
||||
@@ -113,13 +113,14 @@ public class Execution {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the current execution is on error & normal tasks
|
||||
* Determine if the current execution is on error & normal tasks
|
||||
*
|
||||
* if the current have errors, return tasks from errors
|
||||
* if not, return the normal tasks
|
||||
*
|
||||
* @param resolvedTasks normal tasks
|
||||
* @param resolvedErrors errors tasks
|
||||
* @param parentTaskRun the parent task
|
||||
* @return the flow we need to follow
|
||||
*/
|
||||
public List<ResolvedTask> findTaskDependingFlowState(List<ResolvedTask> resolvedTasks, List<ResolvedTask> resolvedErrors, TaskRun parentTaskRun) {
|
||||
|
||||
@@ -184,33 +184,28 @@ public class RunnerUtils {
|
||||
|
||||
public Execution runOne(Flow flow, BiFunction<Flow, Execution, Map<String, Object>> inputs, Duration duration) throws TimeoutException {
|
||||
if (duration == null) {
|
||||
duration = Duration.ofMinutes(5);
|
||||
duration = Duration.ofMinutes(1);
|
||||
}
|
||||
|
||||
Execution execution = this.newExecution(flow, inputs);
|
||||
|
||||
return this.awaitExecution(
|
||||
flow,
|
||||
() -> {
|
||||
this.executionQueue.emit(execution);
|
||||
|
||||
return execution.getId();
|
||||
},
|
||||
execution,
|
||||
duration
|
||||
);
|
||||
}
|
||||
|
||||
public Execution awaitExecution(Flow flow, Supplier<String> emitExecution, Duration duration) throws TimeoutException {
|
||||
AtomicReference<String> executionId = new AtomicReference<>();
|
||||
public Execution awaitExecution(Flow flow, Execution execution, Duration duration) throws TimeoutException {
|
||||
AtomicReference<Execution> receive = new AtomicReference<>();
|
||||
|
||||
Runnable cancel = this.executionQueue.receive(current -> {
|
||||
if (current.getId().equals(executionId.get()) && current.isTerminatedWithListeners(flow)) {
|
||||
if (current.getId().equals(execution.getId()) && current.isTerminatedWithListeners(flow)) {
|
||||
receive.set(current);
|
||||
}
|
||||
});
|
||||
|
||||
executionId.set(emitExecution.get());
|
||||
this.executionQueue.emit(execution);
|
||||
|
||||
Await.until(() -> receive.get() != null, null, duration);
|
||||
|
||||
|
||||
@@ -2,31 +2,58 @@ package org.kestra.core.tasks.flows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.micronaut.context.ApplicationContext;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.kestra.core.models.executions.Execution;
|
||||
import org.kestra.core.queues.QueueFactoryInterface;
|
||||
import org.kestra.core.queues.QueueInterface;
|
||||
import org.kestra.core.repositories.FlowRepositoryInterface;
|
||||
import org.kestra.core.runners.AbstractMemoryRunnerTest;
|
||||
import org.kestra.core.models.executions.Execution;
|
||||
import org.kestra.core.runners.InputsTest;
|
||||
import org.kestra.core.runners.RunContext;
|
||||
import org.kestra.core.runners.RunOutput;
|
||||
import org.kestra.core.runners.RunnerUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.kestra.core.utils.Await;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
|
||||
class FlowTest extends AbstractMemoryRunnerTest {
|
||||
@Inject
|
||||
ApplicationContext applicationContext;
|
||||
|
||||
@Inject
|
||||
RunnerUtils runnerUtils;
|
||||
FlowRepositoryInterface flowRepositoryInterface;
|
||||
|
||||
@Inject
|
||||
FlowRepositoryInterface flowRepositoryInterface;
|
||||
@Named(QueueFactoryInterface.EXECUTION_NAMED)
|
||||
QueueInterface<Execution> executionQueue;
|
||||
|
||||
private Execution awaitExecution(org.kestra.core.models.flows.Flow flow, Supplier<String> emitExecution, Duration duration) throws TimeoutException {
|
||||
AtomicReference<String> executionId = new AtomicReference<>();
|
||||
AtomicReference<Execution> receive = new AtomicReference<>();
|
||||
|
||||
Runnable cancel = this.executionQueue.receive(current -> {
|
||||
if (current.getId().equals(executionId.get()) && current.isTerminatedWithListeners(flow)) {
|
||||
receive.set(current);
|
||||
}
|
||||
});
|
||||
|
||||
executionId.set(emitExecution.get());
|
||||
|
||||
Await.until(() -> receive.get() != null, null, duration);
|
||||
|
||||
cancel.run();
|
||||
|
||||
return receive.get();
|
||||
}
|
||||
|
||||
@Test
|
||||
void run() throws Exception {
|
||||
@@ -38,7 +65,7 @@ class FlowTest extends AbstractMemoryRunnerTest {
|
||||
)
|
||||
);
|
||||
|
||||
Execution execution = runnerUtils.awaitExecution(
|
||||
Execution execution = this.awaitExecution(
|
||||
flowRepositoryInterface.findById("org.kestra.tests", "inputs").get(),
|
||||
() -> {
|
||||
Flow flow = Flow.builder()
|
||||
|
||||
@@ -30,7 +30,7 @@ services:
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
||||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
|
||||
KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE: 'false'
|
||||
links:
|
||||
- zookeeper
|
||||
|
||||
0
docker/app/confs/.gitkeep
Normal file
0
docker/app/confs/.gitkeep
Normal file
34
docker/app/jvm.options
Normal file
34
docker/app/jvm.options
Normal file
@@ -0,0 +1,34 @@
|
||||
###########################################################################
|
||||
# jvm.options #
|
||||
# #
|
||||
# - all flags defined here will be used to startup the JVM #
|
||||
# - one flag should be specified per line #
|
||||
# - lines that do not start with '-' will be ignored #
|
||||
# - only static flags are accepted (no variables or parameters) #
|
||||
# - dynamic flags will be appended to these on cassandra-env #
|
||||
###########################################################################
|
||||
|
||||
# Server Hotspot JVM
|
||||
-server
|
||||
|
||||
# ensure UTF-8 encoding by default (e.g. filenames)
|
||||
-Dfile.encoding=UTF-8
|
||||
|
||||
# set to headless, just in case
|
||||
-Djava.awt.headless=true
|
||||
|
||||
# generate a heap dump when an allocation from the Java heap fails
|
||||
# heap dumps are created in the working directory of the JVM
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
-XX:HeapDumpPath=/tmp/heapdump.log
|
||||
|
||||
# Do not rely on the system configuration
|
||||
-Dfile.encoding=UTF-8
|
||||
-Duser.timezone=UTC
|
||||
|
||||
# Jmx Remote
|
||||
-Dcom.sun.management.jmxremote
|
||||
-Dcom.sun.management.jmxremote.port=8686
|
||||
-Dcom.sun.management.jmxremote.local.only=false
|
||||
-Dcom.sun.management.jmxremote.authenticate=false
|
||||
-Dcom.sun.management.jmxremote.ssl=false
|
||||
10
docker/app/kestra
Executable file
10
docker/app/kestra
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Read user-defined JVM options from jvm.options file
|
||||
JVM_OPTS_FILE=${JVM_OPTS_FILE:-/app/jvm.options}
|
||||
for JVM_OPT in `grep "^-" ${JVM_OPTS_FILE}`
|
||||
do
|
||||
JAVA_OPTS="${JAVA_OPTS} ${JVM_OPT}"
|
||||
done
|
||||
|
||||
/usr/local/openjdk-11/bin/java ${JAVA_OPTS} -cp /app/libs/kestra.jar:/app/libs/plugins/* org.kestra.cli.App "$@"
|
||||
0
docker/app/libs/.gitkeep
Normal file
0
docker/app/libs/.gitkeep
Normal file
0
docker/app/libs/plugins/.gitkeep
Normal file
0
docker/app/libs/plugins/.gitkeep
Normal file
9
docker/usr/local/bin/docker-entrypoint.sh
Executable file
9
docker/usr/local/bin/docker-entrypoint.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "${KESTRA_CONFIGURATION}" ]; then
|
||||
echo "${KESTRA_CONFIGURATION}" > /app/confs/application.yml
|
||||
fi
|
||||
|
||||
exec /app/kestra "$@"
|
||||
24
package-lock.json
generated
24
package-lock.json
generated
@@ -4969,9 +4969,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"d3": {
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/d3/-/d3-5.14.2.tgz",
|
||||
"integrity": "sha512-Ccipa9XrYW5N0QkP6u0Qb8kU6WekIXBiDenmZm1zLvuq/9pBBhRCJLCICEOsH5Og4B0Xw02bhqGkK5VN/oPH0w==",
|
||||
"version": "5.15.0",
|
||||
"resolved": "https://registry.npmjs.org/d3/-/d3-5.15.0.tgz",
|
||||
"integrity": "sha512-C+E80SL2nLLtmykZ6klwYj5rPqB5nlfN5LdWEAVdWPppqTD8taoJi2PxLZjPeYT8FFRR2yucXq+kBlOnnvZeLg==",
|
||||
"requires": {
|
||||
"d3-array": "1",
|
||||
"d3-axis": "1",
|
||||
@@ -5104,9 +5104,9 @@
|
||||
}
|
||||
},
|
||||
"d3-format": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.2.tgz",
|
||||
"integrity": "sha512-gco1Ih54PgMsyIXgttLxEhNy/mXxq8+rLnCb5shQk+P5TsiySrwWU5gpB4zen626J4LIwBxHvDChyA8qDm57ww=="
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.3.tgz",
|
||||
"integrity": "sha512-mm/nE2Y9HgGyjP+rKIekeITVgBtX97o1nrvHCWX8F/yBYyevUTvu9vb5pUnKwrcSw7o7GuwMOWjS9gFDs4O+uQ=="
|
||||
},
|
||||
"d3-geo": {
|
||||
"version": "1.11.9",
|
||||
@@ -5190,9 +5190,9 @@
|
||||
"integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="
|
||||
},
|
||||
"d3-time-format": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.2.2.tgz",
|
||||
"integrity": "sha512-pweL2Ri2wqMY+wlW/wpkl8T3CUzKAha8S9nmiQlMABab8r5MJN0PD1V4YyRNVaKQfeh4Z0+VO70TLw6ESVOYzw==",
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.2.3.tgz",
|
||||
"integrity": "sha512-RAHNnD8+XvC4Zc4d2A56Uw0yJoM7bsvOlJR33bclxq399Rak/b9bhvu/InjxdWhPtkgU53JJcleJTGkNRnN6IA==",
|
||||
"requires": {
|
||||
"d3-time": "1"
|
||||
}
|
||||
@@ -13272,9 +13272,9 @@
|
||||
"integrity": "sha512-UHd0fiUjPgRmHIGhI6yUKtnJsHOdvzD00QUGUtD+FaxWWZRWF2AAb7KPZRj0j/egVfZQvey6M6woHn78GbTogA=="
|
||||
},
|
||||
"vue-sidebar-menu": {
|
||||
"version": "4.4.4",
|
||||
"resolved": "https://registry.npmjs.org/vue-sidebar-menu/-/vue-sidebar-menu-4.4.4.tgz",
|
||||
"integrity": "sha512-E9y0v7uYSykQVUwh6eH9tTSmzTPz4b0Dk9L6UTlGtLdiX9ROO5oPIZ4LbuKeaZUEJq3No9KeShKUcWWBTpTxWA==",
|
||||
"version": "4.4.5",
|
||||
"resolved": "https://registry.npmjs.org/vue-sidebar-menu/-/vue-sidebar-menu-4.4.5.tgz",
|
||||
"integrity": "sha512-5tgFVK7G1Ad30SBTbKsjuwiA0ch2CPGYVhkbH06vghkI6NbXOW+vMkdNO3LWcGlXPsdIobHjrUJVkJwJb8zdVw==",
|
||||
"requires": {
|
||||
"path-to-regexp": "^1.7.0",
|
||||
"vue": "^2.5.21"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"bootstrap": "^4.4.1",
|
||||
"bootstrap-vue": "^2.1.0",
|
||||
"core-js": "^2.6.11",
|
||||
"d3": "^5.14.2",
|
||||
"d3": "^5.15.0",
|
||||
"humanize-duration": "^3.21.0",
|
||||
"vue": "^2.6.11",
|
||||
"vue-axios": "^2.1.5",
|
||||
@@ -21,7 +21,7 @@
|
||||
"vue-moment": "^4.0.0",
|
||||
"vue-router": "^3.1.3",
|
||||
"vue-select": "^3.4.0",
|
||||
"vue-sidebar-menu": "^4.4.3",
|
||||
"vue-sidebar-menu": "^4.4.5",
|
||||
"vue-sse": "^1.0.2",
|
||||
"vue2-ace-editor": "^0.0.15",
|
||||
"vue2-datepicker": "^3.2.2",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
elasticsearch:
|
||||
httpHosts: http://kestra:9200
|
||||
httpHosts: http://localhost:9200
|
||||
|
||||
kestra:
|
||||
repository:
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
sourceCompatibility = 11
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
@@ -7,6 +7,6 @@ dependencies {
|
||||
compile group: "org.apache.kafka", name: 'kafka-streams', version: kafkaVersion
|
||||
|
||||
testCompile project(':core').sourceSets.test.output
|
||||
testCompile project(':repository-memory').sourceSets.main.output
|
||||
testCompile project(':storage-local').sourceSets.main.output
|
||||
testCompile project(':repository-memory')
|
||||
testCompile project(':storage-local')
|
||||
}
|
||||
@@ -11,7 +11,7 @@ kestra:
|
||||
kafka:
|
||||
client:
|
||||
properties:
|
||||
bootstrap.servers: "kafka:9092"
|
||||
bootstrap.servers: "localhost:9092"
|
||||
|
||||
defaults:
|
||||
topic:
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
sourceCompatibility = 11
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
|
||||
testCompile project(':core').sourceSets.test.output
|
||||
testCompile project(':repository-memory').sourceSets.main.output
|
||||
testCompile project(':storage-local').sourceSets.main.output
|
||||
testCompile project(':repository-memory')
|
||||
testCompile project(':storage-local')
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
sourceCompatibility = 11
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
@@ -7,5 +7,5 @@ dependencies {
|
||||
compile 'com.google.cloud:google-cloud-storage:1.101.0'
|
||||
|
||||
testCompile project(':core').sourceSets.test.output
|
||||
testCompile project(':storage-local').sourceSets.main.output
|
||||
testCompile project(':storage-local')
|
||||
}
|
||||
@@ -11,5 +11,5 @@ kestra:
|
||||
gcs:
|
||||
bucket: "kestra-unit-test"
|
||||
bigquery:
|
||||
project: "kestra"
|
||||
project: "kestra-unit-test"
|
||||
dataset: "kestra_unit_test"
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
@@ -6,7 +6,7 @@ dependencies {
|
||||
compile "io.micronaut:micronaut-http-client"
|
||||
|
||||
testCompile project(':core').sourceSets.test.output
|
||||
testCompile project(':runner-memory').sourceSets.main.output
|
||||
testCompile project(':repository-memory').sourceSets.main.output
|
||||
testCompile project(':storage-local').sourceSets.main.output
|
||||
testCompile project(':runner-memory')
|
||||
testCompile project(':repository-memory')
|
||||
testCompile project(':storage-local')
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
compile project(":core")
|
||||
@@ -7,5 +7,5 @@ dependencies {
|
||||
compile 'de.siegmar:fastcsv:1.0.3'
|
||||
|
||||
testCompile project(':core').sourceSets.test.output
|
||||
testCompile project(':storage-local').sourceSets.main.output
|
||||
testCompile project(':storage-local')
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
frontend {
|
||||
nodeVersion = '12.14.0'
|
||||
assembleScript = 'run build'
|
||||
|
||||
@@ -39,7 +39,7 @@ export default {
|
||||
})
|
||||
},
|
||||
followExecution(_, options) {
|
||||
return Vue.SSE(`${Vue.axios.defaults.baseURL}/api/v1/executions/${options.id}/follow`, { format: 'json' })
|
||||
return Vue.SSE(`${Vue.axios.defaults.baseURL}api/v1/executions/${options.id}/follow`, { format: 'json' })
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
sourceCompatibility = 11
|
||||
bintrayUpload.enabled = false
|
||||
|
||||
dependencies {
|
||||
annotationProcessor "io.micronaut.configuration:micronaut-openapi"
|
||||
@@ -12,7 +12,7 @@ dependencies {
|
||||
|
||||
// test
|
||||
testCompile project(':core').sourceSets.test.output
|
||||
testCompile project(':repository-memory').sourceSets.main.output
|
||||
testCompile project(':runner-memory').sourceSets.main.output
|
||||
testCompile project(':storage-local').sourceSets.main.output
|
||||
testCompile project(':repository-memory')
|
||||
testCompile project(':runner-memory')
|
||||
testCompile project(':storage-local')
|
||||
}
|
||||
Reference in New Issue
Block a user