From e939f3e1ac61d08ae0402047b51fbbe6a5d6d879 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Sat, 15 Jun 2024 14:47:11 -0700 Subject: [PATCH] Filter builds forced through UI from dashboard (#1766) --- dashboard/dashboard.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dashboard/dashboard.go b/dashboard/dashboard.go index 82e290839..614a06d6b 100644 --- a/dashboard/dashboard.go +++ b/dashboard/dashboard.go @@ -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"` } @@ -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 } @@ -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)