Skip to content

Commit 477369d

Browse files
mengzhuogopherbot
authored andcommitted
cmd/coordinator,dashboard: add privateGoProxy setting
Builders behind firewall may not access to proxy.golang.org but has its own private Go module proxy linux-mips64le-mengzhuo linux-amd64-wsl linux-riscv64-unmatched NeedsGoProxy is for long test used which we should not change. Update golang/go#42971 Change-Id: If300b751487ae08e05f5200581eb4c2719706a56 Reviewed-on: https://go-review.googlesource.com/c/build/+/275412 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Lee Baokun <bk@golangcn.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
1 parent 50c5a26 commit 477369d

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

cmd/coordinator/buildstatus.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,8 +1124,11 @@ func (st *buildStatus) runSubrepoTests() (remoteErr, err error) {
11241124
env := append(st.conf.Env(),
11251125
"GOROOT="+goroot,
11261126
"GOPATH="+gopath,
1127-
"GOPROXY="+moduleProxy(), // GKE value but will be ignored/overwritten by reverse buildlets
11281127
)
1128+
if !st.conf.IsReverse() {
1129+
// GKE value but will be ignored/overwritten by reverse buildlets
1130+
env = append(env, "GOPROXY="+moduleProxy())
1131+
}
11291132
env = append(env, st.conf.ModulesEnv(st.SubName)...)
11301133

11311134
args := []string{"test"}

dashboard/builders.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,11 @@ type BuildConfig struct {
887887
// to run cmd/go tests fetching from the network.
888888
needsGoProxy bool
889889

890+
// privateGoProxy for builder has it's own Go proxy instead of
891+
// proxy.golang.org, after setting this builder will respect
892+
// GOPROXY enviroment value.
893+
privateGoProxy bool
894+
890895
// InstallRacePackages controls which packages to "go install
891896
// -race <pkgs>" after running make.bash (or equivalent). If
892897
// the builder ends in "-race", the default if non-nil is just
@@ -959,7 +964,7 @@ func (c *BuildConfig) Env() []string {
959964
func (c *BuildConfig) ModulesEnv(repo string) (env []string) {
960965
// EC2 and reverse builders should set the public module proxy
961966
// address instead of the internal proxy.
962-
if (c.HostConfig().isEC2 || c.IsReverse()) && repo != "go" {
967+
if (c.HostConfig().isEC2 || c.IsReverse()) && repo != "go" && !c.PrivateGoProxy() {
963968
env = append(env, "GOPROXY=https://proxy.golang.org")
964969
}
965970
switch repo {
@@ -1155,6 +1160,9 @@ func (c *BuildConfig) IsTryOnly() bool { return c.tryOnly }
11551160

11561161
func (c *BuildConfig) NeedsGoProxy() bool { return c.needsGoProxy }
11571162

1163+
// PrivateGoProxy for builder has it's own Go proxy instead of proxy.golang.org
1164+
func (c *BuildConfig) PrivateGoProxy() bool { return c.privateGoProxy }
1165+
11581166
// BuildsRepoPostSubmit reports whether the build configuration type c
11591167
// should build the given repo ("go", "net", etc) and branch
11601168
// ("master", "release-branch.go1.12") as a post-submit build
@@ -2517,6 +2525,7 @@ func init() {
25172525
Name: "linux-mips64le-mengzhuo",
25182526
buildsRepo: onlyMasterDefault,
25192527
distTestAdjust: mipsDistTestPolicy,
2528+
privateGoProxy: true, // this builder is behind firewall
25202529
})
25212530
addBuilder(BuildConfig{
25222531
FlakyNet: true,
@@ -2589,6 +2598,7 @@ func init() {
25892598
FlakyNet: true,
25902599
buildsRepo: onlyMasterDefault,
25912600
distTestAdjust: riscvDistTestPolicy,
2601+
privateGoProxy: true, // this builder is behind firewall
25922602
})
25932603
addBuilder(BuildConfig{
25942604
Name: "linux-s390x-ibm",
@@ -2701,11 +2711,12 @@ func init() {
27012711
},
27022712
})
27032713
addBuilder(BuildConfig{
2704-
Name: "linux-amd64-wsl",
2705-
HostType: "host-linux-amd64-wsl",
2706-
Notes: "Windows 10 WSL2 Ubuntu",
2707-
FlakyNet: true,
2708-
SkipSnapshot: true, // The builder has a slow uplink bandwidth.
2714+
Name: "linux-amd64-wsl",
2715+
HostType: "host-linux-amd64-wsl",
2716+
Notes: "Windows 10 WSL2 Ubuntu",
2717+
FlakyNet: true,
2718+
SkipSnapshot: true, // The builder has a slow uplink bandwidth.
2719+
privateGoProxy: true, // this builder is behind firewall
27092720
})
27102721
addBuilder(BuildConfig{
27112722
Name: "linux-amd64-perf",

0 commit comments

Comments
 (0)