Skip to content

Commit a3a3a91

Browse files
committed
Fix GitLab MR not updated issue on forked repository
fixed GitLan issue where MR status was created initially but wasn't being updated on finish and was throwing error `404 not found` due to wrong SourceProjectID assignment in SetClient. https://issues.redhat.com/browse/SRVKP-6100 Signed-off-by: Zaki Shaikh <[email protected]>
1 parent d05d18b commit a3a3a91

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/provider/gitlab/gitlab.go

+8
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ func (v *Provider) SetClient(_ context.Context, run *params.Run, runevent *info.
138138
}
139139
v.Token = &runevent.Provider.Token
140140

141+
// in a scenario where source repo is a forked and created an MR on upstream
142+
// runevent.SourceProjectID wouldn't be 0 when SetClient is called from pac-watcher code
143+
// because in controller SourceProjectID is set in annotation of PR and runevent.SourceProjectID
144+
// is set before SetClient is called so its worth taking ID from runevent.SourceProjectID.
145+
if runevent.SourceProjectID > 0 {
146+
v.sourceProjectID = runevent.SourceProjectID
147+
}
148+
141149
// if we don't have sourceProjectID (ie: incoming-webhook) then try to set
142150
// it ASAP if we can.
143151
if v.sourceProjectID == 0 && runevent.Organization != "" && runevent.Repository != "" {

0 commit comments

Comments
 (0)