Commit 31a5925
committed
fix(configure): address CodeRabbit findings on SDK migration
Resolve the 7 Major CodeRabbit findings on PR #1279 at root cause.
1. azure sanity: guard sub.State before dereferencing it. State is an
optional pointer; build azureSubscriptionInfo with the same nil-check
pattern used for the other optional fields, so an omitted state cannot
panic.
2. azure wizard: bind to the Azure CLI session explicitly. The wizard now
builds credentials via a shared newAzureWizardCredential() backed by
azidentity.NewAzureCLICredential, instead of DefaultAzureCredential whose
chain prioritizes environment / workload / managed identity and could pick
a different principal than the operator's "az login". The CI sanity test
keeps DefaultAzureCredential (it must resolve the CI service-principal env
vars). listAzureSubscriptions, resolveAzureTenantID and the SP provisioner
all use the CLI credential.
3. gcp: bound every SDK helper with a 60s timeout. listGCPProjects,
createGCPServiceAccount, grantGCPIAMRole and createGCPServiceAccountKey
inherited context.Background() and could hang; each now derives a
context.WithTimeout(ctx, gcpSDKCallTimeout).
4. gcp: preserve conditional IAM bindings. GetIamPolicy now requests
RequestedPolicyVersion 3 and the policy is written back at Version 3, so a
read-modify-write no longer silently drops condition bindings. Binding
mutation is extracted into addMemberToPolicyBinding to keep complexity in
check.
5. gcp: prevent orphaned service-account keys. createGCPServiceAccountKey
reserves the destination file with O_EXCL before minting the remote key,
and deletes the newly created remote key if decode/write fails, so a local
failure cannot leave an active unused credential behind.
6. gcp: return an empty key path when no key was written. gcpStepCreateKey
returns the key file path only after a successful write; on skip or an
unknown choice it returns "" so getGCPCredentialsFilePath prompts for an
existing credentials file instead of loading a missing one.
7. azure SP: roll back partial creation. createAzureServicePrincipal now
deletes the just-created application (cascading to its password credential
and derived service principal) if any later step -- add-password, SP
create, role resolve, or role assign -- fails. A new DeleteApplication
provisioner method backs this; if the compensating delete also fails the
error names the orphaned app so the operator can remove it by hand. Unit
tests assert rollback fires for each post-create failure, not on success,
and that a failed rollback is surfaced.1 parent 3e3df37 commit 31a5925
5 files changed
Lines changed: 221 additions & 65 deletions
File tree
- ci_cd_sanity_tests/pkg/sanity/azure
- cmd
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
261 | 277 | | |
262 | 278 | | |
263 | | - | |
264 | | - | |
| 279 | + | |
| 280 | + | |
265 | 281 | | |
266 | | - | |
| 282 | + | |
267 | 283 | | |
268 | | - | |
| 284 | + | |
269 | 285 | | |
270 | 286 | | |
271 | 287 | | |
| |||
308 | 324 | | |
309 | 325 | | |
310 | 326 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
315 | 330 | | |
316 | 331 | | |
317 | 332 | | |
| |||
342 | 357 | | |
343 | 358 | | |
344 | 359 | | |
345 | | - | |
346 | | - | |
| 360 | + | |
| 361 | + | |
347 | 362 | | |
348 | 363 | | |
349 | 364 | | |
350 | 365 | | |
351 | | - | |
| 366 | + | |
352 | 367 | | |
353 | 368 | | |
354 | 369 | | |
| |||
374 | 389 | | |
375 | 390 | | |
376 | 391 | | |
377 | | - | |
378 | | - | |
| 392 | + | |
379 | 393 | | |
380 | | - | |
| 394 | + | |
381 | 395 | | |
382 | | - | |
| 396 | + | |
383 | 397 | | |
384 | 398 | | |
385 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | | - | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
76 | 96 | | |
77 | 97 | | |
78 | | - | |
| 98 | + | |
79 | 99 | | |
80 | 100 | | |
81 | 101 | | |
82 | 102 | | |
83 | | - | |
| 103 | + | |
84 | 104 | | |
85 | 105 | | |
86 | 106 | | |
87 | 107 | | |
88 | | - | |
| 108 | + | |
89 | 109 | | |
90 | 110 | | |
91 | 111 | | |
92 | | - | |
| 112 | + | |
93 | 113 | | |
94 | 114 | | |
95 | 115 | | |
| |||
108 | 128 | | |
109 | 129 | | |
110 | 130 | | |
111 | | - | |
112 | | - | |
113 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
114 | 134 | | |
115 | 135 | | |
116 | 136 | | |
117 | | - | |
| 137 | + | |
118 | 138 | | |
119 | | - | |
| 139 | + | |
120 | 140 | | |
121 | 141 | | |
122 | 142 | | |
| |||
187 | 207 | | |
188 | 208 | | |
189 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
190 | 214 | | |
191 | 215 | | |
192 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
| |||
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
| 33 | + | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| |||
30 | 39 | | |
31 | 40 | | |
32 | 41 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
| |||
127 | 136 | | |
128 | 137 | | |
129 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
130 | 142 | | |
131 | 143 | | |
132 | 144 | | |
| |||
136 | 148 | | |
137 | 149 | | |
138 | 150 | | |
| 151 | + | |
139 | 152 | | |
140 | 153 | | |
141 | 154 | | |
142 | 155 | | |
143 | 156 | | |
144 | 157 | | |
145 | 158 | | |
| 159 | + | |
146 | 160 | | |
147 | 161 | | |
148 | 162 | | |
149 | 163 | | |
150 | 164 | | |
151 | 165 | | |
152 | 166 | | |
| 167 | + | |
153 | 168 | | |
154 | 169 | | |
155 | 170 | | |
156 | 171 | | |
157 | 172 | | |
158 | 173 | | |
159 | 174 | | |
| 175 | + | |
160 | 176 | | |
161 | 177 | | |
162 | 178 | | |
163 | 179 | | |
164 | 180 | | |
165 | 181 | | |
| 182 | + | |
166 | 183 | | |
167 | 184 | | |
168 | | - | |
169 | | - | |
170 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
171 | 189 | | |
172 | 190 | | |
173 | 191 | | |
| |||
192 | 210 | | |
193 | 211 | | |
194 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
195 | 219 | | |
196 | 220 | | |
197 | 221 | | |
198 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
199 | 245 | | |
200 | 246 | | |
201 | 247 | | |
| |||
0 commit comments