Setting environment variables in a ray cluster

I would like to set an environment variable in my ray cluster to be available to the head and all worker nodes. How can that be done?

So after I do ray up cluster.yaml I would like to be able to do a ray attach cluster.yaml and do an echo $VAR and see my value.

Thanks a lot!

So I managed to make this work by using env in the cluster.yaml for both worker and head node types. the only problem is is that value of the variable needs to be hardcoded in the yaml. Although this is fine for regular environment variables for sensitive values it would be nice if there was a way to pass those values by variable name. Is there anything like that supported currently?

You should be able to provide override_environment_variables to ray.remote: API and Package Reference — Ray v2.0.0.dev0

cc @architkulkarni