Skip to content

Commit 3c39ce7

Browse files
committed
tip: fix, update tip.golang.org
Primarily for golang/go#29251 but also update the base Docker layer from Go 1.9 to Go 1.11, update other deps, and fix some Kubernetes config cleanups that happened prior without testing apparently. Fixes golang/go#29251 Change-Id: I0aafccdfedfc0d9ebb75d0c1a3b0819245ea5f19 Reviewed-on: https://go-review.googlesource.com/c/154181 Reviewed-by: Bryan C. Mills <[email protected]>
1 parent fe2443f commit 3c39ce7

File tree

8 files changed

+131
-84
lines changed

8 files changed

+131
-84
lines changed

cmd/tip/Dockerfile

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
FROM golang:1.9
1+
FROM golang:1.11
22

33
RUN apt-get update && apt-get install --no-install-recommends -y -q build-essential git
44

5+
# For implicit GOCACHE (Issues 29243 and 29251), set HOME:
6+
RUN mkdir -p /home/gopher
7+
ENV HOME /home/gopher
8+
59
# golang puts its go install here (weird but true)
610
ENV GOROOT_BOOTSTRAP /usr/local/go
711

812
# BEGIN deps (run `make update-deps` to update)
913

10-
# Repo cloud.google.com/go at 1d0c2da (2018-01-30)
11-
ENV REV=1d0c2da40456a9b47f5376165f275424acc15c09
12-
RUN go get -d cloud.google.com/go/compute/metadata `#and 6 other pkgs` &&\
14+
# Repo cloud.google.com/go at b5eca92 (2018-10-23)
15+
ENV REV=b5eca92245a08e245bc29c4880c9779ea4aeaa9a
16+
RUN go get -d cloud.google.com/go/compute/metadata `#and 7 other pkgs` &&\
1317
(cd /go/src/cloud.google.com/go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
1418

15-
# Repo github.com/golang/protobuf at 9255415 (2018-01-25)
16-
ENV REV=925541529c1fa6821df4e44ce2723319eb2be768
19+
# Repo github.com/golang/protobuf at b4deda0 (2018-04-30)
20+
ENV REV=b4deda0973fb4c70b50d226b1af49f3da59f5265
1721
RUN go get -d github.com/golang/protobuf/proto `#and 6 other pkgs` &&\
1822
(cd /go/src/github.com/golang/protobuf && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
1923

@@ -22,51 +26,62 @@ ENV REV=317e0006254c44a0ac427cc52a0e083ff0b9622f
2226
RUN go get -d github.com/googleapis/gax-go &&\
2327
(cd /go/src/github.com/googleapis/gax-go && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
2428

25-
# Repo golang.org/x/build at e879390 (2018-02-01)
26-
ENV REV=e8793909ba350594eea4c7c6bdb0f0d9a0d0f77a
29+
# Repo go.opencensus.io at ebd8d31 (2018-05-16)
30+
ENV REV=ebd8d31470fedf6c27d0e3056653ddff642509b8
31+
RUN go get -d go.opencensus.io/exporter/stackdriver/propagation `#and 12 other pkgs` &&\
32+
(cd /go/src/go.opencensus.io && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
33+
34+
# Repo golang.org/x/build at 7b78c20 (2018-12-13)
35+
ENV REV=7b78c2042368d5c56ee9dbd92ab5fa988c763944
2736
RUN go get -d golang.org/x/build/autocertcache &&\
2837
(cd /go/src/golang.org/x/build && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
2938

30-
# Repo golang.org/x/crypto at 1875d0a (2018-01-27)
31-
ENV REV=1875d0a70c90e57f11972aefd42276df65e895b9
39+
# Repo golang.org/x/crypto at e4dc69e (2018-11-06)
40+
ENV REV=e4dc69e5b2fd71dcaf8bd5d054eb936deb78d1fa
3241
RUN go get -d golang.org/x/crypto/acme `#and 2 other pkgs` &&\
3342
(cd /go/src/golang.org/x/crypto && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
3443

35-
# Repo golang.org/x/net at 6d90978 (2018-02-01)
36-
ENV REV=6d90978dc4889d44e8cfbd04c05d17b5417823c7
44+
# Repo golang.org/x/net at 891ebc4 (2018-12-13)
45+
ENV REV=891ebc4b82d6e74f468c533b06f983c7be918a96
3746
RUN go get -d golang.org/x/net/context `#and 8 other pkgs` &&\
3847
(cd /go/src/golang.org/x/net && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
3948

40-
# Repo golang.org/x/oauth2 at 30785a2 (2018-01-04)
41-
ENV REV=30785a2c434e431ef7c507b54617d6a951d5f2b4
49+
# Repo golang.org/x/oauth2 at f42d051 (2018-11-06)
50+
ENV REV=f42d05182288abf10faef86d16c0d07b8d40ea2d
4251
RUN go get -d golang.org/x/oauth2 `#and 5 other pkgs` &&\
4352
(cd /go/src/golang.org/x/oauth2 && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
4453

45-
# Repo golang.org/x/text at e19ae14 (2017-12-27)
46-
ENV REV=e19ae1496984b1c655b8044a65c0300a3c878dd3
54+
# Repo golang.org/x/sys at 4d1cda0 (2018-12-13)
55+
ENV REV=4d1cda033e0619309c606fc686de3adcf599539e
56+
RUN go get -d golang.org/x/sys/unix &&\
57+
(cd /go/src/golang.org/x/sys && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
58+
59+
# Repo golang.org/x/text at 6f44c5a (2018-10-30)
60+
ENV REV=6f44c5a2ea40ee3593d98cdcc905cc1fdaa660e2
4761
RUN go get -d golang.org/x/text/secure/bidirule `#and 4 other pkgs` &&\
4862
(cd /go/src/golang.org/x/text && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
4963

50-
# Repo google.golang.org/api at 7d0e2d3 (2018-01-30)
51-
ENV REV=7d0e2d350555821bef5a5b8aecf0d12cc1def633
64+
# Repo google.golang.org/api at 20530fd (2018-05-06)
65+
ENV REV=20530fd5d65ad2caee87891f9896d7547cb400c9
5266
RUN go get -d google.golang.org/api/gensupport `#and 9 other pkgs` &&\
5367
(cd /go/src/google.golang.org/api && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
5468

55-
# Repo google.golang.org/genproto at 4eb30f4 (2018-01-25)
56-
ENV REV=4eb30f4778eed4c258ba66527a0d4f9ec8a36c45
57-
RUN go get -d google.golang.org/genproto/googleapis/api/annotations `#and 3 other pkgs` &&\
69+
# Repo google.golang.org/genproto at 86e600f (2018-04-27)
70+
ENV REV=86e600f69ee4704c6efbf6a2a40a5c10700e76c2
71+
RUN go get -d google.golang.org/genproto/googleapis/api/annotations `#and 4 other pkgs` &&\
5872
(cd /go/src/google.golang.org/genproto && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
5973

60-
# Repo google.golang.org/grpc at 0bd008f (2018-01-25)
61-
ENV REV=0bd008f5fadb62d228f12b18d016709e8139a7af
62-
RUN go get -d google.golang.org/grpc `#and 23 other pkgs` &&\
74+
# Repo google.golang.org/grpc at 07ef407 (2018-08-06)
75+
ENV REV=07ef407d991f1004e6c3367c8f452ed9a02f17ff
76+
RUN go get -d google.golang.org/grpc `#and 26 other pkgs` &&\
6377
(cd /go/src/google.golang.org/grpc && (git cat-file -t $REV 2>/dev/null || git fetch -q origin $REV) && git reset --hard $REV)
6478

6579
# Optimization to speed up iterative development, not necessary for correctness:
6680
RUN go install cloud.google.com/go/compute/metadata \
6781
cloud.google.com/go/iam \
6882
cloud.google.com/go/internal \
6983
cloud.google.com/go/internal/optional \
84+
cloud.google.com/go/internal/trace \
7085
cloud.google.com/go/internal/version \
7186
cloud.google.com/go/storage \
7287
github.com/golang/protobuf/proto \
@@ -76,22 +91,35 @@ RUN go install cloud.google.com/go/compute/metadata \
7691
github.com/golang/protobuf/ptypes/duration \
7792
github.com/golang/protobuf/ptypes/timestamp \
7893
github.com/googleapis/gax-go \
94+
go.opencensus.io/exporter/stackdriver/propagation \
95+
go.opencensus.io/internal \
96+
go.opencensus.io/internal/tagencoding \
97+
go.opencensus.io/plugin/ochttp \
98+
go.opencensus.io/plugin/ochttp/propagation/b3 \
99+
go.opencensus.io/stats \
100+
go.opencensus.io/stats/internal \
101+
go.opencensus.io/stats/view \
102+
go.opencensus.io/tag \
103+
go.opencensus.io/trace \
104+
go.opencensus.io/trace/internal \
105+
go.opencensus.io/trace/propagation \
79106
golang.org/x/build/autocertcache \
80107
golang.org/x/crypto/acme \
81108
golang.org/x/crypto/acme/autocert \
82109
golang.org/x/net/context \
83110
golang.org/x/net/context/ctxhttp \
111+
golang.org/x/net/http/httpguts \
84112
golang.org/x/net/http2 \
85113
golang.org/x/net/http2/hpack \
86114
golang.org/x/net/idna \
87115
golang.org/x/net/internal/timeseries \
88-
golang.org/x/net/lex/httplex \
89116
golang.org/x/net/trace \
90117
golang.org/x/oauth2 \
91118
golang.org/x/oauth2/google \
92119
golang.org/x/oauth2/internal \
93120
golang.org/x/oauth2/jws \
94121
golang.org/x/oauth2/jwt \
122+
golang.org/x/sys/unix \
95123
golang.org/x/text/secure/bidirule \
96124
golang.org/x/text/transform \
97125
golang.org/x/text/unicode/bidi \
@@ -107,6 +135,7 @@ RUN go install cloud.google.com/go/compute/metadata \
107135
google.golang.org/api/transport/http \
108136
google.golang.org/genproto/googleapis/api/annotations \
109137
google.golang.org/genproto/googleapis/iam/v1 \
138+
google.golang.org/genproto/googleapis/rpc/code \
110139
google.golang.org/genproto/googleapis/rpc/status \
111140
google.golang.org/grpc \
112141
google.golang.org/grpc/balancer \
@@ -117,9 +146,13 @@ RUN go install cloud.google.com/go/compute/metadata \
117146
google.golang.org/grpc/credentials \
118147
google.golang.org/grpc/encoding \
119148
google.golang.org/grpc/encoding/proto \
120-
google.golang.org/grpc/grpclb/grpc_lb_v1/messages \
121149
google.golang.org/grpc/grpclog \
122150
google.golang.org/grpc/internal \
151+
google.golang.org/grpc/internal/backoff \
152+
google.golang.org/grpc/internal/channelz \
153+
google.golang.org/grpc/internal/envconfig \
154+
google.golang.org/grpc/internal/grpcrand \
155+
google.golang.org/grpc/internal/transport \
123156
google.golang.org/grpc/keepalive \
124157
google.golang.org/grpc/metadata \
125158
google.golang.org/grpc/naming \
@@ -129,8 +162,7 @@ RUN go install cloud.google.com/go/compute/metadata \
129162
google.golang.org/grpc/resolver/passthrough \
130163
google.golang.org/grpc/stats \
131164
google.golang.org/grpc/status \
132-
google.golang.org/grpc/tap \
133-
google.golang.org/grpc/transport
165+
google.golang.org/grpc/tap
134166
# END deps.
135167

136168
# golang sets GOPATH=/go

cmd/tip/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ push-staging: docker-image
3333

3434
deploy-prod: push-prod
3535
go install golang.org/x/build/cmd/xb
36-
xb --prod kubectl set image deployment/tip-deployment tip=$(IMAGE_PROD):$(VERSION)
36+
xb --prod kubectl set image deployment/tipgodoc-deployment tipgodoc=$(IMAGE_PROD):$(VERSION)
3737
deploy-staging: push-staging
3838
go install golang.org/x/build/cmd/xb
39-
xb --staging kubectl set image deployment/tip-deployment tip=$(IMAGE_STAGING):$(VERSION)
39+
xb --staging kubectl set image deployment/tipgodoc-deployment tipgodoc=$(IMAGE_STAGING):$(VERSION)
4040

cmd/tip/README

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ New Kubernetes instructions, for tip.golang.org:
2323

2424
Kubernetes instructions:
2525

26-
* build & push images (see Makefile for helpers)
27-
* create/update resources:
28-
- kubectl create -f tip-rc.yaml
29-
- kubectl create -f tip-service.yaml
26+
* make deploy-prod
3027

31-
TODO(bradfitz): flesh out these instructions as I gain experience
32-
with updating this over time. Also: move talks.golang.org to GKE too?
28+
Also: move talks.golang.org to GKE too?

cmd/tip/godoc.go

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,73 @@ import (
88
"bytes"
99
"errors"
1010
"fmt"
11+
"io"
12+
"log"
1113
"os"
1214
"os/exec"
1315
"path/filepath"
1416
)
1517

16-
type godocBuilder struct {
18+
type godocBuilder struct{}
19+
20+
func prefix8(s string) string {
21+
if len(s) < 8 {
22+
return s
23+
}
24+
return s[:8]
1725
}
1826

1927
func (b godocBuilder) Signature(heads map[string]string) string {
20-
return fmt.Sprintf("go=%v/tools=%v", heads["go"], heads["tools"])
28+
return fmt.Sprintf("go=%v/tools=%v", prefix8(heads["go"]), prefix8(heads["tools"]))
2129
}
2230

23-
func (b godocBuilder) Init(dir, hostport string, heads map[string]string) (*exec.Cmd, error) {
31+
func (b godocBuilder) Init(logger *log.Logger, dir, hostport string, heads map[string]string) (*exec.Cmd, error) {
32+
2433
goDir := filepath.Join(dir, "go")
2534
toolsDir := filepath.Join(dir, "gopath/src/golang.org/x/tools")
35+
logger.Printf("checking out go repo ...")
2636
if err := checkout(repoURL+"go", heads["go"], goDir); err != nil {
27-
return nil, err
37+
return nil, fmt.Errorf("checkout of go: %v", err)
2838
}
39+
logger.Printf("checking out tools repo ...")
2940
if err := checkout(repoURL+"tools", heads["tools"], toolsDir); err != nil {
30-
return nil, err
41+
return nil, fmt.Errorf("checkout of tools: %v", err)
3142
}
3243

44+
var logWriter io.Writer = toLoggerWriter{logger}
45+
3346
make := exec.Command(filepath.Join(goDir, "src/make.bash"))
3447
make.Dir = filepath.Join(goDir, "src")
35-
if err := runErr(make); err != nil {
36-
return nil, err
48+
make.Stdout = logWriter
49+
make.Stderr = logWriter
50+
logger.Printf("running make.bash in %s ...", make.Dir)
51+
if err := make.Run(); err != nil {
52+
return nil, fmt.Errorf("running make.bash: %v", err)
3753
}
54+
55+
logger.Printf("installing godoc ...")
3856
goBin := filepath.Join(goDir, "bin/go")
3957
goPath := filepath.Join(dir, "gopath")
4058
install := exec.Command(goBin, "install", "golang.org/x/tools/cmd/godoc")
41-
install.Env = []string{
42-
"GOROOT=" + goDir,
43-
"GOPATH=" + goPath,
44-
"GOROOT_BOOTSTRAP=" + os.Getenv("GOROOT_BOOTSTRAP"),
45-
}
46-
if err := runErr(install); err != nil {
47-
return nil, err
59+
install.Stdout = logWriter
60+
install.Stderr = logWriter
61+
install.Env = append(os.Environ(),
62+
"GOROOT="+goDir,
63+
"GOPATH="+goPath,
64+
"GOROOT_BOOTSTRAP="+os.Getenv("GOROOT_BOOTSTRAP"),
65+
)
66+
if err := install.Run(); err != nil {
67+
return nil, fmt.Errorf("go install golang.org/x/tools/cmd/godoc: %v", err)
4868
}
4969

70+
logger.Printf("starting godoc ...")
5071
godocBin := filepath.Join(goPath, "bin/godoc")
5172
godoc := exec.Command(godocBin, "-http="+hostport, "-index", "-index_interval=-1s", "-play")
52-
godoc.Env = []string{"GOROOT=" + goDir}
53-
// TODO(adg): log this somewhere useful
54-
godoc.Stdout = os.Stdout
55-
godoc.Stderr = os.Stderr
73+
godoc.Env = append(os.Environ(), "GOROOT="+goDir)
74+
godoc.Stdout = logWriter
75+
godoc.Stderr = logWriter
5676
if err := godoc.Start(); err != nil {
57-
return nil, err
77+
return nil, fmt.Errorf("starting godoc: %v", err)
5878
}
5979
return godoc, nil
6080
}

cmd/tip/godoc.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

cmd/tip/talks.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@ import (
88
"bytes"
99
"errors"
1010
"fmt"
11+
"log"
1112
"os"
1213
"os/exec"
1314
"path/filepath"
1415
"runtime"
1516
)
1617

17-
type talksBuilder struct {
18-
}
18+
type talksBuilder struct{}
1919

2020
func (b talksBuilder) Signature(heads map[string]string) string {
2121
return heads["talks"]
2222
}
2323

2424
const talksToolsRev = "8cab8a1319f0be9798e7fe78b15da75e5f94b2e9"
2525

26-
func (b talksBuilder) Init(dir, hostport string, heads map[string]string) (*exec.Cmd, error) {
26+
func (b talksBuilder) Init(logger *log.Logger, dir, hostport string, heads map[string]string) (*exec.Cmd, error) {
27+
// TODO: use logger
2728
toolsDir := filepath.Join(dir, "gopath/src/golang.org/x/tools")
2829
if err := checkout(repoURL+"tools", talksToolsRev, toolsDir); err != nil {
2930
return nil, err
@@ -41,7 +42,7 @@ func (b talksBuilder) Init(dir, hostport string, heads map[string]string) (*exec
4142
goPath := filepath.Join(dir, "gopath")
4243
presentPath := "golang.org/x/tools/cmd/present"
4344
install := exec.Command(goBin, "install", "-tags=appenginevm", presentPath)
44-
install.Env = []string{"GOROOT=" + goDir, "GOPATH=" + goPath}
45+
install.Env = append(os.Environ(), "GOROOT="+goDir, "GOPATH="+goPath)
4546
if err := runErr(install); err != nil {
4647
return nil, err
4748
}

cmd/tip/tip-prod.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ spec:
3131
- containerPort: 443
3232
resources:
3333
requests:
34-
cpu: "1"
35-
memory: "2Gi"
36-
limits:
3734
cpu: "2"
3835
memory: "4Gi"
36+
limits:
37+
cpu: "2"
38+
memory: "8Gi"

0 commit comments

Comments
 (0)