| 1 |
substitutions: |
| 2 |
'_IMAGE_NAME': '' |
| 3 |
'_IMAGE_PROJECT': '' |
| 4 |
'_CLEANUP': 'true' |
| 5 |
'_VM_NAME_PREFIX': 'health-monitoring' |
| 6 |
'_ZONE': 'us-west1-a' |
| 7 |
'_WORKLOAD_IMAGE': 'us-west1-docker.pkg.dev/confidential-space-images-dev/cs-integ-test-images/allmonitoring:latest' |
| 8 |
|
| 9 |
steps: |
| 10 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 11 |
id: CreateVMAllMonitoringEnabled |
| 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-enable=all', |
| 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: CheckAllMonitoringEnabled |
| 24 |
entrypoint: 'bash' |
| 25 |
# Search a regex pattern that ensures all monitoring is enabled and measured into COS event logs. |
| 26 |
args: ['scripts/test_memory_monitoring.sh', '${_VM_NAME_PREFIX}-enable-${BUILD_ID}', '${_ZONE}', 'Health Monitoring is enabled by the VM operator.*All health monitoring metrics enabled'] |
| 27 |
waitFor: ['CreateVMAllMonitoringEnabled'] |
| 28 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 29 |
id: CleanUpVMAllMonitoringEnabled |
| 30 |
entrypoint: 'bash' |
| 31 |
env: |
| 32 |
- 'CLEANUP=$_CLEANUP' |
| 33 |
args: ['cleanup.sh', '${_VM_NAME_PREFIX}-enable-${BUILD_ID}', '${_ZONE}'] |
| 34 |
waitFor: ['CheckAllMonitoringEnabled'] |
| 35 |
|
| 36 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 37 |
id: CreateVMMemoryOnlyMonitoringEnabled |
| 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-enable=memoryonly', |
| 44 |
'-n', '${_VM_NAME_PREFIX}-mem-${BUILD_ID}', |
| 45 |
'-z', '${_ZONE}', |
| 46 |
] |
| 47 |
waitFor: ['-'] # The '-' indicates that this step begins immediately. |
| 48 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 49 |
id: CheckMemoryOnlyMonitoringEnabled |
| 50 |
entrypoint: 'bash' |
| 51 |
# Search a regex pattern that ensures all monitoring is enabled and measured into COS event logs. |
| 52 |
args: ['scripts/test_memory_monitoring.sh', '${_VM_NAME_PREFIX}-mem-${BUILD_ID}', '${_ZONE}', 'memory/bytes_used enabled'] |
| 53 |
waitFor: ['CreateVMMemoryOnlyMonitoringEnabled'] |
| 54 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 55 |
id: CleanUpVMMemoryOnlyMonitoringEnabled |
| 56 |
entrypoint: 'bash' |
| 57 |
env: |
| 58 |
- 'CLEANUP=$_CLEANUP' |
| 59 |
args: ['cleanup.sh', '${_VM_NAME_PREFIX}-mem-${BUILD_ID}', '${_ZONE}'] |
| 60 |
waitFor: ['CheckMemoryOnlyMonitoringEnabled'] |
| 61 |
|
| 62 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 63 |
id: CreateVMMonitoringDisabled |
| 64 |
entrypoint: 'bash' |
| 65 |
env: |
| 66 |
- 'BUILD_ID=$BUILD_ID' |
| 67 |
args: ['create_vm.sh','-i', '${_IMAGE_NAME}', |
| 68 |
'-p', '${_IMAGE_PROJECT}', |
| 69 |
'-m', 'tee-image-reference=${_WORKLOAD_IMAGE},tee-monitoring-enable=none', |
| 70 |
'-n', '${_VM_NAME_PREFIX}-disable-${BUILD_ID}', |
| 71 |
'-z', '${_ZONE}', |
| 72 |
] |
| 73 |
waitFor: ['-'] # The '-' indicates that this step begins immediately. |
| 74 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 75 |
id: CheckMonitoringDisabled |
| 76 |
entrypoint: 'bash' |
| 77 |
# Search a regex pattern that ensures monitoring is disabled and measured into COS event logs. |
| 78 |
args: ['scripts/test_memory_monitoring.sh', '${_VM_NAME_PREFIX}-disable-${BUILD_ID}', '${_ZONE}', 'Health Monitoring is disabled'] |
| 79 |
waitFor: ['CreateVMMonitoringDisabled'] |
| 80 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 81 |
id: CleanUpVMMonitoringDisabled |
| 82 |
entrypoint: 'bash' |
| 83 |
env: |
| 84 |
- 'CLEANUP=$_CLEANUP' |
| 85 |
args: ['cleanup.sh', '${_VM_NAME_PREFIX}-disable-${BUILD_ID}', '${_ZONE}'] |
| 86 |
waitFor: ['CheckMonitoringDisabled'] |
| 87 |
# Must come after cleanup. |
| 88 |
- name: 'gcr.io/cloud-builders/gcloud' |
| 89 |
id: CheckFailure |
| 90 |
entrypoint: 'bash' |
| 91 |
env: |
| 92 |
- 'BUILD_ID=$BUILD_ID' |
| 93 |
args: ['check_failure.sh'] |
| 94 |
|
| 95 |
options: |
| 96 |
pool: |
| 97 |
name: 'projects/confidential-space-images-dev/locations/us-west1/workerPools/cs-image-build-vpc' |