Skip to content

Commit e3bb13a

Browse files
Reorganize the OpenShift builds into three stages
* Base image - based on CentOS 7 and are the core for other images * Release image - a Git cross-platform compile environment that isolates external dependencies * Origin and other dependent images * Add useLocalImages to custom pod deployer The release build generates a set of tar archives containing the binaries for each platform. The origin image uses the binary from the release, without the Git environment. The remaining platform images are based on the origin image and do no builds of their own.
1 parent ec27d44 commit e3bb13a

Some content is hidden

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

49 files changed

+945
-510
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
*.swp
88
.vimrc
99
.vagrant-openshift.json
10+
.DS_Store

Dockerfile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
FROM google/golang
2-
MAINTAINER Jessica Forrester <[email protected]>
1+
#
2+
# This is the unofficial OpenShift Origin image for the DockerHub. It has as its
3+
# entrypoint the OpenShift all-in-one binary.
4+
#
5+
# See images/origin for the official release version of this image
6+
#
7+
# The standard name for this image is openshift/origin
8+
#
9+
FROM openshift/origin-base
10+
11+
RUN yum install -y golang && yum clean all
12+
13+
WORKDIR /go/src/github.com/openshift/origin
14+
ADD . /go/src/github.com/openshift/origin
15+
ENV GOPATH /go
16+
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
317

4-
WORKDIR /gopath/src/github.com/openshift/origin
5-
ADD . /gopath/src/github.com/openshift/origin
618
RUN go get github.com/openshift/origin && \
7-
hack/build-go.sh
19+
hack/build-go.sh && \
20+
cp _output/local/go/bin/* /usr/bin/
821

922
EXPOSE 8080
10-
ENTRYPOINT ["_output/go/bin/openshift"]
23+
ENTRYPOINT ["/usr/bin/openshift"]

HACKING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
Hacking on OpenShift
22
====================
33

4+
## Building a Release
5+
6+
To build an OpenShift release you run the `hack/build-release.sh` script on a system with Docker, which
7+
will create a build environment image and then execute a cross platform Go build within it. The build
8+
output will be copied to `_output/releases` as a set of tars containing each version. It will also build
9+
the `openshift/origin-base` image which is the common parent image for all OpenShift Docker images.
10+
11+
$ hack/build-release.sh
12+
13+
Once the release has been built the official Docker images can be generated with `hack/build-images.sh`.
14+
The resulting images can then be pushed to a Docker registry.
15+
16+
$ hack/build-images.sh
17+
18+
Note: To build the base and release images, run:
19+
20+
$ hack/build-base-images.sh
21+
22+
423
## Test Suites
524

625
OpenShift uses three levels of testing - unit tests, integration test, and end-to-end tests (much

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ Once setup, you can:
2828

2929
2. Start an OpenShift all-in-one server (includes everything you need to try OpenShift)
3030

31-
$ _output/go/bin/openshift start
31+
$ _output/local/go/bin/openshift start
3232

3333
3. In another terminal window, switch to the directory and start an app:
3434

3535
$ cd $GOPATH/src/github.com/openshift/origin
36-
$ _output/go/bin/openshift kube create pods -c examples/hello-openshift/hello-pod.json
36+
$ _output/local/go/bin/openshift kube create pods -c examples/hello-openshift/hello-pod.json
3737

3838
Once that's done, open a browser on your machine and open [http://localhost:6061](http://localhost:6061); you should see a 'Welcome to OpenShift' message.
3939

hack/before-install-assets.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/bin/bash
22

3-
set -e
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
46

57
# If we are running inside of Travis then do not run the rest of this
68
# script unless we want to TEST_ASSETS
7-
if [[ "${TRAVIS}" == "true" && "${TEST_ASSETS}" == "false" ]]; then
9+
if [[ "${TRAVIS-}" == "true" && "${TEST_ASSETS-}" == "false" ]]; then
810
exit
911
fi
1012

hack/build-api-docs-image.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
hackdir=$(CDPATH="" cd $(dirname $0); pwd)
7+
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8+
source "${OS_ROOT}/hack/common.sh"
89

9-
cd $hackdir/../api && docker build -t kubernetes/raml2html .
10+
cd "${OS_ROOT}/api"
11+
docker build -t kubernetes/raml2html .
1012
docker rm openshift3docgen &>/dev/null || :
1113
docker run --name=openshift3docgen kubernetes/raml2html
12-
docker cp openshift3docgen:/data/openshift3.html $hackdir/../api/
14+
docker cp openshift3docgen:/data/openshift3.html ${OS_ROOT}/api/
1315
docker rm openshift3docgen &>/dev/null || :

hack/build-assets.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/bin/bash
22

3-
set -e
3+
set -o errexit
4+
set -o nounset
5+
set -o pipefail
46

5-
hackdir=$(CDPATH="" cd $(dirname $0); pwd)
7+
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8+
source "${OS_ROOT}/hack/common.sh"
69

7-
pushd ${hackdir}/../assets > /dev/null
10+
pushd "${OS_ROOT}/assets" > /dev/null
811
bundle exec grunt build
912
popd > /dev/null
1013

11-
pushd ${hackdir}/../ > /dev/null
14+
pushd "${OS_ROOT}" > /dev/null
1215
Godeps/_workspace/bin/go-bindata -prefix "assets/dist" -pkg "assets" -o "pkg/assets/bindata.go" assets/dist/...
1316
popd > /dev/null

hack/build-base-images.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# This script builds the base and release images for use by the release build and image builds.
4+
#
5+
# Set OS_IMAGE_PUSH=true to push images to a registry
6+
#
7+
8+
set -o errexit
9+
set -o nounset
10+
set -o pipefail
11+
12+
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
13+
source "${OS_ROOT}/hack/common.sh"
14+
15+
# Go to the top of the tree.
16+
cd "${OS_ROOT}"
17+
18+
# Build the images
19+
docker build --tag openshift/origin-base "${OS_ROOT}/images/base"
20+
docker build --tag openshift/origin-haproxy-router-base "${OS_ROOT}/images/router/haproxy-base"
21+
docker build --tag openshift/origin-release "${OS_ROOT}/images/release"

hack/build-cross.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Build all cross compile targets and the base binaries
4+
5+
set -o errexit
6+
set -o nounset
7+
set -o pipefail
8+
9+
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
10+
source "${OS_ROOT}/hack/common.sh"
11+
12+
OS_BUILD_PLATFORMS=("${OS_COMPILE_PLATFORMS[@]}")
13+
os::build::build_binaries "${OS_COMPILE_TARGETS[@]}"
14+
15+
OS_BUILD_PLATFORMS=("${OS_CROSS_COMPILE_PLATFORMS[@]}")
16+
os::build::build_binaries "${OS_CROSS_COMPILE_TARGETS[@]}"
17+
18+
OS_RELEASE_ARCHIVES="${OS_OUTPUT}/releases"
19+
os::build::place_bins

hack/build-go.sh

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,8 @@ set -o errexit
66
set -o nounset
77
set -o pipefail
88

9-
hackdir=$(CDPATH="" cd $(dirname $0); pwd)
9+
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
10+
source "${OS_ROOT}/hack/common.sh"
1011

11-
# Set the environment variables required by the build.
12-
. "${hackdir}/config-go.sh"
13-
14-
# Go to the top of the tree.
15-
cd "${OS_REPO_ROOT}"
16-
17-
if [[ $# == 0 ]]; then
18-
# Update $@ with the default list of targets to build.
19-
set -- cmd/openshift cmd/openshift-router cmd/openshift-deploy
20-
fi
21-
22-
binaries=()
23-
for arg; do
24-
binaries+=("${OS_GO_PACKAGE}/${arg}")
25-
done
26-
27-
build_tags=""
28-
if [[ ! -z "$OS_BUILD_TAGS" ]]; then
29-
build_tags="-tags \"$OS_BUILD_TAGS\""
30-
fi
31-
32-
go install $build_tags -ldflags "$(os::build::ldflags)" "${binaries[@]}"
12+
os::build::build_binaries "$@"
13+
os::build::place_bins

0 commit comments

Comments
 (0)