cloud-run-button
cloud-run-button copied to clipboard
deploy.cloud.run/user/repo
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.
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.
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.
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.
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.
What about setting up github.cloud.run for this? Could just redirect to deploy.cloud.run with the right git_repo.