Debian Codegraph @

launcher/image/test/test_hardened_cloudbuild.yaml

raw
1 substitutions:
2 # Expects hardened image (not debug) and should have startup-script service
3 # disabled. google-startup-scripts.service is only enabled with multi-user.target.
4 '_IMAGE_NAME': ''
5 '_IMAGE_PROJECT': ''
6 # Add user-data in the metadata to test if it is disabled.
7 '_METADATA_FILE': 'startup-script=data/echo_startupscript.sh,user-data=data/cloud-init-config.yaml'
8 '_CLEANUP': 'true'
9 '_VM_NAME_PREFIX': 'cs-hardened-test'
10 '_ZONE': 'us-west1-a'
11 '_CC': ''
12 '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/basic-test:latest'
13 steps:
14 - name: 'gcr.io/cloud-builders/gcloud'
15 id: CreateVM
16 entrypoint: 'bash'
17 env:
18 - 'BUILD_ID=$BUILD_ID'
19 args: ['create_vm.sh','-i', '${_IMAGE_NAME}',
20 '-p', '${_IMAGE_PROJECT}',
21 '-f', '${_METADATA_FILE}',
22 '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-container-log-redirect=true,tee-cmd=["newCmd"],tee-env-ALLOWED_OVERRIDE=overridden',
23 '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}',
24 '-z', '${_ZONE}',
25 '-c', '${_CC}',
26 ]
27 - name: 'gcr.io/cloud-builders/gcloud'
28 id: BasicWorkloadTest
29 entrypoint: 'bash'
30 args: ['scripts/test_launcher_workload.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}']
31 - name: 'gcr.io/cloud-builders/gcloud'
32 id: BasicWorkloadTestCloudLogging
33 entrypoint: 'bash'
34 env:
35 - 'PROJECT_ID=$PROJECT_ID'
36 args: ['scripts/test_launcher_workload_cloudlogging.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}']
37 - name: 'gcr.io/cloud-builders/gcloud'
38 id: ChangeMDSVariables
39 entrypoint: 'bash'
40 args: ['util/change_metadata_vars.sh',
41 '-n', '${_VM_NAME_PREFIX}-${BUILD_ID}',
42 '-z', '${_ZONE}',
43 '-m', 'tee-image-reference=gcr.io/cloudrun/hello:latest',
44 ]
45 - name: 'gcr.io/cloud-builders/gcloud'
46 id: ChangeMDSVariablesTest
47 entrypoint: 'bash'
48 args: ['scripts/test_mds_var_change.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}']
49 - name: 'gcr.io/cloud-builders/gcloud'
50 id: MultiWriterPDTest
51 entrypoint: 'bash'
52 env:
53 - 'BUILD_ID=$BUILD_ID'
54 args: ['scripts/test_multiwriterpd_disabled.sh']
55 - name: 'gcr.io/cloud-builders/gcloud'
56 id: StartupScriptDisabledTest
57 entrypoint: 'bash'
58 args: ['scripts/test_startupscript_disabled.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}']
59 - name: 'gcr.io/cloud-builders/gcloud'
60 id: CloudInitUserDataDisabledTest
61 entrypoint: 'bash'
62 args: ['scripts/test_cloud_init_userdata_disabled.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}']
63 - name: 'gcr.io/cloud-builders/gcloud'
64 id: CleanUp
65 entrypoint: 'bash'
66 env:
67 - 'CLEANUP=$_CLEANUP'
68 args: ['cleanup.sh', '${_VM_NAME_PREFIX}-${BUILD_ID}', '${_ZONE}']
69 # Must come after cleanup.
70 - name: 'gcr.io/cloud-builders/gcloud'
71 id: CheckFailure
72 entrypoint: 'bash'
73 env:
74 - 'BUILD_ID=$BUILD_ID'
75 args: ['check_failure.sh']
76
77 options:
78 pool:
79 name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc'