forked from google/go-tpm-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_cloudbuild.sh
executable file
·23 lines (19 loc) · 1010 Bytes
/
run_cloudbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# Run the script: ./run_cloudbuild.sh
set -euxo pipefail
# Append a timestamp, as there is a check in finish-image-build that checks if
# the image already exists.
IMAGE_SUFFIX="$USER-test-image-`date +%s`"
DIR=$(dirname -- "${BASH_SOURCE[0]}")
echo "Running Cloud Build on directory $DIR"
# If you get the error:
# googleapi: Error 403: Required 'compute.images.get' permission for 'foo', forbidden
#
# Ensure you grant Cloud Build access to Compute Images:
# https://pantheon.corp.google.com/compute/images?referrer=search&tab=exports&project=$PROJECT_ID
gcloud beta builds submit --config=${DIR}/cloudbuild.yaml \
--substitutions=_OUTPUT_IMAGE_SUFFIX="${IMAGE_SUFFIX}"
echo "Image creation successful."
echo "Create a VM using the debug image confidential-space-debug-${IMAGE_SUFFIX}"
echo "gcloud compute instances create confidential-space-test --image=confidential-space-debug-${IMAGE_SUFFIX} --metadata ..."
echo "Or use the hardened image confidential-space-hardened-${IMAGE_SUFFIX}"