treasure-data / digdag

Workload Automation System
https://www.digdag.io/
Apache License 2.0
1.3k stars 221 forks source link

_env keyword not mentioned in the documentation #1656

Open FredericoCoelhoNunes opened 2 years ago

FredericoCoelhoNunes commented 2 years ago

The Github repo links to this documentation: https://docs.digdag.io/

However, the _env keyword is not mentioned there. It is, however, mentioned here: https://docs.treasuredata.com/display/public/PD/How+to+use+Secrets+in+Custom+Scripts

Which is the most updated documentation page?

hiroyuki-sato commented 2 years ago

Hello, @FredericoCoelhoNunes

Thank you for reporting that. It is the best time to contribute to this project! Let's create PR. https://github.com/treasure-data/digdag/blob/master/digdag-docs/src/operators/sh.md

As far as I know, sh>, py>, and rb> operator supports the_env option.

FredericoCoelhoNunes commented 2 years ago

Hello @hiroyuki-sato ,

thanks for replying. I didn't understand if you were asking me to create the PR, but I don't think I have the availability to do that; besides, I am not even 100% sure how the _env keyword works internally, nor do I know what is the relationship between the DigDag and the Treasure Data documentation . I wouldn't feel adequately prepared to make a contribution!

hiroyuki-sato commented 2 years ago

Hello, @FredericoCoelhoNunes

Could you try the following example?

_export:
  myapp:
    key1: val1

+task1:
  sh>: env
  _env:
    myapp_key1: ${myapp.key1}
myapp={"key1":"val1"} # export inplicitly from _export part. It is an unuseful data layout for use in a shell.
myapp_key1=val1       # define explicitly in _env section.

You also use _env: option in py> and rb> operators

FredericoCoelhoNunes commented 2 years ago

@hiroyuki-sato yep, that is how I've seen it being used in the past. Thanks!