Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.

Commit fe0124f

Browse files
committed
add non-blocking jenkins jobs
1 parent b5db943 commit fe0124f

File tree

4 files changed

+60
-10
lines changed

4 files changed

+60
-10
lines changed

hack/verify-flags/known-flags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ max-pr-number
4949
max-sync-failures
5050
min-pr-number
5151
network-config
52+
nonblocking-jenkins-jobs
5253
nginx-configmap
5354
number-of-old-test-results
5455
on-change

mungegithub/mungers/e2e/e2e.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ type BuildInfo struct {
4949
// RealE2ETester is the object which will get status from a google bucket
5050
// information about recent jobs
5151
type RealE2ETester struct {
52-
BlockingJobNames []string
53-
WeakStableJobNames []string
52+
BlockingJobNames []string
53+
NonBlockingJobNames []string
54+
WeakStableJobNames []string
5455

5556
sync.Mutex
5657
BuildStatus map[string]BuildInfo // protect by mutex
@@ -217,6 +218,23 @@ func (e *RealE2ETester) GCSBasedStable() (allStable, ignorableFlakes bool) {
217218
e.setBuildStatus(job, "Not Stable", strconv.Itoa(lastBuildNumber))
218219
}
219220

221+
// Also get status for non-blocking jobs
222+
for _, job := range e.NonBlockingJobNames {
223+
lastBuildNumber, err := e.GoogleGCSBucketUtils.GetLastestBuildNumberFromJenkinsGoogleBucket(job)
224+
glog.V(4).Infof("Checking status of %v, %v", job, lastBuildNumber)
225+
if err != nil {
226+
glog.Errorf("Error while getting data for %v: %v", job, err)
227+
e.setBuildStatus(job, "[nonblocking] Not Stable", strconv.Itoa(lastBuildNumber))
228+
continue
229+
}
230+
231+
if thisResult, err := e.GetBuildResult(job, lastBuildNumber); err != nil || thisResult.Status != cache.ResultStable {
232+
e.setBuildStatus(job, "[nonblocking] Not Stable", strconv.Itoa(lastBuildNumber))
233+
} else {
234+
e.setBuildStatus(job, "[nonblocking] Stable", strconv.Itoa(lastBuildNumber))
235+
}
236+
}
237+
220238
return allStable, ignorableFlakes
221239
}
222240

mungegithub/mungers/e2e/e2e_test.go

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,19 @@ func marshalOrDie(obj interface{}, t *testing.T) []byte {
4747
}
4848

4949
func genMockGCSListResponse(files ...string) []byte {
50-
resptemplate := "{\"items\":[%s]}"
51-
itemTempalte := "{\"name\":\"%s\"}"
50+
respTemplate := "{\"items\":[%s]}"
51+
itemTemplate := "{\"name\":\"%s\"}"
5252
items := []string{}
5353
for _, file := range files {
54-
items = append(items, fmt.Sprintf(itemTempalte, file))
54+
items = append(items, fmt.Sprintf(itemTemplate, file))
5555
}
56-
return []byte(fmt.Sprintf(resptemplate, strings.Join(items, ",")))
56+
return []byte(fmt.Sprintf(respTemplate, strings.Join(items, ",")))
5757
}
5858

5959
func TestCheckGCSBuilds(t *testing.T) {
6060
latestBuildNumberFoo := 42
6161
latestBuildNumberBar := 44
62+
latestBuildNumberBaz := 99
6263
tests := []struct {
6364
paths map[string][]byte
6465
expectStable bool
@@ -77,12 +78,18 @@ func TestCheckGCSBuilds(t *testing.T) {
7778
Result: "SUCCESS",
7879
Timestamp: 1234,
7980
}, t),
81+
"/baz/latest-build.txt": []byte(strconv.Itoa(latestBuildNumberBaz)),
82+
fmt.Sprintf("/baz/%v/finished.json", latestBuildNumberBaz): marshalOrDie(utils.FinishedFile{
83+
Result: "UNSTABLE",
84+
Timestamp: 1234,
85+
}, t),
8086
"/": genMockGCSListResponse(),
8187
},
8288
expectStable: true,
8389
expectedStatus: map[string]BuildInfo{
8490
"foo": {Status: "Stable", ID: "42"},
8591
"bar": {Status: "Stable", ID: "44"},
92+
"baz": {Status: "[nonblocking] Not Stable", ID: "99"},
8693
},
8794
},
8895
{
@@ -97,12 +104,18 @@ func TestCheckGCSBuilds(t *testing.T) {
97104
Result: "UNSTABLE",
98105
Timestamp: 1234,
99106
}, t),
107+
"/baz/latest-build.txt": []byte(strconv.Itoa(latestBuildNumberBaz)),
108+
fmt.Sprintf("/baz/%v/finished.json", latestBuildNumberBaz): marshalOrDie(utils.FinishedFile{
109+
Result: "SUCCESS",
110+
Timestamp: 1234,
111+
}, t),
100112
"/": genMockGCSListResponse(),
101113
},
102114
expectStable: false,
103115
expectedStatus: map[string]BuildInfo{
104116
"foo": {Status: "Stable", ID: "42"},
105117
"bar": {Status: "Not Stable", ID: "44"},
118+
"baz": {Status: "[nonblocking] Stable", ID: "99"},
106119
},
107120
},
108121
{
@@ -140,6 +153,7 @@ func TestCheckGCSBuilds(t *testing.T) {
140153
expectedStatus: map[string]BuildInfo{
141154
"foo": {Status: "Stable", ID: "42"},
142155
"bar": {Status: "Ignorable flake", ID: "44"},
156+
"baz": {Status: "[nonblocking] Not Stable", ID: "-1"},
143157
},
144158
},
145159
{
@@ -177,6 +191,7 @@ func TestCheckGCSBuilds(t *testing.T) {
177191
expectedStatus: map[string]BuildInfo{
178192
"foo": {Status: "Stable", ID: "42"},
179193
"bar": {Status: "Ignorable flake", ID: "44"},
194+
"baz": {Status: "[nonblocking] Not Stable", ID: "-1"},
180195
},
181196
},
182197
{
@@ -214,6 +229,7 @@ func TestCheckGCSBuilds(t *testing.T) {
214229
expectedStatus: map[string]BuildInfo{
215230
"foo": {Status: "Stable", ID: "42"},
216231
"bar": {Status: "Not Stable", ID: "44"},
232+
"baz": {Status: "[nonblocking] Not Stable", ID: "-1"},
217233
},
218234
},
219235

@@ -235,6 +251,7 @@ func TestCheckGCSBuilds(t *testing.T) {
235251
expectedStatus: map[string]BuildInfo{
236252
"foo": {Status: "Stable", ID: "42"},
237253
"bar": {Status: "Not Stable", ID: "44"},
254+
"baz": {Status: "[nonblocking] Not Stable", ID: "-1"},
238255
},
239256
},
240257
{
@@ -255,6 +272,7 @@ func TestCheckGCSBuilds(t *testing.T) {
255272
expectedStatus: map[string]BuildInfo{
256273
"foo": {Status: "Not Stable", ID: "42"},
257274
"bar": {Status: "Not Stable", ID: "44"},
275+
"baz": {Status: "[nonblocking] Not Stable", ID: "-1"},
258276
},
259277
},
260278
{
@@ -275,6 +293,7 @@ func TestCheckGCSBuilds(t *testing.T) {
275293
expectedStatus: map[string]BuildInfo{
276294
"foo": {Status: "Not Stable", ID: "42"},
277295
"bar": {Status: "Stable", ID: "44"},
296+
"baz": {Status: "[nonblocking] Not Stable", ID: "-1"},
278297
},
279298
},
280299
}
@@ -296,6 +315,9 @@ func TestCheckGCSBuilds(t *testing.T) {
296315
"foo",
297316
"bar",
298317
},
318+
NonBlockingJobNames: []string{
319+
"baz",
320+
},
299321
BuildStatus: map[string]BuildInfo{},
300322
GoogleGCSBucketUtils: utils.NewTestUtils(server.URL),
301323
}

mungegithub/mungers/submit-queue.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ type submitQueueInterruptedObject struct {
135135
// PR must have passed all github CI checks
136136
// The google internal jenkins instance must be passing the BlockingJobNames e2e tests
137137
type SubmitQueue struct {
138-
githubConfig *github.Config
139-
BlockingJobNames []string
140-
WeakStableJobNames []string
138+
githubConfig *github.Config
139+
BlockingJobNames []string
140+
NonBlockingJobNames []string
141+
WeakStableJobNames []string
141142

142143
// If FakeE2E is true, don't try to connect to JenkinsHost, all jobs are passing.
143144
FakeE2E bool
@@ -303,6 +304,7 @@ func (sq *SubmitQueue) internalInitialize(config *github.Config, features *featu
303304

304305
// Clean up all of our flags which we wish --flag="" to mean []string{}
305306
sq.BlockingJobNames = cleanStringSlice(sq.BlockingJobNames)
307+
sq.NonBlockingJobNames = cleanStringSlice(sq.NonBlockingJobNames)
306308
sq.WeakStableJobNames = cleanStringSlice(sq.WeakStableJobNames)
307309
sq.RequiredStatusContexts = cleanStringSlice(sq.RequiredStatusContexts)
308310
sq.RequiredRetestContexts = cleanStringSlice(sq.RequiredRetestContexts)
@@ -326,6 +328,7 @@ func (sq *SubmitQueue) internalInitialize(config *github.Config, features *featu
326328

327329
sq.e2e = (&e2e.RealE2ETester{
328330
BlockingJobNames: sq.BlockingJobNames,
331+
NonBlockingJobNames: sq.NonBlockingJobNames,
329332
WeakStableJobNames: sq.WeakStableJobNames,
330333
BuildStatus: map[string]e2e.BuildInfo{},
331334
GoogleGCSBucketUtils: gcs,
@@ -387,6 +390,12 @@ func (sq *SubmitQueue) EachLoop() error {
387390

388391
// AddFlags will add any request flags to the cobra `cmd`
389392
func (sq *SubmitQueue) AddFlags(cmd *cobra.Command, config *github.Config) {
393+
cmd.Flags().StringSliceVar(&sq.NonBlockingJobNames, "nonblocking-jenkins-jobs", []string{
394+
"kubernetes-e2e-gke-prod",
395+
"kubernetes-e2e-gke-subnet",
396+
"kubernetes-e2e-gke-test",
397+
"kubernetes-e2e-gce-examples",
398+
}, "Comma separated list of jobs that don't block merges, but will have status reported and issues filed.")
390399
cmd.Flags().StringSliceVar(&sq.BlockingJobNames, "jenkins-jobs", []string{
391400
"kubelet-gce-e2e-ci",
392401
"kubernetes-build",
@@ -398,7 +407,7 @@ func (sq *SubmitQueue) AddFlags(cmd *cobra.Command, config *github.Config) {
398407
"kubernetes-e2e-gke-slow",
399408
"kubernetes-e2e-gce-scalability",
400409
"kubernetes-kubemark-5-gce",
401-
}, "Comma separated list of jobs in Jenkins to use for stability testing")
410+
}, "Comma separated list of jobs in Jenkins that should block merges if failing.")
402411
cmd.Flags().StringSliceVar(&sq.WeakStableJobNames, "weak-stable-jobs",
403412
[]string{},
404413
"Comma separated list of jobs in Jenkins to use for stability testing that needs only weak success")

0 commit comments

Comments
 (0)