status
This commit is contained in:
@@ -36,6 +36,12 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//go:generate mockgen -source=obs_utils.go -destination=mock/obs_utils.go -typed
|
||||
|
||||
type ObsStatusFetcherWithState interface {
|
||||
BuildStatusWithState(project string, oldstate string, packages ...string) (*BuildResultList, error)
|
||||
}
|
||||
|
||||
type ObsClient struct {
|
||||
baseUrl *url.URL
|
||||
client *http.Client
|
||||
@@ -438,6 +444,8 @@ type BuildResult struct {
|
||||
Arch string `xml:"arch,attr"`
|
||||
Code string `xml:"code,attr"`
|
||||
Dirty bool `xml:"dirty,attr"`
|
||||
ScmSync string `xml:"scmsync"`
|
||||
ScmInfo string `xml:"scminfo"`
|
||||
Status []PackageBuildStatus `xml:"status"`
|
||||
Binaries []BinaryList `xml:"binarylist"`
|
||||
}
|
||||
@@ -455,6 +463,7 @@ type BinaryList struct {
|
||||
|
||||
type BuildResultList struct {
|
||||
XMLName xml.Name `xml:"resultlist"`
|
||||
State string `xml:"state,attr"`
|
||||
Result []BuildResult `xml:"result"`
|
||||
}
|
||||
|
||||
@@ -682,11 +691,18 @@ func (c *ObsClient) ProjectConfig(project string) (string, error) {
|
||||
}
|
||||
|
||||
func (c *ObsClient) BuildStatus(project string, packages ...string) (*BuildResultList, error) {
|
||||
return c.BuildStatusWithState(project, "", packages...)
|
||||
}
|
||||
|
||||
func (c *ObsClient) BuildStatusWithState(project string, oldstate string, packages ...string) (*BuildResultList, error) {
|
||||
u := c.baseUrl.JoinPath("build", project, "_result")
|
||||
query := u.Query()
|
||||
query.Add("view", "status")
|
||||
query.Add("view", "binarylist")
|
||||
query.Add("multibuild", "1")
|
||||
if len(oldstate) > 0 {
|
||||
query.Add("oldstate", oldstate)
|
||||
}
|
||||
if len(packages) > 0 {
|
||||
query.Add("lastbuild", "1")
|
||||
for _, pkg := range packages {
|
||||
|
||||
Reference in New Issue
Block a user