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
13.25k stars 1.15k forks source link

Rename the printContext() pebble function to fetchContext() or just context() #5993

Open anna-geller opened 6 days ago

anna-geller commented 6 days ago

Feature description

Best if we can rename it with a "softly-deprecated" alias :)

Given that this function fetches and returns data that can be used in downstream tasks, it would be better to call it "fetch" or "get" rather than "print" — "print" would be suitable if it would log sth to the console but here it returns context that can be used to fetch specific info e.g. {{ printContext().taskrun }}

Full example:

id: myflow
namespace: company.team

tasks:
  - id: hello
    type: io.kestra.plugin.core.debug.Return
    format: "{{ printContext() }}"

  - id: print
    type: io.kestra.plugin.core.log.Log
    message: 
      - "{{ json(outputs.hello.value).execution }}"
      - "{{ json(outputs.hello.value).labels }}"
      - "{{ json(outputs.hello.value).tasks }}"
Amandixit10 commented 6 days ago

i want to pick this issue, please assign it to me.