David Deepwell
03/06/2025, 9:20 PMprefect deploy
, but is asking "Would you like to save configuration for this deployment for faster deployments in the future?" I've determined that this is caused by using an environment variable within the parameters section of a deployment. Here is an example
deployments:
- name: poll-manifest-transfers
parameters:
settings_file: "{{ $SETTINGS_FILE }}"
When a string is used instead of "{{ $SETTINGS_FILE }}"
(such as /path/to/file.txt
) then the question to save the configuration isn't asked. How do I use the environment variable and avoid the question?Marvin
03/06/2025, 9:20 PMparameters
section of your prefect.yaml
file without being prompted to save the configuration, you should ensure that the environment variable is set on the machine where prefect deploy
is run. Here's a relevant excerpt from the Prefect documentation:
To use environment variables that are already set in your local environment, you can template these in theAdditionally, you might want to check if there is a configuration setting for controlling CLI prompts. The CLI settings documentation mentions a setting namedfile using theprefect.yaml
syntax. This assumes that the machine where{{ $ENV_VAR_NAME }}
is run would have these environment variables set.prefect deploy
PREFECT_CLI_PROMPT
that controls interactive prompts. Setting this to False
could prevent the prompt from appearing, but be cautious as this could suppress other prompts as well.
If these approaches don't resolve the issue, consider verifying that the environment variable is correctly set before running the deployment command. If the variable is missing or incorrectly set, Prefect might not recognize it, leading to the prompt.
For more details on templating options and environment variables, you can refer to the Prefect YAML documentation.David Deepwell
03/06/2025, 9:34 PMDavid Deepwell
03/06/2025, 9:35 PMNate
03/06/2025, 9:39 PMI've determined that this is caused by using an environment variable within the parameters section of a deploymentin general you should be able to sidestep all interactive prompts with
prefect --no-prompt deploy ...
Nate
03/06/2025, 9:40 PMDavid Deepwell
03/06/2025, 9:47 PMNate
03/06/2025, 9:48 PMDavid Deepwell
03/06/2025, 9:48 PMNate
03/06/2025, 9:49 PMDavid Deepwell
03/06/2025, 9:57 PMDavid Deepwell
03/06/2025, 9:57 PMDavid Deepwell
03/06/2025, 11:12 PMNate
03/06/2025, 11:18 PMNate
03/06/2025, 11:25 PMDavid Deepwell
03/06/2025, 11:27 PMDavid Deepwell
03/06/2025, 11:28 PM"{{ $SETTINGS_FILE }}"
parameter is replaced with prefect.yaml
everything works fine and there is no prompt