Rajip Upreti
12/10/2024, 9:24 AMMarvin
12/10/2024, 9:24 AMRajip Upreti
12/10/2024, 9:25 AMMarvin
12/10/2024, 9:26 AMprefect.yaml
file. Here's a general approach:
1. Template Environment Variables: Use environment variables within your prefect.yaml
deployment file using the syntax {{ $ENV_VAR_NAME }}
. This templating allows you to dynamically set these variables based on the environment or deployment context.
2. Define in prefect.yaml: You can define job variables in your deployment configuration file, prefect.yaml
. This includes environment variables like EXECUTION_ENVIRONMENT
that can be sourced from your environment:
yaml
job_variables:
EXECUTION_ENVIRONMENT: "{{ $EXEC_ENV }}"
3. Set Local Environment Variables: Before deploying, ensure that your environment variables are set in the machine where prefect deploy
is run. These can be set in your shell or within a .env
file that's local to your project directory.
4. Deploy: Run the deployment with the Prefect CLI, and the variables will be set accordingly:
shell
export EXEC_ENV="production"
prefect deploy -n demo-deployment
This setup assumes that the environment variables are correctly set in the environment before deployment, allowing you to have a dynamic configuration based on deployment needs.
For more details on managing deployment configurations and templating, you can check the Prefect 3.x documentation.
The GitHub issue search didn't quite work out, probably because, like Marvin, some features prefer to stay quietly unnoticed... at least until they're really needed.