This plugin is currently in beta. While it is considered safe for use, please be aware that its API could change in ways that are not compatible with earlier versions in future releases, or it might become unsupported.
Execute a JavaScript script using the GraalVM scripting engine.
yaml
type: "io.kestra.plugin.graalvm.js.Eval"
Execute a JavaScript script using the GraalVM scripting engine.
yaml
id: evalJs
namespace: company.team
tasks:
- id: evalJs
type: io.kestra.plugin.graalvm.js.Eval
outputs:
- out
- map
script: |
(function() {
var Counter = Java.type('io.kestra.core.models.executions.metrics.Counter');
var File = Java.type('java.io.File');
var FileOutputStream = Java.type('java.io.FileOutputStream');
logger.info('Task started');
runContext.metric(Counter.of('total', 666, 'name', 'bla'));
map = {'test': 'here'};
var tempFile = runContext.workingDir().createTempFile().toFile();
var output = new FileOutputStream(tempFile);
output.write([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]);
out = runContext.storage().putFile(tempFile);
return {"map": map, "out": out};
})
Dynamic
YES
The script to evaluate
SubType string
Dynamic
YES
A List of outputs variables that will be usable in outputs.
The captured outputs as declared on the outputs
task property.