https://flyte.org logo
#ask-the-community
Title
# ask-the-community
f

Frank Shen

12/05/2022, 11:21 PM
Hello, In the task , I am trying to dynamically set the env variable like this: if domain is ‘development’, then env=‘dev’ if domain is ‘stage’, then env=‘stage’ if domain is ‘production’, then env=‘prod’ The question is how to determine the domain in code? I tried flytekit.current_context() with no avail. Could someone shed some light? Thanks
k

Katrina P

12/05/2022, 11:26 PM
We set environment variables in our CI/CD process using the same parameter that sets the target domain to deploy workflows to (which is tied to our branch name). Would be interested in following this thread in case there's a better way to do it
f

Frank Shen

12/05/2022, 11:29 PM
@Katrina P that’s a great way to do that.
e

Eduardo Apolinario (eapolinario)

12/05/2022, 11:42 PM
@Frank Shen, the field called
execution_id
found in
flytekit.current_context()
contains the project, domain, and execution name (as defined in https://github.com/flyteorg/flytekit/blob/master/flytekit/models/core/identifier.py#L100-L109 )
f

Frank Shen

12/05/2022, 11:58 PM
@Eduardo Apolinario (eapolinario) Thank you!
2 Views