1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Enable Jenkins module to work with Multi-configuration projects (#779)

Awesome, thanks!
This commit is contained in:
Nikolay Mateev 2019-12-13 18:36:11 +02:00 committed by Chris Cummer
parent 05b20ba4b7
commit ff2f07812d
3 changed files with 10 additions and 9 deletions

View File

@ -45,10 +45,13 @@ func (widget *Widget) Create(jenkinsURL string, username string, apiKey string)
return view, err return view, err
} }
jobs := []Job{} respJobs := make([]Job, 0, len(view.Jobs) + len(view.ActiveConfigurations))
respJobs = append(append(respJobs, view.Jobs...), view.ActiveConfigurations...)
jobs := make([]Job, 0)
var validID = regexp.MustCompile(widget.settings.jobNameRegex) var validID = regexp.MustCompile(widget.settings.jobNameRegex)
for _, job := range view.Jobs { for _, job := range respJobs {
if validID.MatchString(job.Name) { if validID.MatchString(job.Name) {
jobs = append(jobs, job) jobs = append(jobs, job)
} }

View File

@ -1,7 +1,6 @@
package jenkins package jenkins
type Job struct { type Job struct {
Class string `json:"_class"`
Name string `json:"name"` Name string `json:"name"`
Url string `json:"url"` Url string `json:"url"`
Color string `json:"color"` Color string `json:"color"`

View File

@ -1,10 +1,9 @@
package jenkins package jenkins
type View struct { type View struct {
Class string `json:"_class"` Description string `json:"description"`
Description string `json:"description"` Jobs []Job `json:"jobs"`
Jobs []Job `json:"jobs"` ActiveConfigurations []Job `json:"activeConfigurations"`
Name string `json:"name"` Name string `json:"name"`
Property []string `json:"property"` Url string `json:"url"`
Url string `json:"url"`
} }