Skip to content

Commit

Permalink
internal/buildgo: build Go with -force flag when available
Browse files Browse the repository at this point in the history
Make builders and trybots more useful for broken and incomplete ports
by always including the '-force' flag when invoking make on a buildlet,
so that the build or trybot proceeds as far as it possibly can.

This CL is based on work done in CL 521356.

Fixes golang/go#61925.

Change-Id: I2a12f0a50cfce19f1e59f77e3cdf10241d2a2144
Co-authored-by: Joel Sing <[email protected]>
Reviewed-on: https://go-review.googlesource.com/c/build/+/535395
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Auto-Submit: Dmitri Shuralyov <[email protected]>
  • Loading branch information
2 people authored and gopherbot committed Oct 14, 2023
1 parent f5e0fb4 commit 4988086
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
14 changes: 11 additions & 3 deletions cmd/coordinator/buildstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,19 @@ func (st *buildStatus) SpanRecord(sp *schedule.Span, err error) *types.SpanRecor

// goBuilder returns a GoBuilder for this buildStatus.
func (st *buildStatus) goBuilder() buildgo.GoBuilder {
forceMake := true
if st.RevBranch == "release-branch.go1.20" {
// The concept of "broken ports" and -force flag didn't
// exist prior to Go 1.21. See go.dev/issue/56679.
// TODO: Remove this condition when Go 1.20 is no longer supported.
forceMake = false
}
return buildgo.GoBuilder{
Logger: st,
BuilderRev: st.BuilderRev,
Conf: st.conf,
Goroot: "go",
Force: forceMake,
}
}

Expand Down Expand Up @@ -662,9 +670,9 @@ func (st *buildStatus) runAllSharded() (remoteErr, err error) {
// buildTestPackages runs `go tool dist test -compile-only`, which builds all standard
// library test packages but does not run any tests. Used in cross-compilation modes.
func (st *buildStatus) buildTestPackages() (remoteErr, err error) {
if st.RevBranch == "release-branch.go1.19" || st.RevBranch == "release-branch.go1.20" {
// TODO(mknyszek): Go 1.19 and 1.20 don't support `go tool dist test -compile-only`
// very well. Remove this condition when Go 1.20 is no longer supported.
if st.RevBranch == "release-branch.go1.20" {
// Go 1.20 doesn't support `go tool dist test -compile-only` very well.
// TODO(mknyszek): Remove this condition when Go 1.20 is no longer supported.
return nil, nil
}
sp := st.CreateSpan("build_test_pkgs")
Expand Down
6 changes: 0 additions & 6 deletions dashboard/builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -2122,8 +2122,6 @@ func init() {
// The machine is slow.
"GO_TEST_TIMEOUT_SCALE=5",
},
makeScriptArgs: []string{"-force"}, // Port is marked broken.
allScriptArgs: []string{"-force"}, // Port is marked broken.
})
addBuilder(BuildConfig{
Name: "openbsd-ppc64-n2vi",
Expand All @@ -2141,8 +2139,6 @@ func init() {
},
distTestAdjust: noTestDirAndNoReboot,
tryBot: nil,
makeScriptArgs: []string{"-force"}, // Port is incomplete.
allScriptArgs: []string{"-force"}, // Port is incomplete.
})
addBuilder(BuildConfig{
Name: "openbsd-riscv64-jsing",
Expand All @@ -2164,8 +2160,6 @@ func init() {
// The machine is slow.
"GO_TEST_TIMEOUT_SCALE=3",
},
makeScriptArgs: []string{"-force"}, // Port is incomplete.
allScriptArgs: []string{"-force"}, // Port is incomplete.
})
addBuilder(BuildConfig{
Name: "netbsd-386-9_3",
Expand Down
9 changes: 8 additions & 1 deletion internal/buildgo/buildgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ type GoBuilder struct {
// GorootBootstrap is an optional absolute Unix-style path to the
// bootstrap toolchain, overriding the default.
GorootBootstrap string
// Force controls whether to use the -force flag when building Go.
// See go.dev/issue/56679.
Force bool
}

// RunMake builds the tool chain.
Expand All @@ -111,11 +114,15 @@ func (gb GoBuilder) RunMake(ctx context.Context, bc buildlet.Client, w io.Writer
if gb.GorootBootstrap != "" {
env = append(env, "GOROOT_BOOTSTRAP="+gb.GorootBootstrap)
}
makeArgs := gb.Conf.MakeScriptArgs()
if gb.Force {
makeArgs = append(makeArgs, "-force")
}
remoteErr, err = bc.Exec(ctx, path.Join(gb.Goroot, gb.Conf.MakeScript()), buildlet.ExecOpts{
Output: w,
ExtraEnv: env,
Debug: true,
Args: gb.Conf.MakeScriptArgs(),
Args: makeArgs,
})
if err != nil {
makeSpan.Done(err)
Expand Down

0 comments on commit 4988086

Please sign in to comment.