fnproject/cli

Remove automatic application creation on function deployment

shaunsmith opened this issue · 4 comments

The automatic creation of an application on function deployment seemed like a good idea but in practice is can lead to problems and should no longer be supported.

For example, mistyping the intended application name in fn deploy --app WRONGAPP will not be detected by the user as a new application will be automatically created. This can lead to some confusion as a subsequent call to fn ls functions RIGHTAPP will not include the function deployed to WRONGAPP.

As it's not possible for the user to detect when they've made a mistake automatic creation should be removed. As a result of this change, users will first have to create an application using fn create application APPNAME and then fn deploy --app APPNAME will validate that the provided application name currently exists. If it does not exist then an error is returned.

@michael-w-williams Sorry but this change would require updates to pretty much every tutorial and many doc pages!

I'm starting on updating the tutorials.

this change makes me sad. i hope that at least we can have a flag for --upsert or something on deploy that will create if needed -- this just means i'm going to write a bash script to hack around deploy sucking, which sucks (i won't be the only one), unless there's a flag, then i'll just use the flag - i can certainly appreciate the behavior causing issues in more strict deployments, i would like to show a picture of why not both little girl for posterity:
ja2kqwe

@rdallman I've enjoyed the convenience in the past but now it's become a problem. But it's really only a problem when deploying individual functions. If you've got more than one you would provide an app.yaml for use with fn deploy --all.

Thinking out loud: we've talked in the past about formally defining an application structure including an app.yaml. If we had this in a root folder, fn deploy could pickup the app name from a containing folder. This would make it easy to deploy or update an existing function without having to use --app and still avoid the automatic app creation problem? For that matter, why aren't we doing this now anyway?

#529 closes