Skip to content

Commit

Permalink
Fix GitLab MR status not updated issue on forked repo
Browse files Browse the repository at this point in the history
fixed issue where MR status was being created initially on MR
but wasn't being updated due to wrong SourceProjectID assignment in
SetClient.

https://issues.redhat.com/browse/SRVKP-6100

Signed-off-by: Zaki Shaikh <[email protected]>
  • Loading branch information
zakisk committed Jan 22, 2025
1 parent 3b251fb commit 621386b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/provider/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ func (v *Provider) SetClient(_ context.Context, run *params.Run, runevent *info.
}
v.Token = &runevent.Provider.Token

// in a scenario where source repo is a forked and created an MR on upstream
// runevent.SourceProjectID wouldn't be 0 when SetClient is called from pac-watcher code
// because in controller SourceProjectID is set in annotation of PR and runevent.SourceProjectID
// is set before SetClient is called so its worth taking ID from runevent.SourceProjectID.
if runevent.SourceProjectID > 0 {
v.sourceProjectID = runevent.SourceProjectID
}

// if we don't have sourceProjectID (ie: incoming-webhook) then try to set
// it ASAP if we can.
if v.sourceProjectID == 0 && runevent.Organization != "" && runevent.Repository != "" {
Expand Down

0 comments on commit 621386b

Please sign in to comment.