digdag-plugin-example
digdag-plugin-example copied to clipboard
An example of Digdag plugin
digdag-plugin-example
1) build
./gradlew publish
Artifacts are build on local repos: ./build/repo
.
2) run an example
digdag selfupdate
digdag run --project sample plugin.dig -p repos=`pwd`/build/repo
You'll find the result of the task in ./sample/example.out
.
Writing your own plugin
-
You need to implement a Plugin class that implements
io.digdag.spi.Plugin
. -
Then, list it on io.digdag.spi.Plugin. The listed plugins are loaded by Digdag.
You can optionally create Eclipse/Idea project files as follows:
gradle eclipse
gradle idea
Note: It's better to change the dependencies from provided
to compile
in build.gradle for creating idea/eclipse project config.
Plugin Loading
Digdag loads pluigins from Maven repositories by configuring plugin options.
You can use a local Maven repository (local FS, Amazon S3) or any public Maven repository (Maven Central, Sonatype, Bintary, Jitpack) for the plugin artifact repository.
Publishing your plugin using Github and Jitpack
Jitpack is useful for publishing your github repository as a maven repository.
git tag v0.1.3
git push origin v0.1.3
https://jitpack.io/#myui/digdag-plugin-example/v0.1.3
Now, you can load the artifact from a github repository in a dig file as follows:
_export:
plugin:
repositories:
# - file://${repos}
- https://jitpack.io
dependencies:
# - io.digdag.plugin:digdag-plugin-example:0.1.3
- com.github.myui:digdag-plugin-example:v0.1.3