kestra-io / kestra

:zap: Workflow Automation Platform. Orchestrate & Schedule code in any language, run anywhere, 500+ plugins. Alternative to Zapier, Rundeck, Camunda, Airflow...
https://kestra.io
Apache License 2.0
14k stars 1.2k forks source link

Add a Pebble function to generate a random number #6207

Open anna-geller opened 3 days ago

anna-geller commented 3 days ago

Feature description

sth like in Python:

import random

random_value = random.randint(0, 1)
kyradjis commented 2 days ago

Hey, i think i could work on this issue. Can you please explain where you want me to implement the function? @anna-geller

loicmathieu commented 8 hours ago

Hi, thanks to volunteer to implement this.

Pebble functions are implemented here: https://github.com/kestra-io/kestra/tree/develop/core/src/main/java/io/kestra/core/runners/pebble/functions

You need to add a new class and configure it here: https://github.com/kestra-io/kestra/blob/develop/core/src/main/java/io/kestra/core/runners/pebble/Extension.java#L123

Don't forget to add a new test for the function.