Repository navigation
Commit 3523157
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 e4fb9c5 commit 3523157
4 files changed
Lines changed: 217 additions & 64 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
275 | 291 | | |
276 | 292 | | |
277 | | - | |
278 | | - | |
| 293 | + | |
| 294 | + | |
279 | 295 | | |
280 | | - | |
| 296 | + | |
281 | 297 | | |
282 | | - | |
| 298 | + | |
283 | 299 | | |
284 | 300 | | |
285 | 301 | | |
| |||
322 | 338 | | |
323 | 339 | | |
324 | 340 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
329 | 344 | | |
330 | 345 | | |
331 | 346 | | |
| |||
356 | 371 | | |
357 | 372 | | |
358 | 373 | | |
359 | | - | |
360 | | - | |
| 374 | + | |
| 375 | + | |
361 | 376 | | |
362 | 377 | | |
363 | 378 | | |
364 | 379 | | |
365 | | - | |
| 380 | + | |
366 | 381 | | |
367 | 382 | | |
368 | 383 | | |
| |||
390 | 405 | | |
391 | 406 | | |
392 | 407 | | |
393 | | - | |
394 | | - | |
| 408 | + | |
395 | 409 | | |
396 | | - | |
| 410 | + | |
397 | 411 | | |
398 | | - | |
| 412 | + | |
399 | 413 | | |
400 | 414 | | |
401 | 415 | | |
| |||
| 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