structurizr / cli

A command line utility for Structurizr.
https://docs.structurizr.com/cli
Apache License 2.0
500 stars 77 forks source link

Avoid hardcoding the choice between `https://` and `git@` urls with new `--url-prefix [as-is|ssh|https]` #64

Closed pmorch closed 2 years ago

pmorch commented 2 years ago

Both github and gitlab offer the choice of downloading the same repo with one of:

(The URLs are totally similar for gitlab)

We'd like to avoid hardcoding that choice in jsonnetfile.json for all our users. Currently, we have to choose either the https:// or git@ url when using jb install <uri> and then that is hardcoded for everyone.

In our corporate setup, our gitlab repos are not public, so we need either an HTTPS token or a ssh private key to access the repos. Developers prefer using ssh keys (and hence git@ urls), while our ArgoCD GitOps setup uses HTTPS tokens. Because we need ArgoCD support, we're forced to using https:// URLs in jsonnetfile.json.

Suggestion: Introduce --url-prefix that can be as-is, ssh or https. defaulting to as-is. All it does is replace the beginnings of the URLs if different from as-is.

I considered just modifying the jsonnetfile.json before handing it to ArgoCD, but while that will work for the top-level dependencies, it won't work for transitive dependencies, because I don't have access to their jsonnetfile.json files beforehand. So currently we're forced to use https:// urls in our jsonnetfile.json files, which is less than ideal.

simonbrowndotje commented 2 years ago

I think you have the wrong repo?

pmorch commented 2 years ago

Sorry, yes!