Debian Codegraph @

launcher/image/test/test_memory_monitoring.yaml

raw
1 substitutions:
2 '_IMAGE_NAME': ''
3 '_IMAGE_PROJECT': ''
4 '_CLEANUP': 'true'
5 '_VM_NAME_PREFIX': 'memory-monitoring'
6 '_ZONE': 'us-west1-a'
7 '_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/memorymonitoring:latest'
8
9 steps:
10 - name: 'gcr.io/cloud-builders/gcloud'
11 id: CreateVMMemoryMemonitorEnabled
12 entrypoint: 'bash'
13 env:
14 - 'BUILD_ID=$BUILD_ID'
15 args: ['create_vm.sh','-i', '${_IMAGE_NAME}',
16 '-p', '${_IMAGE_PROJECT}',
17 '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-monitoring-memory-enable=true',
18 '-n', '${_VM_NAME_PREFIX}-enable-${BUILD_ID}',
19 '-z', '${_ZONE}',
20 ]
21 waitFor: ['-'] # The '-' indicates that this step begins immediately.
22 - name: 'gcr.io/cloud-builders/gcloud'
23 id: CheckMemoryMonitoringEnabled
24 entrypoint: 'bash'
25 # Search a regex pattern that ensures memory monitoring is enabled and measured into COS event logs.
26 args: ['scripts/test_memory_monitoring.sh', '${_VM_NAME_PREFIX}-enable-${BUILD_ID}', '${_ZONE}', 'node-problem-detector.service successfully started.*Successfully measured memory monitoring event']
27 waitFor: ['CreateVMMemoryMemonitorEnabled']
28 - name: 'gcr.io/cloud-builders/gcloud'
29 id: CleanUpVMMemoryMonitorEnabled
30 entrypoint: 'bash'
31 env:
32 - 'CLEANUP=$_CLEANUP'
33 args: ['cleanup.sh', '${_VM_NAME_PREFIX}-enable-${BUILD_ID}', '${_ZONE}']
34 waitFor: ['CheckMemoryMonitoringEnabled']
35
36 - name: 'gcr.io/cloud-builders/gcloud'
37 id: CreateVMMemoryMemonitorDisabled
38 entrypoint: 'bash'
39 env:
40 - 'BUILD_ID=$BUILD_ID'
41 args: ['create_vm.sh','-i', '${_IMAGE_NAME}',
42 '-p', '${_IMAGE_PROJECT}',
43 '-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-monitoring-memory-enable=false',
44 '-n', '${_VM_NAME_PREFIX}-disable-${BUILD_ID}',
45 '-z', '${_ZONE}',
46 ]
47 waitFor: ['-'] # The '-' indicates that this step begins immediately.
48 - name: 'gcr.io/cloud-builders/gcloud'
49 id: CheckMemoryMonitoringDisabled
50 entrypoint: 'bash'
51 # Search a regex pattern that ensures memory monitoring is disabled and measured into COS event logs.
52 args: ['scripts/test_memory_monitoring.sh', '${_VM_NAME_PREFIX}-disable-${BUILD_ID}', '${_ZONE}', 'Successfully measured memory monitoring event.*MemoryMonitoring is disabled by the VM operator']
53 waitFor: ['CreateVMMemoryMemonitorDisabled']
54 - name: 'gcr.io/cloud-builders/gcloud'
55 id: CleanUpVMMemoryMonitorDisabled
56 entrypoint: 'bash'
57 env:
58 - 'CLEANUP=$_CLEANUP'
59 args: ['cleanup.sh', '${_VM_NAME_PREFIX}-disable-${BUILD_ID}', '${_ZONE}']
60 waitFor: ['CheckMemoryMonitoringDisabled']
61 # Must come after cleanup.
62 - name: 'gcr.io/cloud-builders/gcloud'
63 id: CheckFailure
64 entrypoint: 'bash'
65 env:
66 - 'BUILD_ID=$BUILD_ID'
67 args: ['check_failure.sh']
68
69 options:
70 pool:
71 name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc'