CI plugin to convert Groovy scripts to JVM executable JAR. It packages all @Grab
dependencies and Groovy libraries, so it can be run without Groovy on target machine. Main class name is the same as original script name.
docker run --rm \
-v /path/to/target-repo:/work \
-w=/work \
-e PARAMETER_SCRIPT_PATH=/work/TargetRepoScript.groovy \
-e PARAMETER_OUTPUT_FILE=/work/docker/TargetRepoScript.jar \
-e PARAMETER_STATIC_COMPILE=false \
devatherock/scriptjar:1.0.0
The following parameters can be set to configure the plugin.
- script_path - Relative path to the groovy script file
- output_file - Relative path to the output file. Optional, defaults to
<script-name>.jar
- static_compile - Indicates whether to compile the script statically. Defaults to
false
Sample vela config:
steps:
- name: groovy_script_to_jar
ruleset:
branch: master
event: push
image: devatherock/scriptjar:1.0.0
parameters:
script_path: groovy/MyScript.groovy
output_file: build/libs/my-script.jar
version: 2.1
jobs:
groovy_script_to_jar:
docker:
- image: devatherock/scriptjar:1.0.0
working_directory: ~/my-repo
environment:
PARAMETER_SCRIPT_PATH: groovy/MyScript.groovy # Relative path to the groovy script file
PARAMETER_OUTPUT_FILE: build/libs/my-script.jar # Relative path to the output file. Optional, defaults to <script-name>.jar
PARAMETER_STATIC_COMPILE: false # Indicates whether to compile the script statically. Defaults to `false`
steps:
- checkout
- run: sh /scripts/entry-point.sh
To test the latest plugin images, run the below command
make test