Skip to content

Commit 5d33ce4

Browse files
committed
Rework hack/ and build/ directories.
* Rewrite a bunch of the hack/ directory with modular reusable bash libraries. * Have 'build/*' build on 'hack/*'. The stuff in build now just runs hack/* in a docker container. * Use a docker data container to enable faster incremental builds. * Standardize output to _output/{local,dockerized}/bin/OS/ARCH/*. This regularized placement makes cross compilation work. * Move travis specific scripts under hack/travis With new dockerized incremental builds, I can do a no-op `make quick-release` in ~30s. This is a significant improvement.
1 parent 203a3d0 commit 5d33ce4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1009
-793
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ network_closure.sh
3737
/third_party/pkg
3838

3939
# also ignore etcd installed by hack/install-etcd.sh
40-
/third_party/etcd
40+
/third_party/etcd*

.travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ go:
66

77
install:
88
- go get code.google.com/p/go.tools/cmd/cover
9-
- ./hack/install-etcd.sh
9+
- ./hack/travis/install-etcd.sh
1010
- ./hack/verify-gofmt.sh
1111
- ./hack/verify-boilerplate.sh
12-
- ./hack/install-std-race.sh
12+
- ./hack/travis/install-std-race.sh
1313
- ./hack/build-go.sh
1414
- go get ./contrib/podex
1515

1616
script:
1717
- KUBE_TIMEOUT='-timeout 60s' ./hack/test-go.sh
18-
- PATH=$HOME/gopath/bin:./third_party/etcd/bin:$PATH ./hack/test-cmd.sh
19-
- PATH=$HOME/gopath/bin:./third_party/etcd/bin:$PATH ./hack/test-integration.sh
18+
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-cmd.sh
19+
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-integration.sh
2020
- ./hack/benchmark-go.sh
2121

2222
notifications:

Makefile

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
OUT_DIR = _output
1010
GODEPS_PKG_DIR = Godeps/_workspace/pkg
1111

12-
export GOFLAGS
12+
KUBE_GOFLAGS = $(GOFLAGS)
13+
export KUBE_GOFLAGS
1314

1415
# Build code.
1516
#
@@ -49,7 +50,7 @@ check test:
4950
# make test_integration
5051
test_integration test_integ:
5152
hack/test-integration.sh
52-
.PHONY: integration
53+
.PHONY: test_integration test_integ
5354

5455
# Build and run end-to-end tests.
5556
#
@@ -94,10 +95,10 @@ release:
9495
.PHONY: release
9596

9697
# Build a release, but skip tests
97-
#
98+
#
9899
# Example:
99100
# make release-skip-tests
100-
release-skip-tests:
101+
release-skip-tests quick-release:
101102
KUBE_RELEASE_RUN_TESTS=n build/release.sh
102-
.PHONY: release-skip-tests
103+
.PHONY: release-skip-tests quick-release
103104

build/README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ There is also early support for building Docker "run" containers
1818

1919
## Key scripts
2020

21-
* `make-server.sh`: This will compile all of the Kubernetes server binaries for linux/amd64
22-
* `make-client.sh`: This will make all cross-compiled client binaries
23-
* `run-tests.sh`: This will run the Kubernetes unit tests
24-
* `run-integration.sh`: This will build and run the integration test
25-
* `copy-output.sh`: This will copy the contents of `_output/build` from any remote Docker container to the local `_output/build`. Right now this is only necessary on Mac OS X with `boot2docker`.
26-
* `make-clean.sh`: Clean out the contents of `_output/build` and remove any local built container images.
21+
* `run.sh`: Run a command in a build docker container. Common invocations:
22+
* `run.sh hack/build-go.sh`: Build just linux binaries in the container. Pass options and packages as necessary.
23+
* `run.sh hack/build-cross.sh`: Build all binaries for all platforms
24+
* `run.sh hack/test-go.sh`: Run all unit tests
25+
* `run.sh hack/test-integration.sh`: Run integration test
26+
* `copy-output.sh`: This will copy the contents of `_output/dockerized/bin` from any remote Docker container to the local `_output/dockerized/bin`. Right now this is only necessary on Mac OS X with `boot2docker` when your git repo isn't under `/Users`.
27+
* `make-clean.sh`: Clean out the contents of `_output/dockerized` and remove any local built container images.
2728
* `shell.sh`: Drop into a `bash` shell in a build container with a snapshot of the current repo code.
2829
* `release.sh`: Build everything, test it, and (optionally) upload the results to a GCS bucket.
2930

@@ -81,10 +82,10 @@ If the release script is set to upload to GCS, it'll do the following:
8182

8283
These are in no particular order
8384

84-
* [ ] Harmonize with scripts in `hack/`. How much do we support building outside of Docker and these scripts?
85+
* [X] Harmonize with scripts in `hack/`. How much do we support building outside of Docker and these scripts?
8586
* [ ] Get a cluster up and running with the Docker images. Perhaps start with a local cluster and move up to a GCE cluster.
8687
* [ ] Implement (#186)[https://github.com/GoogleCloudPlatform/kubernetes/issues/186]. This will make it easier to develop Kubernetes.
87-
* [ ] Deprecate/replace most of the stuff in the hack/
88+
* [X] Deprecate/replace most of the stuff in the hack/
8889
* [ ] Create an install script that'll let us do a `curl https://[URL] | bash` to get that tarball down and ensure that other dependencies (cloud SDK?) are installed and configured correctly.
8990
* [ ] Support/test Windows as a client.
9091
* [ ] Finish support for the Dockerized runtime. Issue (#19)[https://github.com/GoogleCloudPlatform/kubernetes/issues/19]. A key issue here is to make this fast/light enough that we can use it for development workflows.

build/build-image/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ ENV GOARCH amd64
2525
# Get the code coverage tool and godep
2626
RUN go get code.google.com/p/go.tools/cmd/cover github.com/tools/godep
2727

28+
# We use rsync to copy some binaries around. It is faster (0.3s vs. 1.1s) on my
29+
# machine vs. `install`
30+
RUN apt-get update && apt-get install -y rsync
31+
2832
# Download and symlink etcd. We need this for our integration tests.
2933
RUN mkdir -p /usr/local/src/etcd &&\
3034
cd /usr/local/src/etcd &&\
@@ -39,6 +43,10 @@ WORKDIR /go/src/github.com/GoogleCloudPlatform/kubernetes
3943

4044
# Propagate the git tree version into the build image
4145
ADD kube-version-defs /kube-version-defs
46+
ENV KUBE_GIT_VERSION_FILE /kube-version-defs
47+
48+
# Make output from the dockerized build go someplace else
49+
ENV KUBE_OUTPUT_SUBPATH _output/dockerized
4250

4351
# Upload Kubernetes source
4452
ADD kube-source.tar.gz /go/src/github.com/GoogleCloudPlatform/kubernetes

build/build-image/common.sh

-81
This file was deleted.

build/build-image/make-client.sh

-39
This file was deleted.

build/build-image/make-server.sh

-29
This file was deleted.

0 commit comments

Comments
 (0)