|
|
|
@@ -222,7 +222,6 @@ func ProcessRepoBuildStatus(results, ref []*common.PackageBuildStatus) (status B
|
|
|
|
|
slices.SortFunc(results, PackageBuildStatusSorter)
|
|
|
|
|
slices.SortFunc(ref, PackageBuildStatusSorter)
|
|
|
|
|
|
|
|
|
|
j := 0
|
|
|
|
|
SomeSuccess = false
|
|
|
|
|
for i := 0; i < len(results); i++ {
|
|
|
|
|
res, ok := common.ObsBuildStatusDetails[results[i].Code]
|
|
|
|
@@ -237,10 +236,11 @@ func ProcessRepoBuildStatus(results, ref []*common.PackageBuildStatus) (status B
|
|
|
|
|
|
|
|
|
|
if !res.Success {
|
|
|
|
|
// not failed if reference project also failed for same package here
|
|
|
|
|
for ; j < len(results) && strings.Compare(results[i].Package, ref[j].Package) < 0; j++ {
|
|
|
|
|
j := 0
|
|
|
|
|
for ; j < len(ref) && strings.Compare(results[i].Package, ref[j].Package) != 0; j++ {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if j < len(results) && results[i].Package == ref[j].Package {
|
|
|
|
|
if j < len(ref) {
|
|
|
|
|
refRes, ok := common.ObsBuildStatusDetails[ref[j].Code]
|
|
|
|
|
if !ok {
|
|
|
|
|
common.LogInfo("unknown ref package result code:", ref[j].Code, "package:", ref[j].Package)
|
|
|
|
@@ -322,6 +322,9 @@ func GenerateObsPrjMeta(git common.Git, gitea common.Gitea, pr *models.PullReque
|
|
|
|
|
urlPkg = append(urlPkg, "onlybuild="+url.QueryEscape(pkg))
|
|
|
|
|
}
|
|
|
|
|
meta.ScmSync = pr.Head.Repo.CloneURL + "?" + strings.Join(urlPkg, "&") + "#" + pr.Head.Sha
|
|
|
|
|
if len(meta.ScmSync) >= 65535 {
|
|
|
|
|
return nil, errors.New("Reached max amount of package changes per request")
|
|
|
|
|
}
|
|
|
|
|
meta.Title = fmt.Sprintf("PR#%d to %s", pr.Index, pr.Base.Name)
|
|
|
|
|
// QE wants it published ... also we should not hardcode it here, since
|
|
|
|
|
// it is configurable via the :PullRequest project
|
|
|
|
@@ -837,6 +840,25 @@ func ProcessPullRequest(gitea common.Gitea, org, repo string, id int64) (bool, e
|
|
|
|
|
TargetURL: ObsWebHost + "/project/show/" + stagingProject,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
msg := "Unable to setup stage propject " + stagingConfig.ObsProject
|
|
|
|
|
status.Status = common.CommitStatus_Fail
|
|
|
|
|
common.LogError(msg)
|
|
|
|
|
if !IsDryRun {
|
|
|
|
|
_, err := gitea.SetCommitStatus(pr.Base.Repo.Owner.UserName, pr.Base.Repo.Name, pr.Head.Sha, status)
|
|
|
|
|
if err != nil {
|
|
|
|
|
common.LogError(err)
|
|
|
|
|
}
|
|
|
|
|
_, err = gitea.AddReviewComment(pr, common.ReviewStateRequestChanges, msg)
|
|
|
|
|
if err != nil {
|
|
|
|
|
common.LogError(err)
|
|
|
|
|
} else {
|
|
|
|
|
return true, nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
msg := "Changed source updated for build"
|
|
|
|
|
if change == RequestModificationProjectCreated {
|
|
|
|
|
msg = "Build is started in " + ObsWebHost + "/project/show/" +
|
|
|
|
@@ -845,7 +867,10 @@ func ProcessPullRequest(gitea common.Gitea, org, repo string, id int64) (bool, e
|
|
|
|
|
if len(stagingConfig.QA) > 0 {
|
|
|
|
|
msg = msg + "\nAdditional QA builds: \n"
|
|
|
|
|
}
|
|
|
|
|
gitea.SetCommitStatus(pr.Base.Repo.Owner.UserName, pr.Base.Repo.Name, pr.Head.Sha, status)
|
|
|
|
|
_, err := gitea.SetCommitStatus(pr.Base.Repo.Owner.UserName, pr.Base.Repo.Name, pr.Head.Sha, status)
|
|
|
|
|
if err != nil {
|
|
|
|
|
common.LogError(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, setup := range stagingConfig.QA {
|
|
|
|
|
CreateQASubProject(stagingConfig, git, gitea, pr,
|
|
|
|
@@ -870,32 +895,36 @@ func ProcessPullRequest(gitea common.Gitea, org, repo string, id int64) (bool, e
|
|
|
|
|
}
|
|
|
|
|
buildStatus := ProcessBuildStatus(stagingResult, baseResult)
|
|
|
|
|
|
|
|
|
|
done := false
|
|
|
|
|
switch buildStatus {
|
|
|
|
|
case BuildStatusSummarySuccess:
|
|
|
|
|
status.Status = common.CommitStatus_Success
|
|
|
|
|
done = true
|
|
|
|
|
if !IsDryRun {
|
|
|
|
|
_, err := gitea.AddReviewComment(pr, common.ReviewStateApproved, "Build successful")
|
|
|
|
|
if err != nil {
|
|
|
|
|
common.LogError(err)
|
|
|
|
|
} else {
|
|
|
|
|
return true, nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
case BuildStatusSummaryFailed:
|
|
|
|
|
status.Status = common.CommitStatus_Fail
|
|
|
|
|
done = true
|
|
|
|
|
if !IsDryRun {
|
|
|
|
|
_, err := gitea.AddReviewComment(pr, common.ReviewStateRequestChanges, "Build failed")
|
|
|
|
|
if err != nil {
|
|
|
|
|
common.LogError(err)
|
|
|
|
|
} else {
|
|
|
|
|
return true, nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
common.LogInfo("Build status:", buildStatus)
|
|
|
|
|
gitea.SetCommitStatus(pr.Base.Repo.Owner.UserName, pr.Base.Repo.Name, pr.Head.Sha, status)
|
|
|
|
|
|
|
|
|
|
// waiting for build results -- nothing to do
|
|
|
|
|
if !IsDryRun {
|
|
|
|
|
_, err = gitea.SetCommitStatus(pr.Base.Repo.Owner.UserName, pr.Base.Repo.Name, pr.Head.Sha, status)
|
|
|
|
|
if err != nil {
|
|
|
|
|
common.LogError(err)
|
|
|
|
|
return false, err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return done, nil
|
|
|
|
|
|
|
|
|
|
} else if err == NonActionableReviewError || err == NoReviewsFoundError {
|
|
|
|
|
return true, nil
|
|
|
|
|