Debian Codegraph @

run_cloudbuild.sh

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