Commit 333fb64
committed
fix: populate DefaultBranch for incoming webhooks
Incoming webhooks bypass ParsePayload, which means the event's
DefaultBranch field is never set. When pipelinerun_provenance is
set to 'default_branch' on the Repository CR, GetTektonDir() uses
the empty DefaultBranch as the git tree revision, causing a 404
from the GitHub API.
Fix this by fetching the repository's default branch from the
GitHub API in GetCommitInfo() when the event type is 'incoming'
and DefaultBranch is empty.
Also fix a pre-existing test gap: the 'error' test case in
TestGithubGetCommitInfo was missing wantErr, and the test was not
checking for err == nil on the success path.
Fixes: #26461 parent cb4296f commit 333fb64
2 files changed
+58
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
466 | 481 | | |
467 | 482 | | |
468 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
932 | 932 | | |
933 | 933 | | |
934 | 934 | | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
935 | 960 | | |
936 | 961 | | |
937 | 962 | | |
| |||
940 | 965 | | |
941 | 966 | | |
942 | 967 | | |
| 968 | + | |
943 | 969 | | |
944 | 970 | | |
945 | 971 | | |
| |||
952 | 978 | | |
953 | 979 | | |
954 | 980 | | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
955 | 987 | | |
956 | 988 | | |
957 | 989 | | |
| |||
1022 | 1054 | | |
1023 | 1055 | | |
1024 | 1056 | | |
| 1057 | + | |
1025 | 1058 | | |
1026 | 1059 | | |
1027 | 1060 | | |
| |||
1040 | 1073 | | |
1041 | 1074 | | |
1042 | 1075 | | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1043 | 1086 | | |
1044 | 1087 | | |
1045 | 1088 | | |
| |||
0 commit comments