Skip to content

Commit

Permalink
fix: false positive errors PR comments in CFEngine repos
Browse files Browse the repository at this point in the history
Changelog: Title
Ticket: INF-3042
Signed-off-by: Alex Miliukov <oleksandr.miliukov@northern.tech>
  • Loading branch information
0lmi committed Sep 30, 2022
1 parent 3110a91 commit 6547863
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions main_pullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"regexp"
"strconv"
"strings"

Expand Down Expand Up @@ -64,10 +65,13 @@ func processGitHubPullRequest(
}
err = startPRPipeline(log, prBranchName, pr, conf, isOrgMember)
if err != nil {
log.Errorf("failed to start pipeline for PR: %s", err)
// post a comment only if GitLab is supposed to start a pipeline
gitlabReplyErrorMsg := "Missing CI config file"
if !strings.Contains(err.Error(), gitlabReplyErrorMsg) {
re := regexp.MustCompile("Missing CI config file|" +
"No stages / jobs for this pipeline")
if re.MatchString(err.Error()) {
log.Infof("start pipeline for PR '%d' is skipped", pr.Number)
} else {
log.Errorf("failed to start pipeline for PR: %s", err)
msg := "There was an error running your pipeline, " + msgDetails
postGitHubMessage(ctx, pr, log, msg)
}
Expand Down

0 comments on commit 6547863

Please sign in to comment.