- Download Go 1.14 (see
Dockerfile
for the exact version used) - 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 following roles:
- Cloud Run Admin (
roles/run.admin
), - Service Usage Admin (
roles/serviceusage.serviceUsageAdmin
), - Service Account User (
roles/iam.serviceAccountUser
), and - Storage Admin (
roles/storage.admin
).
- Cloud Run Admin (
-
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 export SKIP_CLONE_REPORTING=true
-
Run the button:
(cd /tmp; rm -rf cloud-run-hello; ./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
Optionally, you can set to
GOOGLE_CLOUD_PROJECT
GOOGLE_CLOUD_REGION
to avoid being prompted for these.
-
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 \ -e SKIP_CLONE_REPORTING=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"
Test getting a coupon from the instrumentless API:
go run ./cmd/instrumentless_test YOUR_EVENT $(gcloud auth print-access-token)
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.