Commit 8bc424d
Introduce optional "refspec" to Git PipelineResource, Refactor
The git pipeline resource does not allow for any use case beyond
a basic ref fetch, and is especially problematic for servers that
don't support direct SHA fetches, which means that the user cannot
check out specific commit hashes not pointed to by a named ref. The user
is also not able to check out other refs alongside (example, the tag
history). Current implementation also has a few corner cases, such as
checking out/reset --hard on the master branch after git-init, running git
reset --hard when checkout fails and so on. This leads to inconsistent
behavior (see #2282). The end result is that several users might end up
creating their own custom containers for fetching and checking out
what they need. This change makes the git resource much more extensible,
via an optional refspec parameter.
This change should be fully backward compatible w.r.t to revision parameter
EXCEPT the ability to fetch git commit short hashes (according
to the e2e tests)
- Adds ability to checkout older commit hashes on a particular ref
chain (when fetch via commit SHA is not enabled on the server)
- Adds ability to fetch several other refs (for example, refs/tags)
alongside the main revision
- Provides resolution for #2282 - If the user needs to checkout a branch,
they must specify the appropriate refspec and revision as the ref of the
branch. There was no way to do this in the original implementation
- Fixes bug reported in #2282 by ensuring the revision is always checked
out on a detached HEAD when specified w/o refspec
- Fixes bug - depth parameter is not passed to git submodule update, leading to
unnecessary data transfer
- Fixes bug --recurse-submodules is appended to the fetch command even when
the user specified submodule: "false", leading to unnecessary data transfer
- Fixes bug #1843 - git init ssh symlink is failing
Addresses #2282, #18431 parent c30d3aa commit 8bc424d
File tree
8 files changed
+344
-61
lines changed- cmd/git-init
- docs
- pkg
- apis
- pipeline/v1alpha1
- resource/v1alpha1/git
- git
- test
- v1alpha1
8 files changed
+344
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 56 | | |
62 | | - | |
| 57 | + | |
63 | 58 | | |
64 | | - | |
| 59 | + | |
65 | 60 | | |
66 | 61 | | |
67 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
317 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
318 | 350 | | |
319 | 351 | | |
320 | 352 | | |
321 | 353 | | |
322 | | - | |
323 | | - | |
| 354 | + | |
| 355 | + | |
324 | 356 | | |
325 | 357 | | |
326 | 358 | | |
327 | 359 | | |
328 | 360 | | |
| 361 | + | |
| 362 | + | |
329 | 363 | | |
330 | 364 | | |
331 | 365 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
44 | 43 | | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| 138 | + | |
| 139 | + | |
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
| |||
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
75 | 120 | | |
76 | 121 | | |
77 | 122 | | |
| |||
93 | 138 | | |
94 | 139 | | |
95 | 140 | | |
| 141 | + | |
96 | 142 | | |
97 | 143 | | |
98 | 144 | | |
| |||
115 | 161 | | |
116 | 162 | | |
117 | 163 | | |
| 164 | + | |
118 | 165 | | |
119 | 166 | | |
120 | 167 | | |
| |||
137 | 184 | | |
138 | 185 | | |
139 | 186 | | |
| 187 | + | |
140 | 188 | | |
141 | 189 | | |
142 | 190 | | |
| |||
159 | 207 | | |
160 | 208 | | |
161 | 209 | | |
| 210 | + | |
162 | 211 | | |
163 | 212 | | |
164 | 213 | | |
| |||
182 | 231 | | |
183 | 232 | | |
184 | 233 | | |
| 234 | + | |
185 | 235 | | |
186 | 236 | | |
187 | 237 | | |
| |||
205 | 255 | | |
206 | 256 | | |
207 | 257 | | |
| 258 | + | |
208 | 259 | | |
209 | 260 | | |
210 | 261 | | |
| |||
228 | 279 | | |
229 | 280 | | |
230 | 281 | | |
| 282 | + | |
231 | 283 | | |
232 | 284 | | |
233 | 285 | | |
| |||
251 | 303 | | |
252 | 304 | | |
253 | 305 | | |
| 306 | + | |
254 | 307 | | |
255 | 308 | | |
256 | 309 | | |
| |||
279 | 332 | | |
280 | 333 | | |
281 | 334 | | |
| 335 | + | |
| 336 | + | |
282 | 337 | | |
283 | 338 | | |
284 | 339 | | |
| |||
291 | 346 | | |
292 | 347 | | |
293 | 348 | | |
| 349 | + | |
| 350 | + | |
294 | 351 | | |
295 | 352 | | |
296 | 353 | | |
| |||
319 | 376 | | |
320 | 377 | | |
321 | 378 | | |
| 379 | + | |
322 | 380 | | |
323 | 381 | | |
324 | 382 | | |
| |||
354 | 412 | | |
355 | 413 | | |
356 | 414 | | |
| 415 | + | |
357 | 416 | | |
358 | 417 | | |
359 | 418 | | |
| |||
390 | 449 | | |
391 | 450 | | |
392 | 451 | | |
| 452 | + | |
393 | 453 | | |
394 | 454 | | |
395 | 455 | | |
| |||
427 | 487 | | |
428 | 488 | | |
429 | 489 | | |
| 490 | + | |
430 | 491 | | |
431 | 492 | | |
432 | 493 | | |
| |||
464 | 525 | | |
465 | 526 | | |
466 | 527 | | |
| 528 | + | |
467 | 529 | | |
468 | 530 | | |
469 | 531 | | |
| |||
499 | 561 | | |
500 | 562 | | |
501 | 563 | | |
| 564 | + | |
502 | 565 | | |
503 | 566 | | |
504 | 567 | | |
| |||
534 | 597 | | |
535 | 598 | | |
536 | 599 | | |
| 600 | + | |
537 | 601 | | |
538 | 602 | | |
539 | 603 | | |
| |||
562 | 626 | | |
563 | 627 | | |
564 | 628 | | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
565 | 668 | | |
566 | 669 | | |
567 | 670 | | |
| |||
0 commit comments