cloud-run-button icon indicating copy to clipboard operation
cloud-run-button copied to clipboard

deploy.cloud.run/user/repo

Open broady opened this issue 6 years ago • 5 comments

Redirect deploy.cloud.run/user/repo/subdir to deploy.cloud.run/?git_repo=https://github.com/user/repo&dir=subdir

Hello world URL becomes: https://deploy.cloud.run/GoogleCloudPlatform/cloud-run-hello

And then you can trivially replace "github.com" with "deploy.cloud.run" in the URL to deploy.

broady avatar Nov 15 '19 22:11 broady

Not a bad idea tbh. We opted in to ?git_repo since we have other options coming in as querystrings. We can support both formats.

ahmetb avatar Nov 15 '19 22:11 ahmetb

Though, trivially replacing the hostname (e.g. tree/{REF}/{SUBDIR} etc) can take bit more work, but the code is already there since we already do Referer detection.

ahmetb avatar Nov 15 '19 22:11 ahmetb

Could also parse the revision from the URL:

https://deploy.cloud.run/GoogleCloudPlatform/cloud-run-button/tree/master/cmd ---> deploy.cloud.run/?git_repo=https://github.com/GoogleCloudPlatform/cloud-run-button&revision=master&dir=master/cmd

edit: yep, crossed paths there. I think using the exact same referrer logic would work nicely.

broady avatar Nov 15 '19 22:11 broady

Though, this domain name replacement assumes GitHub, but we actually GitLab today as well. That creates a preferential treatment towards GitHub. Maybe it’s OK in this case.

It's a cool thing to demo to just change the domain name and deploy; but that's not how this button is primarily used today. We just give people a static snippet that's really short.

ahmetb avatar Nov 15 '19 22:11 ahmetb

What about setting up github.cloud.run for this? Could just redirect to deploy.cloud.run with the right git_repo.

jamesward avatar Nov 17 '19 17:11 jamesward