Skip to content

Instantly share code, notes, and snippets.

@r4rohan
Last active September 23, 2020 19:10
Show Gist options
  • Save r4rohan/2c7f2efdc71b8307dc586b4875d794b0 to your computer and use it in GitHub Desktop.
Save r4rohan/2c7f2efdc71b8307dc586b4875d794b0 to your computer and use it in GitHub Desktop.
import os
from google.cloud.devtools import cloudbuild_v1
client = cloudbuild_v1.CloudBuildClient()
project_id = os.environ.get('GCP_PROJECT')
build = {
"steps": [{
"name": "gcr.io/cloud-builders/gcloud",
"entrypoint":"bash",
"args": [
"-c",
"gcloud compute ssh rohandash1998@virtual-instance --zone=us-central1-a --command=\"touch /home/rohandash1998/test\"\n"
]
}]
}
def create_build(data, context):
response = client.create_build(
project_id="cloudorbit",
build=cloudbuild_v1.Build(build),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment