- Download Go 1.14.x
- Run the tests:
go test ./cmd/cloudshell_open
- Build the command:
go build -o /tmp/cloudshell_open ./cmd/cloudshell_open
- To test the command:
-
Create a Service Account with the Cloud Run Admin, ServiceEnabler, Service Account User, and Storage Admin roles
-
Download the JSON key
-
Authenticate gcloud as the service account:
export GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_YOUR_SERVICE_ACCOUNT_KEY_FILE gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS export TRUSTED_ENVIRONMENT=true
-
Run the button:
(cd /tmp; ./cloudshell_open --repo_url=https://github.com/GoogleCloudPlatform/cloud-run-hello.git; rm -rf cloud-run-hello)
Other
cloudshell_open
flags:--git_branch
,--dir
,--context
Env vars you can set to avoid STDIN questions:
GOOGLE_CLOUD_PROJECT
GOOGLE_CLOUD_REGION
-
Download the key json file for the new service account
-
Build the Container
docker build -f Dockerfile -t cloud-run-button .
-
Set an env var pointing to the Service Account's JSON file:
export KEY_FILE=PATH_TO_YOUR_SERVICE_ACCOUNT_KEY_FILE
-
Run Cloud Run Button via Docker:
docker run -it -v /var/run/docker.sock:/var/run/docker.sock \ -v $KEY_FILE:/root/user.json \ -e GOOGLE_APPLICATION_CREDENTIALS=/root/user.json \ -e TRUSTED_ENVIRONMENT=true \ --entrypoint=/bin/sh cloud-run-button -c \ "gcloud auth activate-service-account --key-file=/root/user.json \ --quiet && gcloud auth configure-docker --quiet && \ /bin/cloudshell_open \ --repo_url=https://github.com/GoogleCloudPlatform/cloud-run-hello.git"
Contributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project. Head over to https://cla.developers.google.com/ to see your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.
This project follows Google's Open Source Community Guidelines.