<@ULVA73B9P> I have a prefect.yaml file that corre...
# ask-marvin
d
@Marvin I have a prefect.yaml file that correctly creates the anticipated deployments with
prefect 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
Copy code
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?
m
To use environment variables in the
parameters
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 the
prefect.yaml
file using the
{{ $ENV_VAR_NAME }}
syntax. This assumes that the machine where
prefect deploy
is run would have these environment variables set.
Additionally, you might want to check if there is a configuration setting for controlling CLI prompts. The CLI settings documentation mentions a setting named
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.
d
Yes, the environment variable is correctly set, but the question is still asked
Yes, the environment variable is correctly set, but the question is still asked
n
hi @David Deepwell! it sounds like this could be a bug if this is the case
I've determined that this is caused by using an environment variable within the parameters section of a deployment
in general you should be able to sidestep all interactive prompts with
prefect --no-prompt deploy ...
also just heads up at this time marvin only sees messages its tagged in
d
Thanks, I figured that out, but unfortunately spammed people in the process 🫠
n
no worries marvin should be good enough to have figured out what you were looking for so that's on me 🙂
d
If you think it might be a bug, I'll open a ticket since I want to avoid ignoring all prompts
n
yeah if you're seeing or not seeing a prompt based on whether you have the env var set, something is up
d
This actually gets weirder. The prompt doesn't occur if the environment variable is not set. In this case, the deployment occurs but incorrectly sets the parameter to an empty value
I think I'll definitely open a ticket now!
Ticket created: #17409
n
thank you for the MRE!
im seeing what you were seeing, if anything its weird that it doesn't ask in the case where you don't have it set perhaps we should add a flag to avoid it asking specifically "do you want to save this config" (but something about that seems off to me still batman think )
d
I'm content with the unset case. It provides a warning about the variable, but you can still set it when manually triggering the flow in the UI
👍 1
The case when the variable is set seems weird since if the
"{{ $SETTINGS_FILE }}"
parameter is replaced with
prefect.yaml
everything works fine and there is no prompt