| ... | ... |
@@ -8,14 +8,11 @@ env: |
| 8 | 8 |
- TEST_ASSETS=false |
| 9 | 9 |
|
| 10 | 10 |
install: |
| 11 |
- - ./hack/verify-jsonformat.sh |
|
| 12 |
- - ./hack/install-etcd.sh |
|
| 13 |
- - ./hack/install-std-race.sh |
|
| 14 |
- - ./hack/install-tools.sh |
|
| 15 |
- - ./hack/build-go.sh |
|
| 16 |
- - ./hack/install-assets.sh |
|
| 11 |
+ - export PATH=$GOPATH/bin:./_tools/etcd/bin:$PATH |
|
| 12 |
+ - make install-travis |
|
| 17 | 13 |
|
| 18 |
-script: ./hack/test-assets.sh && export TRAVIS_TEST=true && PATH=$HOME/gopath/bin:./_output/etcd/bin:$PATH make check-test WHAT="''" TESTFLAGS="-p=4" |
|
| 14 |
+script: |
|
| 15 |
+ - make check-test TESTFLAGS="-p=4" TESTS="''" # empty quotes are because hack/test-go.sh requires 2 args |
|
| 19 | 16 |
|
| 20 | 17 |
notifications: |
| 21 | 18 |
irc: "chat.freenode.net#openshift-dev" |
| ... | ... |
@@ -47,18 +47,11 @@ check: |
| 47 | 47 |
TEST_KUBE=1 hack/test-go.sh $(WHAT) $(TESTS) $(TESTFLAGS) |
| 48 | 48 |
.PHONY: check |
| 49 | 49 |
|
| 50 |
-# Build and run unit and integration tests that don't require Docker. |
|
| 51 |
-# |
|
| 52 |
-# Args: |
|
| 53 |
-# GOFLAGS: Extra flags to pass to 'go' when building. |
|
| 54 |
-# TESTFLAGS: Extra flags that should only be passed to hack/test-go.sh |
|
| 50 |
+# Verify code is properly organized. |
|
| 55 | 51 |
# |
| 56 | 52 |
# Example: |
| 57 |
-# make check-test |
|
| 58 |
-check-test: export KUBE_COVER= -cover -covermode=atomic |
|
| 59 |
-check-test: export KUBE_RACE= -race |
|
| 60 |
-check-test: build check |
|
| 61 |
-check-test: |
|
| 53 |
+# make verify |
|
| 54 |
+verify: build |
|
| 62 | 55 |
hack/verify-gofmt.sh |
| 63 | 56 |
hack/verify-govet.sh |
| 64 | 57 |
hack/verify-generated-deep-copies.sh |
| ... | ... |
@@ -67,8 +60,41 @@ check-test: |
| 67 | 67 |
hack/verify-generated-docs.sh |
| 68 | 68 |
hack/verify-generated-swagger-spec.sh |
| 69 | 69 |
hack/verify-api-descriptions.sh |
| 70 |
+.PHONY: verify |
|
| 71 |
+ |
|
| 72 |
+# Install travis dependencies |
|
| 73 |
+# |
|
| 74 |
+# Args: |
|
| 75 |
+# TEST_ASSETS: Instead of running tests, test assets only. |
|
| 76 |
+ifeq ($(TEST_ASSETS), true) |
|
| 77 |
+install-travis: |
|
| 78 |
+ hack/install-assets.sh |
|
| 79 |
+else |
|
| 80 |
+install-travis: |
|
| 81 |
+ hack/install-etcd.sh |
|
| 82 |
+ hack/install-tools.sh |
|
| 83 |
+endif |
|
| 84 |
+.PHONY: install-travis |
|
| 85 |
+ |
|
| 86 |
+# Run unit and integration tests that don't require Docker. |
|
| 87 |
+# |
|
| 88 |
+# Args: |
|
| 89 |
+# GOFLAGS: Extra flags to pass to 'go' when building. |
|
| 90 |
+# TESTFLAGS: Extra flags that should only be passed to hack/test-go.sh |
|
| 91 |
+# TEST_ASSETS: Instead of running tests, test assets only. |
|
| 92 |
+# |
|
| 93 |
+# Example: |
|
| 94 |
+# make check-test |
|
| 95 |
+check-test: export KUBE_COVER= -cover -covermode=atomic |
|
| 96 |
+check-test: export KUBE_RACE= -race |
|
| 97 |
+ifeq ($(TEST_ASSETS), true) |
|
| 98 |
+check-test: |
|
| 99 |
+ hack/test-assets.sh |
|
| 100 |
+else |
|
| 101 |
+check-test: verify check |
|
| 70 | 102 |
hack/test-cmd.sh |
| 71 | 103 |
KUBE_RACE=" " hack/test-integration.sh |
| 104 |
+endif |
|
| 72 | 105 |
.PHONY: check-test |
| 73 | 106 |
|
| 74 | 107 |
# Build and run the complete test-suite. |
| ... | ... |
@@ -84,19 +110,11 @@ test: export KUBE_COVER= -cover -covermode=atomic |
| 84 | 84 |
test: export KUBE_RACE= -race |
| 85 | 85 |
ifeq ($(SKIP_BUILD), true) |
| 86 | 86 |
$(info build is being skipped) |
| 87 |
-test: check |
|
| 87 |
+test: check verify |
|
| 88 | 88 |
else |
| 89 |
-test: build check |
|
| 89 |
+test: build check verify |
|
| 90 | 90 |
endif |
| 91 | 91 |
test: |
| 92 |
- hack/verify-gofmt.sh |
|
| 93 |
- hack/verify-govet.sh |
|
| 94 |
- hack/verify-generated-deep-copies.sh |
|
| 95 |
- hack/verify-generated-conversions.sh |
|
| 96 |
- hack/verify-generated-completions.sh |
|
| 97 |
- hack/verify-generated-docs.sh |
|
| 98 |
- hack/verify-generated-swagger-spec.sh |
|
| 99 |
- hack/verify-api-descriptions.sh |
|
| 100 | 92 |
hack/test-cmd.sh |
| 101 | 93 |
KUBE_RACE=" " hack/test-integration-docker.sh |
| 102 | 94 |
hack/test-end-to-end-docker.sh |
| ... | ... |
@@ -2,29 +2,39 @@ |
| 2 | 2 |
|
| 3 | 3 |
set -e |
| 4 | 4 |
|
| 5 |
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
| 6 |
-source "${OS_ROOT}/hack/common.sh"
|
|
| 5 |
+set -o errexit |
|
| 6 |
+set -o nounset |
|
| 7 |
+set -o pipefail |
|
| 7 | 8 |
|
| 8 |
-mkdir -p "${OS_ROOT}/_output"
|
|
| 9 |
-cd "${OS_ROOT}/_output"
|
|
| 9 |
+OS_ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
| 10 |
+source "${OS_ROOT}/hack/util.sh"
|
|
| 11 |
+os::log::install_errexit |
|
| 10 | 12 |
|
| 11 |
-if [ -d etcd ]; then |
|
| 12 |
- pushd etcd >/dev/null |
|
| 13 |
- ./build |
|
| 14 |
- popd >/dev/null |
|
| 15 |
- exit |
|
| 16 |
-fi |
|
| 13 |
+etcd_version=$(go run ${OS_ROOT}/hack/version.go ${OS_ROOT}/Godeps/Godeps.json github.com/coreos/etcd/etcdserver)
|
|
| 17 | 14 |
|
| 18 |
-etcd_version=$(go run ${OS_ROOT}/hack/version.go ${OS_ROOT}/Godeps/Godeps.json \
|
|
| 19 |
- github.com/coreos/etcd/etcdserver) |
|
| 15 |
+mkdir -p "${OS_ROOT}/_tools"
|
|
| 16 |
+cd "${OS_ROOT}/_tools"
|
|
| 20 | 17 |
|
| 21 |
-mkdir -p etcd && cd etcd |
|
| 18 |
+if [ ! -d etcd ]; then |
|
| 19 |
+ mkdir -p etcd |
|
| 20 |
+ pushd etcd >/dev/null |
|
| 22 | 21 |
|
| 23 |
-curl -s -L https://github.com/coreos/etcd/tarball/${etcd_version} | \
|
|
| 24 |
- tar xz --strip-components 1 2>/dev/null |
|
| 22 |
+ curl -s -L https://github.com/coreos/etcd/tarball/${etcd_version} | \
|
|
| 23 |
+ tar xz --strip-components 1 2>/dev/null |
|
| 25 | 24 |
|
| 26 |
-if [ "$?" != "0" ]; then |
|
| 27 |
- echo "Failed to download coreos/etcd." && exit 1 |
|
| 25 |
+ if [ "$?" != "0" ]; then |
|
| 26 |
+ echo "Failed to download coreos/etcd." |
|
| 27 |
+ exit 1 |
|
| 28 |
+ fi |
|
| 29 |
+else |
|
| 30 |
+ pushd etcd >/dev/null |
|
| 28 | 31 |
fi |
| 29 | 32 |
|
| 30 | 33 |
./build |
| 34 |
+ |
|
| 35 |
+echo |
|
| 36 |
+echo Installed coreos/etcd ${etcd_version} into:
|
|
| 37 |
+echo export PATH=$(pwd):\$PATH |
|
| 38 |
+ |
|
| 39 |
+popd >/dev/null |
|
| 40 |
+exit 0 |
|
| 31 | 41 |
\ No newline at end of file |
| ... | ... |
@@ -23,13 +23,12 @@ find_test_dirs() {
|
| 23 | 23 |
find . -not \( \ |
| 24 | 24 |
\( \ |
| 25 | 25 |
-wholename './Godeps' \ |
| 26 |
- -o -wholename './release' \ |
|
| 27 |
- -o -wholename './target' \ |
|
| 28 |
- -o -wholename '*/Godeps/*' \ |
|
| 29 |
- -o -wholename '*/_output/*' \ |
|
| 26 |
+ -o -wholename './_output' \ |
|
| 27 |
+ -o -wholename './_tools' \ |
|
| 30 | 28 |
-o -wholename './.git' \ |
| 31 |
- -o -wholename './assets/node_modules' \ |
|
| 32 | 29 |
-o -wholename './openshift.local.*' \ |
| 30 |
+ -o -wholename '*/Godeps/*' \ |
|
| 31 |
+ -o -wholename './assets/node_modules' \ |
|
| 33 | 32 |
-o -wholename './test/extended' \ |
| 34 | 33 |
\) -prune \ |
| 35 | 34 |
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sort -u | xargs -n1 printf "${OS_GO_PACKAGE}/%s\n"
|
| ... | ... |
@@ -28,7 +28,7 @@ tags="${OS_TEST_TAGS:-integration !docker etcd}"
|
| 28 | 28 |
|
| 29 | 29 |
export GOMAXPROCS="$(grep "processor" -c /proc/cpuinfo 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || 1)" |
| 30 | 30 |
TMPDIR=${TMPDIR:-/tmp}
|
| 31 |
-export BASETMPDIR=${BASETMPDIR:-"${TMPDIR}/openshift-integration"}
|
|
| 31 |
+export BASETMPDIR=${BASETMPDIR:-${TMPDIR}/openshift-integration}
|
|
| 32 | 32 |
|
| 33 | 33 |
echo |
| 34 | 34 |
echo "Test ${package} -tags='${tags}' ..."
|
| ... | ... |
@@ -9,6 +9,12 @@ set -o pipefail |
| 9 | 9 |
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
|
| 10 | 10 |
source "${OS_ROOT}/hack/common.sh"
|
| 11 | 11 |
|
| 12 |
+platform="$(os::build::host_platform)" |
|
| 13 |
+if [[ "${platform}" != "linux/amd64" ]]; then
|
|
| 14 |
+ echo "WARNING: Completions cannot be updated on non-Linux systems (${platform}) due to static link dependencies"
|
|
| 15 |
+ exit 1 |
|
| 16 |
+fi |
|
| 17 |
+ |
|
| 12 | 18 |
"${OS_ROOT}/hack/build-go.sh" cmd/genbashcomp
|
| 13 | 19 |
|
| 14 | 20 |
# Find binary |
| ... | ... |
@@ -43,9 +43,17 @@ SWAGGER_API_PATH="${HOST}/swaggerapi/"
|
| 43 | 43 |
# Prevent user environment from colliding with the test setup |
| 44 | 44 |
unset KUBECONFIG |
| 45 | 45 |
|
| 46 |
-# set path so OpenShift is available |
|
| 47 |
-GO_OUT="${OS_ROOT}/_output/local/go/bin"
|
|
| 48 |
-export PATH="${GO_OUT}:${PATH}"
|
|
| 46 |
+openshift=$(cd "${OS_ROOT}"; echo "$(pwd)/_output/local/go/bin/openshift")
|
|
| 47 |
+ |
|
| 48 |
+if [[ ! -e "${openshift}" ]]; then
|
|
| 49 |
+ {
|
|
| 50 |
+ echo "It looks as if you don't have a compiled openshift binary" |
|
| 51 |
+ echo |
|
| 52 |
+ echo "If you are running from a clone of the git repo, please run" |
|
| 53 |
+ echo "'./hack/build-go.sh'." |
|
| 54 |
+ } >&2 |
|
| 55 |
+ exit 1 |
|
| 56 |
+fi |
|
| 49 | 57 |
|
| 50 | 58 |
# create temp dir |
| 51 | 59 |
TEMP_DIR=${USE_TEMP:-$(mktemp -d /tmp/openshift-cmd.XXXX)}
|
| ... | ... |
@@ -54,7 +62,7 @@ export CURL_CA_BUNDLE="${TEMP_DIR}/openshift.local.config/master/ca.crt"
|
| 54 | 54 |
# Start openshift |
| 55 | 55 |
echo "Starting OpenShift..." |
| 56 | 56 |
pushd "${TEMP_DIR}" > /dev/null
|
| 57 |
-OPENSHIFT_ON_PANIC=crash openshift start master --listen="https://0.0.0.0:8443" --master="https://127.0.0.1:8443" &> /dev/null & |
|
| 57 |
+OPENSHIFT_ON_PANIC=crash "${openshift}" start master --master="https://127.0.0.1:8443" >/dev/null 2>&1 &
|
|
| 58 | 58 |
OS_PID=$! |
| 59 | 59 |
popd > /dev/null |
| 60 | 60 |
|
| ... | ... |
@@ -65,11 +73,11 @@ echo "Updating ${SWAGGER_SPEC_OUT_DIR}:"
|
| 65 | 65 |
ENDPOINT_TYPES="oapi api" |
| 66 | 66 |
for type in $ENDPOINT_TYPES |
| 67 | 67 |
do |
| 68 |
- ENDPOINTS=$(curl "${HOST}" | grep -Po "(?<=\/${type}\/)[a-z0-9]+" | sed '/v1beta3/d')
|
|
| 68 |
+ ENDPOINTS=(v1) |
|
| 69 | 69 |
for endpoint in $ENDPOINTS |
| 70 | 70 |
do |
| 71 | 71 |
echo "Updating ${SWAGGER_SPEC_OUT_DIR}/${type}-${endpoint}.json from ${SWAGGER_API_PATH}${type}/${endpoint}..."
|
| 72 |
- curl "${SWAGGER_API_PATH}${type}/${endpoint}" > "${SWAGGER_SPEC_OUT_DIR}/${type}-${endpoint}.json"
|
|
| 72 |
+ curl -w "\n" "${SWAGGER_API_PATH}${type}/${endpoint}" > "${SWAGGER_SPEC_OUT_DIR}/${type}-${endpoint}.json"
|
|
| 73 | 73 |
done |
| 74 | 74 |
done |
| 75 | 75 |
echo "SUCCESS" |
| ... | ... |
@@ -5,10 +5,9 @@ |
| 5 | 5 |
TIME_SEC=1000 |
| 6 | 6 |
TIME_MIN=$((60 * $TIME_SEC)) |
| 7 | 7 |
|
| 8 |
-# setup_env_vars exports all the necessary environment variables for configuring and |
|
| 8 |
+# setup_env_vars exports all the necessary environment variables for configuring and |
|
| 9 | 9 |
# starting OS server. |
| 10 | 10 |
function setup_env_vars {
|
| 11 |
- export TRAVIS_TEST="${TRAVIS_TEST:-false}"
|
|
| 12 | 11 |
export ETCD_DATA_DIR="${BASETMPDIR}/etcd"
|
| 13 | 12 |
export VOLUME_DIR="${BASETMPDIR}/volumes"
|
| 14 | 13 |
export FAKE_HOME_DIR="${BASETMPDIR}/openshift.local.home"
|
| ... | ... |
@@ -324,8 +323,11 @@ function start_etcd {
|
| 324 | 324 |
set +e |
| 325 | 325 |
|
| 326 | 326 |
if [ "$(which etcd)" == "" ]; then |
| 327 |
- echo "etcd must be in your PATH" |
|
| 328 |
- exit 1 |
|
| 327 |
+ if [[ ! -f ${OS_ROOT}/_tools/etcd/bin/etcd ]]; then
|
|
| 328 |
+ echo "etcd must be in your PATH or installed in _tools/etcd/bin/ with hack/install-etcd.sh" |
|
| 329 |
+ exit 1 |
|
| 330 |
+ fi |
|
| 331 |
+ export PATH="${OS_ROOT}/_tools/etcd/bin:$PATH"
|
|
| 329 | 332 |
fi |
| 330 | 333 |
|
| 331 | 334 |
running_etcd=$(ps -ef | grep etcd | grep -c name) |
| ... | ... |
@@ -683,14 +685,12 @@ os::log::status() {
|
| 683 | 683 |
find_files() {
|
| 684 | 684 |
find . -not \( \ |
| 685 | 685 |
\( \ |
| 686 |
- -wholename './output' \ |
|
| 687 |
- -o -wholename './_output' \ |
|
| 686 |
+ -wholename './_output' \ |
|
| 687 |
+ -o -wholename './_tools' \ |
|
| 688 | 688 |
-o -wholename './.*' \ |
| 689 |
- -o -wholename './release' \ |
|
| 690 | 689 |
-o -wholename './pkg/assets/bindata.go' \ |
| 691 | 690 |
-o -wholename './pkg/assets/*/bindata.go' \ |
| 692 |
- -o -wholename './target' \ |
|
| 693 |
- -o -wholename '*/third_party/*' \ |
|
| 691 |
+ -o -wholename './openshift.local.*' \ |
|
| 694 | 692 |
-o -wholename '*/Godeps/*' \ |
| 695 | 693 |
\) -prune \ |
| 696 | 694 |
\) -name '*.go' | sort -u |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
-set -e |
|
| 3 |
+set -o errexit |
|
| 4 | 4 |
set -o nounset |
| 5 | 5 |
set -o pipefail |
| 6 | 6 |
|
| ... | ... |
@@ -11,9 +11,15 @@ cd "${OS_ROOT}"
|
| 11 | 11 |
|
| 12 | 12 |
echo "===== Verifying Generated Completions =====" |
| 13 | 13 |
|
| 14 |
+platform="$(os::build::host_platform)" |
|
| 15 |
+if [[ "${platform}" != "linux/amd64" ]]; then
|
|
| 16 |
+ echo "WARNING: Completions cannot be verified on non-Linux systems (${platform})"
|
|
| 17 |
+ exit 0 |
|
| 18 |
+fi |
|
| 19 |
+ |
|
| 14 | 20 |
COMPLETION_ROOT_REL="rel-eng/completions" |
| 15 | 21 |
COMPLETION_ROOT="${OS_ROOT}/${COMPLETION_ROOT_REL}"
|
| 16 |
-TMP_COMPLETION_ROOT_REL="_tmp/verify-generated-completions/" |
|
| 22 |
+TMP_COMPLETION_ROOT_REL="_output/verify-generated-completions/" |
|
| 17 | 23 |
TMP_COMPLETION_ROOT="${OS_ROOT}/${TMP_COMPLETION_ROOT_REL}/${COMPLETION_ROOT_REL}"
|
| 18 | 24 |
|
| 19 | 25 |
echo "Generating fresh completions..." |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
-set -e |
|
| 3 |
+set -o errexit |
|
| 4 | 4 |
set -o nounset |
| 5 | 5 |
set -o pipefail |
| 6 | 6 |
|
| ... | ... |
@@ -34,7 +34,7 @@ fi |
| 34 | 34 |
|
| 35 | 35 |
APIROOT_REL="pkg/api" |
| 36 | 36 |
APIROOT="${OS_ROOT}/${APIROOT_REL}"
|
| 37 |
-TMP_APIROOT_REL="_tmp/verify-generated-conversions" |
|
| 37 |
+TMP_APIROOT_REL="_output/verify-generated-conversions" |
|
| 38 | 38 |
TMP_APIROOT="${OS_ROOT}/${TMP_APIROOT_REL}/${APIROOT_REL}"
|
| 39 | 39 |
|
| 40 | 40 |
echo "Generating fresh conversions..." |
| ... | ... |
@@ -45,7 +45,7 @@ then |
| 45 | 45 |
exit 1 |
| 46 | 46 |
fi |
| 47 | 47 |
|
| 48 |
-cp -au "${APIROOT}" "${TMP_APIROOT}/.."
|
|
| 48 |
+rsync -au "${APIROOT}" "${TMP_APIROOT}/.."
|
|
| 49 | 49 |
|
| 50 | 50 |
echo "Diffing current conversions against freshly generated conversions..." |
| 51 | 51 |
ret=0 |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
-set -e |
|
| 3 |
+set -o errexit |
|
| 4 | 4 |
set -o nounset |
| 5 | 5 |
set -o pipefail |
| 6 | 6 |
|
| ... | ... |
@@ -34,7 +34,7 @@ fi |
| 34 | 34 |
|
| 35 | 35 |
APIROOT_REL="pkg/api" |
| 36 | 36 |
APIROOT="${OS_ROOT}/${APIROOT_REL}"
|
| 37 |
-TMP_APIROOT_REL="_tmp/verify-generated-deep-copies" |
|
| 37 |
+TMP_APIROOT_REL="_output/verify-generated-deep-copies" |
|
| 38 | 38 |
TMP_APIROOT="${OS_ROOT}/${TMP_APIROOT_REL}/${APIROOT_REL}"
|
| 39 | 39 |
|
| 40 | 40 |
echo "Generating fresh deep copies..." |
| ... | ... |
@@ -45,7 +45,7 @@ then |
| 45 | 45 |
exit 1 |
| 46 | 46 |
fi |
| 47 | 47 |
|
| 48 |
-cp -au "${APIROOT}" "${TMP_APIROOT}/.."
|
|
| 48 |
+rsync -au "${APIROOT}" "${TMP_APIROOT}/.."
|
|
| 49 | 49 |
|
| 50 | 50 |
echo "Diffing current deep copies against freshly generated deep copies..." |
| 51 | 51 |
ret=0 |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
-set -e |
|
| 3 |
+set -o errexit |
|
| 4 | 4 |
set -o nounset |
| 5 | 5 |
set -o pipefail |
| 6 | 6 |
|
| ... | ... |
@@ -13,7 +13,7 @@ echo "===== Verifying Generated Docs =====" |
| 13 | 13 |
|
| 14 | 14 |
GENERATED_DOCS_ROOT_REL="docs/generated" |
| 15 | 15 |
GENERATED_DOCS_ROOT="${OS_ROOT}/${GENERATED_DOCS_ROOT_REL}"
|
| 16 |
-TMP_GENERATED_DOCS_ROOT_REL="_tmp/verify-generated-docs" |
|
| 16 |
+TMP_GENERATED_DOCS_ROOT_REL="_output/verify-generated-docs" |
|
| 17 | 17 |
TMP_GENERATED_DOCS_ROOT="${OS_ROOT}/${TMP_GENERATED_DOCS_ROOT_REL}/${GENERATED_DOCS_ROOT_REL}"
|
| 18 | 18 |
|
| 19 | 19 |
echo "Generating fresh docs..." |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
#!/bin/bash |
| 2 | 2 |
|
| 3 |
-set -e |
|
| 3 |
+set -o errexit |
|
| 4 | 4 |
set -o nounset |
| 5 | 5 |
set -o pipefail |
| 6 | 6 |
|
| ... | ... |
@@ -9,11 +9,11 @@ source "${OS_ROOT}/hack/common.sh"
|
| 9 | 9 |
|
| 10 | 10 |
cd "${OS_ROOT}"
|
| 11 | 11 |
|
| 12 |
-echo "===== Verifying Swagger Spec =====" |
|
| 12 |
+echo "===== Verifying API Swagger Spec =====" |
|
| 13 | 13 |
|
| 14 | 14 |
SPECROOT_REL="api/swagger-spec" |
| 15 | 15 |
SPECROOT="${OS_ROOT}/${SPECROOT_REL}"
|
| 16 |
-REL_TMP_PATH="_tmp/verify-generated-swagger-spec" |
|
| 16 |
+REL_TMP_PATH="_output/verify-generated-swagger-spec" |
|
| 17 | 17 |
TMP_SPECROOT="${OS_ROOT}/${REL_TMP_PATH}/${SPECROOT_REL}"
|
| 18 | 18 |
|
| 19 | 19 |
echo "Generating a fresh spec..." |
| ... | ... |
@@ -21,6 +21,7 @@ if ! output=`${OS_ROOT}/hack/update-generated-swagger-spec.sh ${REL_TMP_PATH} 2>
|
| 21 | 21 |
then |
| 22 | 22 |
echo "FAILURE: Generation of fresh spec failed:" |
| 23 | 23 |
echo "$output" |
| 24 |
+ exit 1 |
|
| 24 | 25 |
fi |
| 25 | 26 |
|
| 26 | 27 |
echo "Diffing current spec against freshly generated spec..." |
| ... | ... |
@@ -18,7 +18,7 @@ cd "${OS_ROOT}"
|
| 18 | 18 |
mkdir -p _output/govet |
| 19 | 19 |
|
| 20 | 20 |
FAILURE=false |
| 21 |
-test_dirs=$(find_files | cut --delimiter=/ --fields=1-2 | sort -u) |
|
| 21 |
+test_dirs=$(find_files | cut -d '/' -f 1-2 | sort -u) |
|
| 22 | 22 |
for test_dir in $test_dirs |
| 23 | 23 |
do |
| 24 | 24 |
go tool vet -shadow=false \ |
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"github.com/golang/glog" |
| 8 | 8 |
"github.com/spf13/cobra" |
| 9 | 9 |
kclient "k8s.io/kubernetes/pkg/client" |
| 10 |
+ cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" |
|
| 10 | 11 |
|
| 11 | 12 |
osclient "github.com/openshift/origin/pkg/client" |
| 12 | 13 |
"github.com/openshift/origin/pkg/cmd/util/clientcmd" |
| ... | ... |
@@ -23,7 +24,7 @@ func NewCmdValidateToken(f *clientcmd.Factory) *cobra.Command {
|
| 23 | 23 |
|
| 24 | 24 |
clientCfg, err := f.OpenShiftClientConfig.ClientConfig() |
| 25 | 25 |
if err != nil {
|
| 26 |
- fmt.Errorf("%v\n", err)
|
|
| 26 |
+ cmdutil.CheckErr(fmt.Errorf("%v", err))
|
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
validateToken(tokenValue, clientCfg) |
| ... | ... |
@@ -76,9 +77,9 @@ func getTokenInfo(token string, osClient *osclient.Client) (string, *osintypes.I |
| 76 | 76 |
} |
| 77 | 77 |
body, err := osResult.Raw() |
| 78 | 78 |
if err != nil {
|
| 79 |
- return "", nil, fmt.Errorf("Error reading info response: %v\n", err)
|
|
| 79 |
+ return "", nil, fmt.Errorf("Error reading info response: %v", err)
|
|
| 80 | 80 |
} |
| 81 |
- glog.V(1).Infof("Raw JSON: %v\n", string(body))
|
|
| 81 |
+ glog.V(1).Infof("Raw JSON: %s", string(body))
|
|
| 82 | 82 |
|
| 83 | 83 |
var accessData osintypes.InfoResponseData |
| 84 | 84 |
err = json.Unmarshal(body, &accessData) |
| ... | ... |
@@ -86,10 +87,10 @@ func getTokenInfo(token string, osClient *osclient.Client) (string, *osintypes.I |
| 86 | 86 |
return "", nil, fmt.Errorf("Error while unmarshalling info response: %v %v", err, string(body))
|
| 87 | 87 |
} |
| 88 | 88 |
if accessData.Error == "invalid_request" {
|
| 89 |
- return "", nil, fmt.Errorf("\"%v\" is not a valid token.\n", token)
|
|
| 89 |
+ return "", nil, fmt.Errorf("%q is not a valid token.", token)
|
|
| 90 | 90 |
} |
| 91 | 91 |
if len(accessData.ErrorDescription) != 0 {
|
| 92 |
- return "", nil, fmt.Errorf("%v\n", accessData.ErrorDescription)
|
|
| 92 |
+ return "", nil, fmt.Errorf("%s", accessData.ErrorDescription)
|
|
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 | 95 |
return string(body), &accessData, nil |