feat(cicd): add an executable jar

- Generate a self executable jar
- Refactor the docker image to use the executable
- Add a command `plugins install` to download a plugins
This commit is contained in:
tchiotludo
2020-01-03 17:37:49 +01:00
parent f4e9423ff4
commit 2fbae458c5
19 changed files with 476 additions and 106 deletions

42
gradle/jar/selfrun.bat Normal file
View File

@@ -0,0 +1,42 @@
@echo off
REM NOTE: Do not use backquotes in this bat file because backquotes are unintentionally recognized by sh.
REM NOTE: Just quotes are available for [ for /f "delims=" %%w ('...') ].
setlocal
REM Do not use %0 to identify the JAR (bat) file.
REM %0 is just "kestra" when run by just "> kestra" while %0 is "kestra.bat" when run by "> kestra.bat".
SET this=%~f0
REM Plugins path default to pwd & must be exported as env var
SET "current_dir=%~dp0"
IF NOT DEFINED kestra_plugins_path (set "kestra_plugins_path=%current_dir%plugins\")
REM Check java version
FOR /f "delims=" %%w in ('java -fullversion 2^>^&1') do set java_fullversion=%%w
ECHO %java_fullversion% | find " full version ""1." > NUL
IF NOT ERRORLEVEL 1 (set java_version=1)
ECHO %java_fullversion% | find " full version ""9" > NUL
IF NOT ERRORLEVEL 1 (set java_version=9)
ECHO %java_fullversion% | find " full version ""10" > NUL
IF NOT ERRORLEVEL 1 (set java_version=10)
IF NOT DEFINED java_version (set java_version=0)
IF %java_version% NEQ 0 (
ECHO [ERROR] Kestra require at least Java 11.. 1>&2
EXIT 1
)
echo java %JAVA_OPTS% -cp "%this%:%kestra_plugins_path%*" org.kestra.cli.App %*
java %JAVA_OPTS% -cp "%this%;%kestra_plugins_path%*" org.kestra.cli.App %*
ENDLOCAL
exit /b %ERRORLEVEL%

16
gradle/jar/selfrun.sh Normal file
View File

@@ -0,0 +1,16 @@
# Plugins path default to pwd & must be exported as env var
KESTRA_PLUGINS_PATH=${KESTRA_PLUGINS_PATH:-"$(dirname "$0")/plugins"}
export KESTRA_PLUGINS_PATH=${KESTRA_PLUGINS_PATH}
# Check java version
JAVA_FULLVERSION=$(java -fullversion 2>&1)
case "$JAVA_FULLVERSION" in
[a-z]*\ full\ version\ \"\(1|9|10\)\..*\")
echo "[ERROR] Kestra require at least Java 11." 1>&2
exit 1
;;
esac
# Exec
exec java ${JAVA_OPTS} -cp "$0:${KESTRA_PLUGINS_PATH}/*" org.kestra.cli.App "$@"
exit 127