caprover / caprover-cli

Command Line Interface for https://github.com/caprover/caprover
72 stars 40 forks source link

Way to bypass message about uncommitted and gitignored files? #62

Closed dmwyatt closed 3 years ago

dmwyatt commented 3 years ago

Is there a way to bypass message about uncommitted and gitignored files? I don't see anything relevant in captover deploy --help. By "bypass" I'd just like to be able to automatically answer yes or no in the same way I can provide the (for example) app name via the -a command line switch.

githubsaturn commented 3 years ago

The deploy pipeline is fully customizable. By default CapRover uses git archive which ignores uncommitted and ignored files. But you can build your own tar file, for example:

tar -cvf ./deploy.tar  ./build/*
caprover deploy -t ./deploy.tar

See a real example and use case here: https://caprover.com/docs/recipe-deploy-create-react-app.html

dmwyatt commented 3 years ago

Yes, this is how I do it currently.

It still seems like there should be a flag to bypass this message. I believe all other prompts can be bypassed with command line flags, no?

On Thu, Aug 20, 2020, 10:52 PM Kasra Bigdeli notifications@github.com wrote:

The deploy pipeline is fully customizable. By default CapRover uses git archive which ignores uncommitted and ignored files. But you can build your own tar file, for example:

tar -cvf ./deploy.tar ./build/* caprover deploy -t ./deploy.tar

See a real example and use case here: https://caprover.com/docs/recipe-deploy-create-react-app.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/caprover/caprover-cli/issues/62#issuecomment-678022884, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABH4H4G7SGMCRJHXDNQJMLSBXVOXANCNFSM4QGUMSBA .

githubsaturn commented 3 years ago

all other prompts can be bypassed with command line flags, no?

If they are internal workings of CapRover, yes. In this case, the process if tar-ing the content is done using git archive which is an external tool.

dmwyatt commented 3 years ago

Right. What I'm trying to get at is this:

Is that a useful distinction?

Does caprover-cli not allow bypassing that prompt because a project goal says "do not bypass prompts for external tools" or does it not allow bypassing the prompt because no one has got around to coding it?

githubsaturn commented 3 years ago

It's by intention. CapRover design follows thin interface layer for more complicated tools.

For example, in this case, there are tens of different flags that are available with tar CLI. We certainly don't want to pollute CapRover API with all these flags. CapRover takes care of the most common case, if further customization is required, users can choose to do so.

For example, you're asking to include uncommitted files, another user might be asking to only include a specific directory. A third user asks for two directories. The next user asks for two directories, but exclude *.map files. Porting all these use cases to CapRover is just a costly, yet not useful, approach and increases maintenance cost of CapRover drastically. However, instead of porting all these use cases, if the most common use case does not satisfy someone's needs, CapRover allows them to customize their pipeline. In this case, it translates to manually creating tarball and ask CapRover to push the tarball to the server.

dmwyatt commented 3 years ago

Yeah, that's certainly a reasonable project philosophy and something I've done on many projects over the last couple of decades.

However, since my last comment, I investigated a bit. I just want to point out that (i think! I'm not super familiar with the codebase) in this instance, the prompt doesn't actually seem to have anything to do with the underlying tool. If I just run the underlying git archive command manually, there is no prompting.

In other words, in this instance, caprover-cli is actually adding UI. The prompt doesn't have anything to do with the underlying tool, it's just something the project does. It looks like it's just a general "are you sure you want to now deploy?" prompt with text somewhat wrongly indicating that it has something to do with git. A command line flag to bypass such confirmation prompts is super common across all sorts of cli tools.

I think probably in this instance the prompt is the wrong "default" case. That's how ignored and uncommitted files work in many deployment tools and git in general and the prompt feels redundant whilst adding more code to the project.

For example, you're asking to include uncommitted files, another user might be asking to only include a specific directory. A third user asks for two directories. The next user asks for two directories, but exclude *.map files. Porting all these use cases to CapRover is just a costly, yet not useful, approach and increases maintenance cost of CapRover drastically. However, instead of porting all these use cases, if the most common use case does not satisfy someone's needs, CapRover allows them to customize their pipeline. In this case, it translates to manually creating tarball and ask CapRover to push the tarball to the server.

To be clear, I'm not asking to include uncommited files. I'm asking for a flag to automatically accept what is already the default for the prompt.

All that being said, it's not a hill I care to die on, I already use GH Actions to do my deployment with custom deploy pipelines.