зеркало из https://github.com/golang/build.git
cmd/coordinator, dashboard: split build into 'make' and 'run' steps
Change-Id: Ib60a601ef21163d5e0d1fed3a2609d9b719c616a Reviewed-on: https://go-review.googlesource.com/10073 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Родитель
1fc56ca750
Коммит
fb774889dc
|
@ -1,4 +1,4 @@
|
||||||
coordinator: builders.go coordinator.go gce.go dash.go debug.go reverse.go status.go watcher.go
|
coordinator: builders.go coordinator.go dash.go debug.go gce.go reverse.go status.go watcher.go
|
||||||
GOOS=linux go build -o coordinator .
|
GOOS=linux go build -o coordinator .
|
||||||
|
|
||||||
# After "make upload", either reboot the machine, or ssh to it and:
|
# After "make upload", either reboot the machine, or ssh to it and:
|
||||||
|
|
|
@ -297,8 +297,7 @@ func main() {
|
||||||
if devCluster {
|
if devCluster {
|
||||||
// Only run the linux-amd64 builder in the dev cluster (for now).
|
// Only run the linux-amd64 builder in the dev cluster (for now).
|
||||||
conf := dashboard.Builders["linux-amd64"]
|
conf := dashboard.Builders["linux-amd64"]
|
||||||
// TODO(adg): uncomment once we have buildlet images in the dev bucket
|
conf.SetBuildletBinaryURL(strings.Replace(conf.BuildletBinaryURL(), "go-builder-data", "dev-go-builder-data", 1))
|
||||||
//conf.SetBuildletBinaryURL(strings.Replace(conf.BuildletBinaryURL(), "go-builder-data", "dev-go-builder-data", 1))
|
|
||||||
dashboard.Builders = map[string]dashboard.BuildConfig{"linux-amd64": conf}
|
dashboard.Builders = map[string]dashboard.BuildConfig{"linux-amd64": conf}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,17 +1032,43 @@ func (st *buildStatus) build() (retErr error) {
|
||||||
st.logEventTime("pre_exec")
|
st.logEventTime("pre_exec")
|
||||||
fmt.Fprintf(st, "%s at %v\n\n", st.name, st.rev)
|
fmt.Fprintf(st, "%s at %v\n\n", st.name, st.rev)
|
||||||
|
|
||||||
remoteErr, err := bc.Exec(path.Join("go", st.conf.AllScript()), buildlet.ExecOpts{
|
makeScript := st.conf.MakeScript()
|
||||||
Output: st,
|
lastScript := makeScript
|
||||||
OnStartExec: func() { st.logEventTime("running_exec") },
|
remoteErr, err := bc.Exec(path.Join("go", makeScript), buildlet.ExecOpts{
|
||||||
ExtraEnv: st.conf.Env(),
|
Output: st,
|
||||||
Debug: true,
|
OnStartExec: func() {
|
||||||
Args: st.conf.AllScriptArgs(),
|
st.logEventTime("running_exec") // TODO(adg): remove this?
|
||||||
|
st.logEventTime("make_exec")
|
||||||
|
},
|
||||||
|
ExtraEnv: st.conf.Env(),
|
||||||
|
Debug: true,
|
||||||
|
Args: st.conf.MakeScriptArgs(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
st.logEventTime("done")
|
st.logEventTime("make_done")
|
||||||
|
|
||||||
|
if remoteErr == nil {
|
||||||
|
runScript := st.conf.RunScript()
|
||||||
|
lastScript = runScript
|
||||||
|
remoteErr, err = bc.Exec(path.Join("go", runScript), buildlet.ExecOpts{
|
||||||
|
Output: st,
|
||||||
|
OnStartExec: func() { st.logEventTime("run_exec") },
|
||||||
|
ExtraEnv: st.conf.Env(),
|
||||||
|
// all.X sources make.X which adds $GOROOT/bin to $PATH,
|
||||||
|
// so run.X expects to find the go binary in $PATH.
|
||||||
|
Path: []string{"$WORKDIR/go/bin", "$PATH"},
|
||||||
|
Debug: true,
|
||||||
|
Args: st.conf.RunScriptArgs(),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
st.logEventTime("run_done")
|
||||||
|
}
|
||||||
|
st.logEventTime("done") // TODO(adg): remove this?
|
||||||
|
|
||||||
if st.trySet == nil {
|
if st.trySet == nil {
|
||||||
var buildLog string
|
var buildLog string
|
||||||
if remoteErr != nil {
|
if remoteErr != nil {
|
||||||
|
@ -1057,7 +1082,7 @@ func (st *buildStatus) build() (retErr error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if remoteErr != nil {
|
if remoteErr != nil {
|
||||||
return fmt.Errorf("%s failed: %v", st.conf.AllScript(), remoteErr)
|
return fmt.Errorf("%v failed: %v", lastScript, remoteErr)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ func (c *BuildConfig) AllScript() string {
|
||||||
return "src/all.bash"
|
return "src/all.bash"
|
||||||
}
|
}
|
||||||
|
|
||||||
// AllScript returns the set of arguments that should be passed to the
|
// AllScriptArgs returns the set of arguments that should be passed to the
|
||||||
// all.bash-equivalent script. Usually empty.
|
// all.bash-equivalent script. Usually empty.
|
||||||
func (c *BuildConfig) AllScriptArgs() []string {
|
func (c *BuildConfig) AllScriptArgs() []string {
|
||||||
if strings.HasPrefix(c.Name, "darwin-arm") {
|
if strings.HasPrefix(c.Name, "darwin-arm") {
|
||||||
|
@ -122,6 +122,31 @@ func (c *BuildConfig) MakeScript() string {
|
||||||
return "src/make.bash"
|
return "src/make.bash"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MakeScriptArgs returns the set of arguments that should be passed to the
|
||||||
|
// make.bash-equivalent script. Usually empty.
|
||||||
|
func (c *BuildConfig) MakeScriptArgs() []string {
|
||||||
|
return c.AllScriptArgs()
|
||||||
|
}
|
||||||
|
|
||||||
|
// RunScript returns the relative path to the operating system's script to
|
||||||
|
// run the test suite.
|
||||||
|
// Example values are "src/run.bash", "src/run.bat", "src/run.rc".
|
||||||
|
func (c *BuildConfig) RunScript() string {
|
||||||
|
if strings.HasPrefix(c.Name, "windows-") {
|
||||||
|
return "src/run.bat"
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(c.Name, "plan9-") {
|
||||||
|
return "src/run.rc"
|
||||||
|
}
|
||||||
|
return "src/run.bash"
|
||||||
|
}
|
||||||
|
|
||||||
|
// RunScriptArgs returns the set of arguments that should be passed to the
|
||||||
|
// run.bash-equivalent script.
|
||||||
|
func (c *BuildConfig) RunScriptArgs() []string {
|
||||||
|
return []string{"--no-rebuild"}
|
||||||
|
}
|
||||||
|
|
||||||
// GorootFinal returns the default install location for
|
// GorootFinal returns the default install location for
|
||||||
// releases for this platform.
|
// releases for this platform.
|
||||||
func (c *BuildConfig) GorootFinal() string {
|
func (c *BuildConfig) GorootFinal() string {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче