forked from weaveworks/weave
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build in a container by default, using go 1.5 and vendored dependancies.
- Use submodules for vendoring. - Don't go clean, now that everything is in .pkg. - sudo -E as we need the environment variables. - Install -race version of std so the tests can run without sudo. - Cache the build image on circle, use the rebuild-image script from tools.
- Loading branch information
Showing
26 changed files
with
154 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ _testmain.go | |
*.prof | ||
profile.cov | ||
coverage.html | ||
.pkg | ||
|
||
# Emacs backup files | ||
*~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,51 @@ | ||
[submodule "tools"] | ||
path = tools | ||
url = https://github.com/weaveworks/build-tools | ||
[submodule "vendor/github.com/vishvananda/netlink"] | ||
path = vendor/github.com/vishvananda/netlink | ||
url = https://github.com/vishvananda/netlink.git | ||
[submodule "vendor/github.com/davecheney/profile"] | ||
path = vendor/github.com/davecheney/profile | ||
url = https://github.com/davecheney/profile.git | ||
[submodule "vendor/github.com/gorilla/mux"] | ||
path = vendor/github.com/gorilla/mux | ||
url = https://github.com/gorilla/mux.git | ||
[submodule "vendor/github.com/gorilla/context"] | ||
path = vendor/github.com/gorilla/context | ||
url = https://github.com/gorilla/context.git | ||
[submodule "vendor/github.com/google/gopacket"] | ||
path = vendor/github.com/google/gopacket | ||
url = https://github.com/google/gopacket.git | ||
[submodule "vendor/github.com/weaveworks/go-odp"] | ||
path = vendor/github.com/weaveworks/go-odp | ||
url = https://github.com/weaveworks/go-odp.git | ||
[submodule "vendor/github.com/opencontainers/runc"] | ||
path = vendor/github.com/opencontainers/runc | ||
url = https://github.com/opencontainers/runc.git | ||
[submodule "vendor/github.com/fsouza/go-dockerclient"] | ||
path = vendor/github.com/fsouza/go-dockerclient | ||
url = https://github.com/fsouza/go-dockerclient.git | ||
[submodule "vendor/github.com/docker/libnetwork"] | ||
path = vendor/github.com/docker/libnetwork | ||
url = https://github.com/docker/libnetwork.git | ||
[submodule "vendor/github.com/docker/docker"] | ||
path = vendor/github.com/docker/docker | ||
url = https://github.com/docker/docker.git | ||
[submodule "vendor/github.com/Sirupsen/logrus"] | ||
path = vendor/github.com/Sirupsen/logrus | ||
url = https://github.com/Sirupsen/logrus.git | ||
[submodule "vendor/github.com/andybalholm/go-bit"] | ||
path = vendor/github.com/andybalholm/go-bit | ||
url = https://github.com/andybalholm/go-bit.git | ||
[submodule "vendor/github.com/miekg/dns"] | ||
path = vendor/github.com/miekg/dns | ||
url = https://github.com/miekg/dns.git | ||
[submodule "vendor/github.com/stretchr/testify"] | ||
path = vendor/github.com/stretchr/testify | ||
url = https://github.com/stretchr/testify.git | ||
[submodule "vendor/golang.org/x/crypto"] | ||
path = vendor/golang.org/x/crypto | ||
url = https://github.com/golang/crypto.git | ||
[submodule "vendor/github.com/docker/machine"] | ||
path = vendor/github.com/docker/machine | ||
url = https://github.com/docker/machine.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
FROM ubuntu | ||
|
||
RUN apt-get -y update && apt-get -y install --no-install-recommends ca-certificates apt-transport-https | ||
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | ||
RUN echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list | ||
RUN apt-get -y update && apt-get -y install --no-install-recommends build-essential git lxc-docker-1.6.2 mercurial libpcap-dev curl make pkg-config gcc bison flex python-requests | ||
|
||
# When doing a build in a container, "apt-get update" happens twice, | ||
# which can be a very significant overhead for incremental builds. | ||
# And it's unnecessary, because if any of the prerequisites do change, | ||
# the right thing to do is to rebuild the container image. Rather | ||
# than suppressing the "apt-get update" commands explicitly, we clear | ||
# out sources.list so that 'apt-get update' doesn't do anything. | ||
RUN echo >/etc/apt/sources.list | ||
|
||
ENV GO_VERSION 1.4.2 | ||
RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz | ||
ENV PATH /usr/local/go/bin:$PATH | ||
|
||
# So that sudo does not trample on PATH | ||
RUN sed -ie '/secure_path/d' /etc/sudoers | ||
|
||
FROM golang:1.5.2 | ||
ENV GO15VENDOREXPERIMENT 1 | ||
RUN apt-get update && apt-get install -y libpcap-dev python-requests time | ||
RUN go get github.com/golang/lint/golint | ||
RUN go clean -i net && go install -tags netgo std | ||
RUN go install -race -tags netgo std | ||
COPY build.sh / | ||
ENTRYPOINT ["sh", "/build.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,28 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
GOPATH=/home/go | ||
export GOPATH | ||
set -eu | ||
|
||
WEAVE_SRC=$GOPATH/src/github.com/weaveworks/weave | ||
|
||
if [ $# -eq 0 -o "$1" = "tests" ] ; then | ||
# No arguments. Expect that the weave repo will be bind-mounted | ||
# into $GOPATH | ||
if ! [ -e $WEAVE_SRC ] ; then | ||
cat 2>&1 <<EOF | ||
No container arguments supplied, and nothing at ${WEAVE_SRC}. Please | ||
either bind-mount the golang workspace containing weave with the | ||
if ! [ -e $WEAVE_SRC ] ; then | ||
cat 2>&1 <<EOF | ||
Nothing at ${WEAVE_SRC}. Please bind-mount the weave repo with the | ||
docker run -v option, e.g.: | ||
$ docker run -v <host gopath>:${GOPATH} \\ | ||
-v /var/run/docker.sock:/var/run/docker.sock weaveworks/weave-build | ||
Or supply git clone arguments to retrieve it, e.g.: | ||
$ docker run -v /var/run/docker.sock:/var/run/docker.sock \\ | ||
weaveworks/weave-build https://github.com/weaveworks/weave.git | ||
$ cd weave | ||
$ docker run -v $(pwd):/go/src/github.com/weaveworks/weave \\ | ||
weaveworks/weave-build | ||
EOF | ||
exit 1 | ||
fi | ||
|
||
# If we run make directly, any files created on the bind mount | ||
# will have awkward ownership. So we switch to a user with the | ||
# same user and group IDs as source directory. We have to set a | ||
# few things up so that sudo works without complaining later on. | ||
uid=$(stat --format="%u" $WEAVE_SRC) | ||
gid=$(stat --format="%g" $WEAVE_SRC) | ||
echo "weave:x:$uid:$gid::$WEAVE_SRC:/bin/sh" >>/etc/passwd | ||
echo "weave:*:::::::" >>/etc/shadow | ||
echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers | ||
|
||
su weave -c "PATH=$PATH make -C $WEAVE_SRC build" | ||
else | ||
# There are arguments to pass to git-clone | ||
mkdir -p ${WEAVE_SRC%/*} | ||
git clone "$@" $WEAVE_SRC | ||
make -C $WEAVE_SRC build | ||
fi | ||
|
||
# If we run make directly, any files created on the bind mount | ||
# will have awkward ownership. So we switch to a user with the | ||
# same user and group IDs as source directory. We have to set a | ||
# few things up so that sudo works without complaining later on. | ||
uid=$(stat --format="%u" $WEAVE_SRC) | ||
gid=$(stat --format="%g" $WEAVE_SRC) | ||
echo "weave:x:$uid:$gid::$WEAVE_SRC:/bin/sh" >>/etc/passwd | ||
echo "weave:*:::::::" >>/etc/shadow | ||
echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers | ||
|
||
su weave -c "PATH=$PATH make -C $WEAVE_SRC BUILD_IN_CONTAINER=false $*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.