Skip to content

Commit

Permalink
Filter builds forced through UI from dashboard (#1766)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmayer authored Jun 15, 2024
1 parent 688969d commit e939f3e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ type Builds struct {
CompleteAt int `json:"complete_at"`
Number int `json:"number"`
Results int `json:"results"`
Properties struct {
Reason []string `json:"reason"`
} `json:"properties"`
} `json:"builds"`
}

Expand All @@ -108,7 +111,7 @@ func GetStatusFromJson(builderUrl string) (statusLine, error) {
client := http.Client{
Timeout: time.Duration(120 * time.Second),
}
resp, err = client.Get(builderUrl + "/builds?limit=40&order=-number")
resp, err = client.Get(builderUrl + "/builds?limit=40&order=-number&property=reason")
if err == nil {
break
}
Expand Down Expand Up @@ -141,6 +144,17 @@ func GetStatusFromJson(builderUrl string) (statusLine, error) {
if !b.Complete {
continue
}
foundForceBuild := false
for _, v := range b.Properties.Reason {
if v == "Force Build Form" {
foundForceBuild = true
break
}
}
if foundForceBuild {
continue
}

builder, _ := url.Parse(fmt.Sprintf("../../../#/builders/%d", b.Builderid))
sl.builderUrl = baseUrl.ResolveReference(builder).String()
time := time.Unix(int64(b.CompleteAt), 0)
Expand Down

0 comments on commit e939f3e

Please sign in to comment.