GoogleCloudPlatform / cloud-run-button

Let anyone deploy your GitHub repos to Google Cloud Run with a single click
https://cloud.run
Apache License 2.0
527 stars 92 forks source link

redirector: Handing of slashes in branch names seems incorrect #134

Open ahmetb opened 4 years ago

ahmetb commented 4 years ago

I have just tried deploying from URL:

https://github.com/ahmetb/golang-samples/tree/run/grpc-server-streaming/run/grpc-server-streaming

where the branch name was run/grpc-server-streaming.

funny enough, there's no way for redirector to tell whether it is

branch = run
dir = grpc-server-streaming/run/grpc-server-streaming

or

branch = run/grpc-server-streaming
dir =run/grpc-server-streaming

So it naturally did some regex matching and wrongly assumed branch=run, despite specifying ?dir= correctly.

cloudshell_open --repo_url "https://github.com/ahmetb/golang-samples.git" --dir "run/grpc-server-streaming" --page "editor" --git_branch "run"
[ ✓ ] Cloned git repository https://github.com/ahmetb/golang-samples.git.
Error: failed to checkout revision "run": git checkout failed: exit status 1, output:
error: pathspec 'run' did not match any file(s) known to git.

I don't think we can reliably disambiguate the URL in this case. (GitHub probably does, because it has the data.) Just wanted to note.

jamesward commented 4 years ago

Oh bummer. We could put a note in the docs indicating that branches containing a / aren't supported by the redirector.

ahmetb commented 4 years ago

I am thinking it's not worth making docs longer, especially ?revision and ?dir overrides are documented.