Drone CLI's add should have a "force" flag

For example, say I want to have a script that will ensure that all of my repositories have a secret set up in a certain way. I can’t just use drone secret add, as that will fail if the secret already exists.

I can work around it by first deleting the secret, or falling back to drone secret update, but that’s unnecessarily complicated. I imagine that the add subcommand should have a flag like --force or --replace, which would get the job done.


Bump. I’d usually have created an issue, but the issue tracker clearly says not to do so. I’m a bit worried that the thread will be buried in the forum.

Maybe add a drone secret save command that combines the functionality of create and update. The command could fetch the secret form drone, if exists update, and if does not exist create. This is not something I can prioritize at the moment, however, I would be happy to review and accept a pull request if we have a volunteer to implement.

Should we move this to a GitHub issue, to ensure it’s not forgotten?

I’d suggest that all “create” or “add” commands should have a flag to force creation, i.e. replacing an existing object if it already exists. That way, the same feature would work for registries, secrets, repos, etc.