Skip to content

Commit

Permalink
Cleanup etcd install
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Aug 23, 2015
1 parent 5027740 commit bedefb3
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/_output
/_tools
/openshift.local.*
/.project
/.vagrant
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
- TEST_ASSETS=false

install:
- export PATH=$GOPATH/bin:./third_party/etcd:$PATH
- export PATH=$GOPATH/bin:./_tools/etcd/bin:$PATH
- make install-travis

script:
Expand Down
44 changes: 27 additions & 17 deletions hack/install-etcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,39 @@

set -e

OS_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${OS_ROOT}/hack/common.sh"
set -o errexit
set -o nounset
set -o pipefail

mkdir -p "${OS_ROOT}/_output"
cd "${OS_ROOT}/_output"
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${OS_ROOT}/hack/util.sh"
os::log::install_errexit

if [ -d etcd ]; then
pushd etcd >/dev/null
./build
popd >/dev/null
exit
fi
etcd_version=$(go run ${OS_ROOT}/hack/version.go ${OS_ROOT}/Godeps/Godeps.json github.com/coreos/etcd/etcdserver)

etcd_version=$(go run ${OS_ROOT}/hack/version.go ${OS_ROOT}/Godeps/Godeps.json \
github.com/coreos/etcd/etcdserver)
mkdir -p "${OS_ROOT}/_tools"
cd "${OS_ROOT}/_tools"

mkdir -p etcd && cd etcd
if [ ! -d etcd ]; then
mkdir -p etcd
pushd etcd >/dev/null

curl -s -L https://github.com/coreos/etcd/tarball/${etcd_version} | \
tar xz --strip-components 1 2>/dev/null
curl -s -L https://github.com/coreos/etcd/tarball/${etcd_version} | \
tar xz --strip-components 1 2>/dev/null

if [ "$?" != "0" ]; then
echo "Failed to download coreos/etcd." && exit 1
if [ "$?" != "0" ]; then
echo "Failed to download coreos/etcd."
exit 1
fi
else
pushd etcd >/dev/null
fi

./build

echo
echo Installed coreos/etcd ${etcd_version} into:
echo export PATH=$(pwd):\$PATH

popd >/dev/null
exit 0
9 changes: 4 additions & 5 deletions hack/test-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ find_test_dirs() {
find . -not \( \
\( \
-wholename './Godeps' \
-o -wholename './release' \
-o -wholename './target' \
-o -wholename '*/Godeps/*' \
-o -wholename '*/_output/*' \
-o -wholename './_output' \
-o -wholename './_tools' \
-o -wholename './.git' \
-o -wholename './assets/node_modules' \
-o -wholename './openshift.local.*' \
-o -wholename '*/Godeps/*' \
-o -wholename './assets/node_modules' \
-o -wholename './test/extended' \
\) -prune \
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sort -u | xargs -n1 printf "${OS_GO_PACKAGE}/%s\n"
Expand Down
2 changes: 1 addition & 1 deletion hack/test-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ tags="${OS_TEST_TAGS:-integration !docker etcd}"

export GOMAXPROCS="$(grep "processor" -c /proc/cpuinfo 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || 1)"
TMPDIR=${TMPDIR:-/tmp}
export BASETMPDIR=${BASETMPDIR:-"${TMPDIR}/openshift-integration"}
export BASETMPDIR=${BASETMPDIR:-${TMPDIR}/openshift-integration}

echo
echo "Test ${package} -tags='${tags}' ..."
Expand Down
15 changes: 8 additions & 7 deletions hack/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,11 @@ function start_etcd {
set +e

if [ "$(which etcd)" == "" ]; then
echo "etcd must be in your PATH"
exit 1
if [[ ! -f ${OS_ROOT}/_tools/etcd/bin/etcd ]]; then
echo "etcd must be in your PATH or installed in _tools/etcd/bin/ with hack/install-etcd.sh"
exit 1
fi
export PATH="${OS_ROOT}/_tools/etcd/bin:$PATH"
fi

running_etcd=$(ps -ef | grep etcd | grep -c name)
Expand Down Expand Up @@ -527,14 +530,12 @@ os::log::status() {
find_files() {
find . -not \( \
\( \
-wholename './output' \
-o -wholename './_output' \
-wholename './_output' \
-o -wholename './_tools' \
-o -wholename './.*' \
-o -wholename './release' \
-o -wholename './pkg/assets/bindata.go' \
-o -wholename './pkg/assets/*/bindata.go' \
-o -wholename './target' \
-o -wholename '*/third_party/*' \
-o -wholename './openshift.local.*' \
-o -wholename '*/Godeps/*' \
\) -prune \
\) -name '*.go' | sort -u
Expand Down

0 comments on commit bedefb3

Please sign in to comment.