1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

dashboard: find static IP automatically, update images

Remove subversion & use newer version of the builder which
makes -verbose direct all.bash output to stdout/stderr.

LGTM=cmang
R=adg, cmang
CC=golang-codereviews
https://golang.org/cl/140910044
This commit is contained in:
Brad Fitzpatrick 2014-09-03 17:15:00 -07:00
parent 1e11d05bd8
commit 9f2fca72f6
6 changed files with 45 additions and 14 deletions

View File

@ -4,4 +4,6 @@ last-change
dashboard/coordinator/buildongce/client-*.dat
dashboard/coordinator/buildongce/token.dat
dashboard/coordinator/coordinator
dashboard/env/linux-x86-base/*.tar.gz
dashboard/env/linux-x86-nacl/*.tar.gz

View File

@ -25,8 +25,9 @@ var (
proj = flag.String("project", "symbolic-datum-552", "name of Project")
zone = flag.String("zone", "us-central1-a", "GCE zone")
mach = flag.String("machinetype", "n1-standard-16", "Machine type")
instName = flag.String("instance_name", "go-builder", "Name of VM instance.")
instName = flag.String("instance_name", "go-builder-1", "Name of VM instance.")
sshPub = flag.String("ssh_public_key", "", "ssh public key file to authorize. Can modify later in Google's web UI anyway.")
staticIP = flag.String("static_ip", "", "Static IP to use. If empty, automatic.")
)
func readFile(v string) string {
@ -110,6 +111,25 @@ func main() {
storageService, _ := storage.New(oauthClient)
_ = storageService // TODO?
natIP := *staticIP
if natIP == "" {
// Try to find it by name.
aggAddrList, err := computeService.Addresses.AggregatedList(*proj).Do()
if err != nil {
log.Fatal(err)
}
// http://godoc.org/code.google.com/p/google-api-go-client/compute/v1#AddressAggregatedList
IPLoop:
for _, asl := range aggAddrList.Items {
for _, addr := range asl.Addresses {
if addr.Name == *instName+"-ip" && addr.Status == "RESERVED" {
natIP = addr.Address
break IPLoop
}
}
}
}
cloudConfig := baseConfig
if *sshPub != "" {
key := strings.TrimSpace(readFile(*sshPub))
@ -135,7 +155,7 @@ func main() {
InitializeParams: &compute.AttachedDiskInitializeParams{
DiskName: *instName + "-coreos-stateless-pd",
SourceImage: imageURL,
DiskSizeGb: 100,
DiskSizeGb: 50,
},
},
},
@ -154,8 +174,9 @@ func main() {
&compute.NetworkInterface{
AccessConfigs: []*compute.AccessConfig{
&compute.AccessConfig{
Type: "ONE_TO_ONE_NAT",
Name: "External NAT",
Type: "ONE_TO_ONE_NAT",
Name: "External NAT",
NatIP: natIP,
},
},
Network: prefix + "/global/networks/default",

View File

@ -24,7 +24,7 @@ RUN apt-get install -y --no-install-recommends gcc libc6-dev
RUN apt-get install -y --no-install-recommends libc6-dev-i386 gcc-multilib
# For interacting with the Go source & subrepos:
RUN apt-get install -y --no-install-recommends mercurial git-core subversion
RUN apt-get install -y --no-install-recommends mercurial git-core
ENV GOPATH /gopath
ENV GOROOT /goroot
@ -36,10 +36,10 @@ ENV GO_TOOLS $GOPATH/src/code.google.com/p/go.tools
RUN mkdir -p $GO_TOOLS
RUN cd $GO_TOOLS $ && curl -s https://storage.googleapis.com/gobuilder/go.tools-snap.tar.gz | tar x --no-same-owner -zv
RUN cd $GOROOT && hg update -C b8ff0ec2a724
RUN cd $GOROOT && hg pull && hg update -C b8ff0ec2a724
RUN cd $GOROOT/src && ./make.bash
RUN mkdir -p /usr/local/bin
RUN cd $GO_TOOLS && hg update -C 918b8a7e7b1e
RUN cd $GO_TOOLS && hg pull && hg update -C f9e37a924785
ENV GOBIN /usr/local/bin
RUN /goroot/bin/go install code.google.com/p/go.tools/dashboard/builder

View File

@ -3,7 +3,10 @@
# license that can be found in the LICENSE file.
docker: Dockerfile
rm -f docker-linux.base.tar.gz
docker build -t gobuilders/linux-x86-base .
push: docker
docker push gobuilders/linux-x86-base
# This gets uploaded to:
# https://console.developers.google.com/project/apps~symbolic-datum-552/storage/go-builder-data/
docker-linux.base.tar.gz: docker
docker save gobuilders/linux-x86-base | gzip > docker-linux.base.tar.gz

View File

@ -15,6 +15,8 @@ FROM ubuntu:trusty
MAINTAINER golang-dev <golang-dev@googlegroups.com>
ENV DEBIAN_FRONTEND noninteractive
RUN echo cachebuster4
RUN apt-get update && apt-get upgrade -y
# For running curl to get the hg starter tarballs (faster than hg clone).
@ -24,7 +26,7 @@ RUN apt-get install -y --no-install-recommends curl ca-certificates
RUN apt-get install -y --no-install-recommends gcc libc6-dev
# For interacting with the Go source & subrepos:
RUN apt-get install -y --no-install-recommends mercurial git-core subversion
RUN apt-get install -y --no-install-recommends mercurial git-core
# For 32-bit nacl:
RUN apt-get install -y --no-install-recommends libc6-i386 libc6-dev-i386 lib32stdc++6 gcc-multilib
@ -39,11 +41,11 @@ ENV GO_TOOLS $GOPATH/src/code.google.com/p/go.tools
RUN mkdir -p $GO_TOOLS
RUN cd $GO_TOOLS $ && curl -s https://storage.googleapis.com/gobuilder/go.tools-snap.tar.gz | tar x --no-same-owner -zv
RUN cd $GOROOT && hg update -C b8ff0ec2a724
RUN cd $GOROOT && hg pull && hg update -C b8ff0ec2a724
RUN cd $GOROOT/src && ./make.bash
RUN mkdir -p /usr/local/bin
RUN cd $GO_TOOLS && hg update -C 918b8a7e7b1e
RUN cd $GO_TOOLS && hg pull && hg update -C f9e37a924785
ENV GOBIN /usr/local/bin
RUN /goroot/bin/go install code.google.com/p/go.tools/dashboard/builder

View File

@ -3,8 +3,11 @@
# license that can be found in the LICENSE file.
docker: Dockerfile
rm -f docker-linux.nacl.tar.gz
docker build -t gobuilders/linux-x86-nacl .
push: docker
docker push gobuilders/linux-x86-nacl
# This gets uploaded to:
# https://console.developers.google.com/project/apps~symbolic-datum-552/storage/go-builder-data/
docker-linux.nacl.tar.gz: docker
docker save gobuilders/linux-x86-nacl | gzip > docker-linux.nacl.tar.gz