Commit 819ce1b
authored
chore(storage): optimize zonal system tests CloudBuild and make concurrency-safe (googleapis#17171)
This PR optimizes the zonal system tests CloudBuild configuration
(`zb-system-tests-cloudbuild.yaml`) and its execution script
(`run_zonal_tests.sh`) to make the test execution robust, fast, and
concurrency-safe.
### Proposed Changes
- **Direct Workspace Packaging & SCP Transfer**: Replaces git-cloning
and fetching inside the GCE VM with packaging the local
`/workspace/packages/google-cloud-storage` directory on the Cloud Build
runner and copying the tarball via `scp` to the VM. This eliminates Git
and repo-cloning requirements on the GCE VM, improving speed and
reliability.
- **OS Login TTL Keys for Concurrency Safety**: Replaces the aggressive,
concurrency-breaking `cleanup-old-keys` step (which deleted all OS Login
SSH keys for the project and interfered with concurrent builds) by
registering the generated SSH key with OS Login using a 1-hour
Time-To-Live (TTL). GCP automatically expires old keys, preventing key
accumulation without affecting other concurrent builds.
- **Robust Variable Handling & Safety**:
- Safely quotes all instances of `"${_VM_NAME}"` in `gcloud compute`
ssh, scp, and delete commands.
- Adds default empty substitutions (`_PR_NUMBER`,
`_CROSS_REGION_BUCKET`, `_ZONAL_BUCKET`, `_ZONAL_VM_SERVICE_ACCOUNT`) to
support manual builds.
- Exports `CROSS_REGION_BUCKET` with a fallback default in the test
runner script.
- Enables `dynamicSubstitutions: true` under CloudBuild options to
support active evaluation of build variables.
### Verification Results
Both verification scenarios were executed and confirmed:
1. **Full Zonal Tests Run**: CloudBuild successfully created the GCE VM,
SCP'd the packaged code, executed the zonal system tests inside the VM,
and cleanly deleted the VM upon completion.
2. **SSH Key Lifecycle**: Verified the generated SSH key is registered
with a 1-hour TTL and successfully cleaned up, avoiding OS Login profile
accumulation.
fixes - **b/514186407**
TAG=agy
CONV=16d817fd-2422-432e-816b-bf159b381df21 parent 3b3598b commit 819ce1b
2 files changed
Lines changed: 24 additions & 48 deletions
Lines changed: 5 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
| |||
24 | 17 | | |
25 | 18 | | |
26 | 19 | | |
| 20 | + | |
27 | 21 | | |
28 | 22 | | |
29 | 23 | | |
| |||
Lines changed: 19 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
| 32 | + | |
26 | 33 | | |
27 | | - | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 39 | + | |
| 40 | + | |
60 | 41 | | |
61 | | - | |
| 42 | + | |
62 | 43 | | |
63 | 44 | | |
64 | 45 | | |
| |||
79 | 60 | | |
80 | 61 | | |
81 | 62 | | |
82 | | - | |
| 63 | + | |
83 | 64 | | |
84 | 65 | | |
85 | 66 | | |
| |||
91 | 72 | | |
92 | 73 | | |
93 | 74 | | |
94 | | - | |
| 75 | + | |
95 | 76 | | |
96 | 77 | | |
97 | 78 | | |
98 | 79 | | |
99 | 80 | | |
100 | | - | |
101 | | - | |
| 81 | + | |
| 82 | + | |
102 | 83 | | |
103 | 84 | | |
104 | 85 | | |
105 | 86 | | |
106 | | - | |
| 87 | + | |
107 | 88 | | |
108 | 89 | | |
109 | 90 | | |
| |||
115 | 96 | | |
116 | 97 | | |
117 | 98 | | |
118 | | - | |
| 99 | + | |
119 | 100 | | |
120 | 101 | | |
121 | 102 | | |
| |||
133 | 114 | | |
134 | 115 | | |
135 | 116 | | |
| 117 | + | |
136 | 118 | | |
137 | 119 | | |
0 commit comments