Skip to content

Commit

Permalink
fix(STONEINTG-1125): fix gitlab CS change from pending to pending
Browse files Browse the repository at this point in the history
* fix for commitStatus status change from pending to pending

Signed-off-by: Hongwei Liu <[email protected]>
  • Loading branch information
hongweiliu17 committed Feb 7, 2025
1 parent 10f07be commit b7f4302
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions status/reporter_gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ func (r *GitLabReporter) setCommitStatus(report TestReport) error {
}
existingCommitStatus = r.GetExistingCommitStatus(allCommitStatuses, report.FullName)

// special case, we want to skip updating commit status if the status from running to running, from enque to pending
if existingCommitStatus != nil && (existingCommitStatus.Status == "enqueue" ||
existingCommitStatus.Status == string(gitlab.Running)) {
// special case, we want to skip updating commit status if the status from running to running, from pending to pending
if existingCommitStatus != nil && existingCommitStatus.Status == string(glState) {
r.logger.Info("Skipping commit status update",
"scenario.name", report.ScenarioName,
"commitStatus.ID", existingCommitStatus.ID,
Expand All @@ -201,7 +200,7 @@ func (r *GitLabReporter) setCommitStatus(report TestReport) error {

commitStatus, _, err := r.client.Commits.SetCommitStatus(r.sourceProjectID, r.sha, &opt)
if err != nil {
return fmt.Errorf("failed to set commit status: %w", err)
return fmt.Errorf("failed to set commit status from %s to %s : %w", existingCommitStatus.Status, string(glState), err)
}

r.logger.Info("Created gitlab commit status", "scenario.name", report.ScenarioName, "commitStatus.ID", commitStatus.ID, "TargetURL", opt.TargetURL)
Expand Down

0 comments on commit b7f4302

Please sign in to comment.