forked from vanadium-archive/go.devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postsubmit.go
38 lines (33 loc) · 1.1 KB
/
postsubmit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package test
import (
"v.io/jiri"
"v.io/jiri/collect"
"v.io/x/devtools/internal/test"
)
// vanadiumPostsubmitPoll polls for new changes in all projects' master branches,
// and starts the corresponding Jenkins targets based on the changes.
func vanadiumPostsubmitPoll(jirix *jiri.X, testName string, _ ...Opt) (_ *test.Result, e error) {
// Initialize the test.
cleanup, err := initTestImpl(jirix, false, true, false, testName, []string{"v23:base"}, "")
if err != nil {
return nil, newInternalError(err, "Init")
}
defer collect.Error(func() error { return cleanup() }, &e)
// Run the "postsubmit poll" command.
args := []string{}
if jirix.Verbose() {
args = append(args, "-v")
}
args = append(args,
"-host", jenkinsHost,
"poll",
"-manifest", "tools",
)
if err := jirix.NewSeq().Capture(jirix.Stdout(), jirix.Stderr()).Last("postsubmit", args...); err != nil {
return nil, err
}
return &test.Result{Status: test.Passed}, nil
}