forked from google/go-tpm-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request google#269 from jkl73/autotest
Update cloudbuild workflow for launcher
- Loading branch information
Showing
6 changed files
with
99 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,41 @@ | ||
substitutions: | ||
'_BASE_IMAGE': 'cos-dev-105-17234-0-0' | ||
'_BASE_IMAGE_PROJECT': 'cos-cloud' | ||
'_BASE_IMAGE': '' | ||
'_OUTPUT_IMAGE_PREFIX': 'confidential-space' | ||
'_OUTPUT_IMAGE_SUFFIX': '' | ||
'_IMAGE_ENV': 'debug' | ||
'_BUCKET_NAME': '${PROJECT_ID}_cloudbuild' | ||
|
||
steps: | ||
- name: golang:1.18 | ||
entrypoint: /bin/bash | ||
args: | ||
- -c | ||
- | | ||
cd launcher/launcher | ||
go build -o ../image/launcher | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['start-image-build', | ||
'-build-context=launcher/image', | ||
'-gcs-bucket=${_BUCKET_NAME}', | ||
'-gcs-workdir=customizer-${BUILD_ID}', | ||
'-image-name=${_BASE_IMAGE}', | ||
'-image-project=${_BASE_IMAGE_PROJECT}'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['run-script', | ||
'-script=preload.sh', | ||
'-env=IMAGE_ENV=${_IMAGE_ENV}'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['seal-oem'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['run-script', | ||
'-script=fixup_oem.sh'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['finish-image-build', | ||
'-oem-size=500M', | ||
'-disk-size-gb=11', | ||
'-image-name=confidential-space-${_OUTPUT_IMAGE_SUFFIX}', | ||
'-image-family=confidential-space-dev', | ||
'-image-project=${PROJECT_ID}', | ||
'-licenses=projects/confidential-space-images/global/licenses/confidential-space', | ||
'-licenses=projects/confidential-space-images/global/licenses/ek-certificate-license', | ||
'-zone=us-central1-a', | ||
'-project=${PROJECT_ID}'] | ||
- name: 'gcr.io/cloud-builders/gcloud' | ||
env: | ||
- 'BASE_IMAGE=$_BASE_IMAGE' | ||
- 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX' | ||
- 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX' | ||
- 'PROJECT_ID=$PROJECT_ID' | ||
script: | | ||
#!/usr/bin/env bash | ||
timeout: '3000s' | ||
# if BASE_IMAGE is not specified, use the latest COS dev image | ||
base_image=${BASE_IMAGE} | ||
if [ -z ${base_image}] | ||
then | ||
echo "getting the latest COS image" | ||
base_image=$(gcloud compute images describe-from-family cos-dev --project cos-cloud | grep name | cut -d ' ' -f 2) | ||
fi | ||
options: | ||
logging: CLOUD_LOGGING_ONLY | ||
dynamic_substitutions: true | ||
debug_image_name=${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX} | ||
hardened_image_name=${OUTPUT_IMAGE_PREFIX}-hardened-${OUTPUT_IMAGE_SUFFIX} | ||
echo "building the debug image with the base image: ${base_image}" | ||
gcloud builds submit --config=launcher/image/cloudbuild.yaml \ | ||
--substitutions _BASE_IMAGE=${base_image},_OUTPUT_IMAGE_NAME=${debug_image_name},_IMAGE_ENV=debug & | ||
echo "building the hardened image with the base image: ${base_image}" | ||
gcloud builds submit --config=launcher/image/cloudbuild.yaml \ | ||
--substitutions _BASE_IMAGE=${base_image},_OUTPUT_IMAGE_NAME=${hardened_image_name},_IMAGE_ENV=hardened & | ||
echo "waiting for images to be built..." | ||
wait | ||
echo "running hardened image tests on ${hardened_image_name}" | ||
cd launcher/image/test | ||
gcloud builds submit --config=test_hardened_cloudbuild.yaml \ | ||
--substitutions _IMAGE_NAME=${hardened_image_name},_IMAGE_PROJECT=${PROJECT_ID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
cloud.google.com/go/iam v0.3.0 h1:exkAomrVUuzx9kWFI1wm3KI0uoDeUFPB4kKGzx6x+Gc= | ||
cloud.google.com/go/storage v1.22.1 h1:F6IlQJZrZM++apn9V5/VfS3gbTUYg98PS3EMQAzqtfg= | ||
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= | ||
github.com/googleapis/gax-go v2.0.2+incompatible h1:silFMLAnr330+NRuag/VjIGF7TLp/LBrV2CJKFLWEww= | ||
github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= | ||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
substitutions: | ||
'_BASE_IMAGE': '' | ||
'_OUTPUT_IMAGE_NAME': '' | ||
'_BASE_IMAGE_PROJECT': 'cos-cloud' | ||
'_IMAGE_ENV': '' | ||
'_BUCKET_NAME': '${PROJECT_ID}_cloudbuild' | ||
|
||
steps: | ||
- name: golang:1.18 | ||
entrypoint: /bin/bash | ||
args: | ||
- -c | ||
- | | ||
cd launcher/launcher | ||
go build -o ../image/launcher | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['start-image-build', | ||
'-build-context=launcher/image', | ||
'-gcs-bucket=${_BUCKET_NAME}', | ||
'-gcs-workdir=customizer-${BUILD_ID}', | ||
'-image-name=${_BASE_IMAGE}', | ||
'-image-project=${_BASE_IMAGE_PROJECT}'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['run-script', | ||
'-script=preload.sh', | ||
'-env=IMAGE_ENV=${_IMAGE_ENV}'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['seal-oem'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['run-script', | ||
'-script=fixup_oem.sh'] | ||
- name: 'gcr.io/cos-cloud/cos-customizer' | ||
args: ['finish-image-build', | ||
'-oem-size=500M', | ||
'-disk-size-gb=11', | ||
'-image-name=${_OUTPUT_IMAGE_NAME}', | ||
'-image-family=confidential-space-dev', | ||
'-image-project=${PROJECT_ID}', | ||
'-licenses=projects/confidential-space-images/global/licenses/confidential-space', | ||
'-licenses=projects/confidential-space-images/global/licenses/ek-certificate-license', | ||
'-zone=us-central1-a', | ||
'-project=${PROJECT_ID}'] | ||
|
||
timeout: '3000s' | ||
|
||
options: | ||
logging: CLOUD_LOGGING_ONLY | ||
dynamic_substitutions: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters