This commit is contained in:
Adam Majer 2024-08-16 14:04:43 +02:00
parent 65e182d032
commit f955457dd6
3 changed files with 13 additions and 7 deletions

View File

@ -7,6 +7,7 @@ The bots that drive Git Workflow for package management
* gitea-events-rabbitmq-publisher -- takes all events from a Gitea organization (webhook) and publishes it on a RabbitMQ instance * gitea-events-rabbitmq-publisher -- takes all events from a Gitea organization (webhook) and publishes it on a RabbitMQ instance
* maintainer-bot -- review bot to make sure maintainer signed off * maintainer-bot -- review bot to make sure maintainer signed off
* obs-staging-bot -- build bot for a PR * obs-staging-bot -- build bot for a PR
* obs-status-service -- report build status of an OBS project as an SVG
* pr-review -- keeps PR to _ObsPrj consistent with a PR to a package update * pr-review -- keeps PR to _ObsPrj consistent with a PR to a package update
* prjgit-updater -- update _ObsPrj based on direct pushes and repo creations/removals from organization * prjgit-updater -- update _ObsPrj based on direct pushes and repo creations/removals from organization

View File

@ -427,8 +427,11 @@ func (c *ObsClient) BuildStatus(project string, packages ...string) (*BuildResul
query.Add("view", "status") query.Add("view", "status")
query.Add("view", "binarylist") query.Add("view", "binarylist")
query.Add("multibuild", "1") query.Add("multibuild", "1")
for _, pkg := range packages { if len(packages) > 0 {
query.Add("package", pkg) query.Add("lastbuild", "1")
for _, pkg := range packages {
query.Add("package", pkg)
}
} }
u.RawQuery = query.Encode() u.RawQuery = query.Encode()
req, err := http.NewRequest("GET", u.String(), nil) req, err := http.NewRequest("GET", u.String(), nil)

View File

@ -260,7 +260,7 @@ func startBuild(h *common.RequestHandler, pr *models.PullRequest, obsClient *com
for _, pkg := range modifiedOrNew { for _, pkg := range modifiedOrNew {
urlPkg = append(urlPkg, "onlybuild="+url.QueryEscape(pkg)) urlPkg = append(urlPkg, "onlybuild="+url.QueryEscape(pkg))
} }
meta.ScmSync = pr.Head.Repo.CloneURL + "?" + strings.Join(urlPkg, "&") + "#" + pr.Head.Sha meta.ScmSync = pr.Head.Repo.CloneURL + "?" + strings.Join(urlPkg, "&") + "#" + pr.Head.Name
meta.Title = fmt.Sprintf("PR#%d to %s", pr.Index, pr.Base.Name) meta.Title = fmt.Sprintf("PR#%d to %s", pr.Index, pr.Base.Name)
meta.PublicFlags = common.Flags{Contents: "<disable/>"} meta.PublicFlags = common.Flags{Contents: "<disable/>"}
@ -410,6 +410,7 @@ func processPullNotification(h *common.RequestHandler, thread *models.Notificati
h.LogError("failed fetching build status for '%s': %v", obsProject, err) h.LogError("failed fetching build status for '%s': %v", obsProject, err)
return return
} }
refProjectResult, err := obsClient.BuildStatus(refPrj, prjResult.GetPackageList()...) refProjectResult, err := obsClient.BuildStatus(refPrj, prjResult.GetPackageList()...)
if err != nil { if err != nil {
h.LogError("failed fetching ref project status for '%s': %v", refPrj, err) h.LogError("failed fetching ref project status for '%s': %v", refPrj, err)
@ -428,6 +429,7 @@ func processPullNotification(h *common.RequestHandler, thread *models.Notificati
h.LogPlainError(err) h.LogPlainError(err)
} }
} }
h.Log("Build status waiting: %d", buildStatus)
// waiting for build results -- nothing to do // waiting for build results -- nothing to do
case common.ReviewStateApproved: case common.ReviewStateApproved:
@ -472,10 +474,10 @@ func main() {
// go ProcessingObsMessages("rabbit.opensuse.org", "opensuse", "opensuse", "") // go ProcessingObsMessages("rabbit.opensuse.org", "opensuse", "opensuse", "")
// for { for {
pollWorkNotifications() pollWorkNotifications()
// time.Sleep(1000) time.Sleep(10 * time.Minute)
// } }
stuck := make(chan int) stuck := make(chan int)
<-stuck <-stuck