Skip to content

Commit 711c213

Browse files
committed
Also look at prow postsubmits.
1 parent 67ea3e0 commit 711c213

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

testgrid/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
output/

testgrid/jenkins_verify/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ go_library(
1919
srcs = ["jenkins_validate.go"],
2020
tags = ["automanaged"],
2121
deps = [
22+
"//prow/jobs:go_default_library",
2223
"//testgrid/config/pb:go_default_library",
2324
"//testgrid/config/yaml2proto:go_default_library",
2425
"//vendor:github.com/golang/protobuf/proto",

testgrid/jenkins_verify/jenkins_validate.go

+26-13
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,36 @@ import (
2424
"strings"
2525

2626
"github.com/golang/protobuf/proto"
27+
"k8s.io/test-infra/prow/jobs"
2728
config "k8s.io/test-infra/testgrid/config/pb"
2829
"k8s.io/test-infra/testgrid/config/yaml2proto"
2930
)
3031

31-
//
32-
// usage: go run jenkins_validate.go <path/to/job_collection> <path/to/testgrid_config>
33-
//
34-
3532
func main() {
3633
args := os.Args[1:]
3734

38-
if len(args) != 2 {
39-
fmt.Println("Missing args - usage: go run jenkins_validate.go <path/to/job_collection> <path/to/testgrid_config>")
35+
if len(args) != 3 {
36+
fmt.Println("Missing args - usage: go run jenkins_validate.go <path/to/job_collection> <path/to/prow> <path/to/testgrid_config>")
4037
os.Exit(1)
4138
}
4239

43-
jobpath := args[0]
44-
configpath := args[1]
40+
jobPath := args[0]
41+
prowPath := args[1]
42+
configPath := args[2]
4543

4644
jenkinsjobs := make(map[string]bool)
47-
files, err := filepath.Glob(jobpath + "/*")
45+
files, err := filepath.Glob(jobPath + "/*")
4846
if err != nil {
4947
fmt.Println("Failed to collect outputs.")
5048
os.Exit(1)
5149
}
5250

5351
for _, file := range files {
54-
file = strings.TrimPrefix(file, jobpath+"/")
52+
file = strings.TrimPrefix(file, jobPath+"/")
5553
jenkinsjobs[file] = false
5654
}
5755

58-
data, err := ioutil.ReadFile(configpath)
56+
data, err := ioutil.ReadFile(configPath)
5957
protobufData, err := yaml2proto.Yaml2Proto(data)
6058

6159
config := &config.Configuration{}
@@ -64,6 +62,12 @@ func main() {
6462
os.Exit(1)
6563
}
6664

65+
ja := jobs.JobAgent{}
66+
if err := ja.LoadOnce(prowPath+"/presubmit.yaml", prowPath+"/postsubmit.yaml"); err != nil {
67+
fmt.Printf("Could not load prow configs: %v\n", err)
68+
os.Exit(1)
69+
}
70+
6771
// For now anything outsite k8s-jenkins/logs are considered to be fine
6872
testgroups := make(map[string]bool)
6973
for _, testgroup := range config.TestGroups {
@@ -82,20 +86,29 @@ func main() {
8286
}
8387
}
8488

89+
// Also check prow jobs
90+
// TODO(spxtr): Not just k/k
91+
for _, job := range ja.AllPostsubmits("kubernetes/kubernetes") {
92+
if _, ok := testgroups[job.Name]; ok {
93+
testgroups[job.Name] = true
94+
jenkinsjobs[job.Name] = true
95+
}
96+
}
97+
8598
// Conclusion
8699
badjobs := []string{}
87100
for jenkinsjob, valid := range jenkinsjobs {
88101
if !valid {
89102
badjobs = append(badjobs, jenkinsjob)
90-
fmt.Printf("Jenkins Job %v does not have a matching testgrid testgroup\n", jenkinsjob)
103+
fmt.Printf("Job %v does not have a matching testgrid testgroup\n", jenkinsjob)
91104
}
92105
}
93106

94107
badconfigs := []string{}
95108
for testgroup, valid := range testgroups {
96109
if !valid {
97110
badconfigs = append(badconfigs, testgroup)
98-
fmt.Printf("Testgrid group %v does not have a matching jenkins job\n", testgroup)
111+
fmt.Printf("Testgrid group %v does not have a matching jenkins or prow job\n", testgroup)
99112
}
100113
}
101114

testgrid/jenkins_verify/verify.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ docker run --rm=true \
3030
-w "/go/src/k8s.io/test-infra" \
3131
-v "${GOPATH}/src/k8s.io/test-infra:/go/src/k8s.io/test-infra" \
3232
'golang:1.7.1' \
33-
go run testgrid/jenkins_verify/jenkins_validate.go testgrid/output testgrid/config/config.yaml
33+
go run testgrid/jenkins_verify/jenkins_validate.go testgrid/output prow testgrid/config/config.yaml

0 commit comments

Comments
 (0)