Hello Community!
I want to know, when I use the tuist generate
command, what are the ways to set environment variables?
In this documentation, I found that I can pass parameters when executing the tuist generate
command. In addition, I found in this answer that only variables starting with TUIST_
will be captured by the generate
command.
Is there any other way? For example, in Gitlab-CI, some variables have been defined in the pipeline, so can I read it in the manifest file? And does the restriction starting with TUIST_
still exist?
你好! 
Welcome @rakuyoMo.
You can pass environment variables when invoking Tuist commands. For example:
TUIST_XXXX=foo tuist generate
As well as globally in your environment, for example using GitLab-CI:
job1:
variables:
TUIST_XXX: "foo"
script:
- echo "Variables are '$ALL_JOBS_VAR' and '$JOB1_VAR'"
It does. Though the convention, Tuist knows which environment variables your project definition depends on, and therefore should be hashed for features like selective testing or cache
Ok, thank you very much for your reply! It helps me a lot! Thank you.
Additional note:
If you need to call it via mise exec --
, you need to do it like this:
mise exec -- TUIST_XXX=YYY tuist generate ❌
mise exec -- env TUIST_XXX=YYY tuist generate ✅
TUIST_XXX=YYY mise exec -- tuist generate ✅
2 Likes
Yeah! mise x
is about activating an environment with a particular tool and version. You have to remember to pass the tool after --