added kestra boilerplates

This commit is contained in:
Christian Lempa 2024-04-19 14:41:05 +02:00
parent 3aeae37ce2
commit 743e25a974
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Kestra Python Command Template
# ---
#
# This template is a simple Python script.
#
# usage:
# make sure the Kestra instance can access the /app/scripts/your-python-script.py file
# if you're running Kestra in Docker, use a volume to mount the file/directory.
id: python-command
namespace: # your-namespace
tasks:
- id: python_command
type: io.kestra.plugin.scripts.python.Commands
commands:
- python /app/scripts/your-python-script.py
runner: PROCESS # or DOCKER (might be deprecated in the future) use TaskRunner instead

28
kestra/python/script.yaml Normal file
View File

@ -0,0 +1,28 @@
# Kestra Python Command Template
# ---
#
# This template is a simple Python script that can be used to make a request to a website and log the status code.
#
id: python-script
namespace: # your-namespace
tasks:
- id: python_script
type: io.kestra.plugin.scripts.python.Script
runner: DOCKER # (might be deprecated in the future) use TaskRunner instead
script: |
from kestra import Kestra
import requests
response = requests.get('{{inputs.website}}')
print(response.status_code)
Kestra.outputs({'status': response.status_code, 'text': response.text})
beforeCommands:
- pip install requests kestra
- id: log
type: io.kestra.core.tasks.log.Log
message: "StatusCode: {{outputs.pythonscript.vars.status}}"

18
kestra/webhook.yaml Normal file
View File

@ -0,0 +1,18 @@
# Kestra Webhook Template
# ---
#
# This template is a simple webhook trigger that can be used to trigger a task execution.
#
# usage:
# curl http://your-kestra-instance/api/v1/executions/webhook/your-namespace/your-task-id/your-secret-key
id: webhook
namespace: # your-namespace
tasks:
# your-tasks
triggers:
- id: webhook
type: io.kestra.core.models.triggers.types.Webhook
key: # your-secret-key, keep this secret!