cloud-run-button
cloud-run-button copied to clipboard
Repo Exists: cd & git pull crash out of script
Problem
Looks like I had a locally created branch, but the pull expected to target this branch on an upstream. As a result, I got an error and got dropped from the run-button script.
cloudshell_open --repo_url "https://github.com/GoogleCloudPlatform/golang-samples" --dir "run/pubsub" --page "editor"
$ cloudshell_open --repo_url "https://github.com/GoogleCloudPlatform/golang-samples" --dir "run/pubsub" --page "editor"
You have already cloned this repo into directory golang-samples. Would you like to:
[1] cd into that directory
[2] cd into that directory and `git pull`
[3] git clone a new copy
Enter your choice [default 1]: 2
[...]
Your configuration specifies to merge with the ref 'refs/heads/go111-quickstart'
from the remote, but no such ref was fetched.
cd-ing into run/pubsub
-bash: cd: run/pubsub: No such file or directory
Expected
Have a way to restart, such as the script offering to fall back to cloning a new repo.
That is strange because your home directory should have been empty when this ran (because it uses a custom image). Are you sure you used the Cloud Run Button image in Cloud Shell when you did this?
I think there's a little glitch in OiCS experience that if you click the button twice in quick succession (e.g. maybe less than a minute apart) with the same parameters, it reuses the existing CS session. I've definitely encountered this as well but very rare.
Maybe we just do rm -rf, the only concern would be: people editing the code after deploying, and re-executing the command above to re-deploy (which wouldn't work anyway, because dir exists).
I've seen a few similar race conditions with OiCS. One of these was recently fixed but I'm not sure if it has been deployed yet. If we keep seeing this we should file a bug.