flyctl: Some flyctl commands do not provide a flag to confirm prompts in advance
Describe the bug
Most flyctl commands provide a flag to skip the warning/confirmation prompt that comes up when running a command with a different --app than that in the fly.toml configuration file, such as --yes. I have found that all flyctl secrets sub-commands do not have this option, making them harder to use in automated environments such as CI.
- Operating system: -
fly version: v0.0.320
** Command output: **
$ fly secrets set --app <some other app> AUTH_SECRET=$(openssl rand -base64 40) # ...
WARN app flag '<other app>' does not match app name in config file '<current app>'
? Continue using '<other app>' (y/N) ...
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 3
- Comments: 15 (8 by maintainers)
I wanted to share a solution that I’ve implemented for automating the confirmation prompt during deployment with flyctl and extracting the deployed URL using my REST API. This solution may be useful for cases where you want to automate the deployment process and retrieve information, such as the deployed URL, for further use.
Here’s a sample bash code snippet which i called using child_process and regular expressions in my REST API:
echo “y” | flyctl launch --now --copy-config -y --yes
it worked for me, --copy-config bypassed first confirmation and -y --yes bypassed second confirmation for region and config.
We want any command that asks for confirmation to do this. I can’t say which anecdotally, so worth digging in code for usage of
survey.Confirmprompt.Confirm,confirmetc.Running into this issue as well. Tried all the same approaches as @3x071c, in addition to
yes | flyctl ..., all resulting in the EOF behaviour.Unfortunately this renders a number of the commands unusable for automated deployments.
This is harder than I expected. Most ways of simulating user input (by piping
echo, possibly in a subshell, or a here docstring) result in fly complaining about an EOF in the input. Is there a temporary workaround for this?