Browse code

Moved shared init code into hack/lib/init.sh

All of our Bash scripts made a number of initialization
steps: setting Bash flags, finding and moving into the
Origin root directory. This commit moves all of those
steps into hack/lib/init.sh in order to cut down on the
amount of boilerplate in our files.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Steve Kuznetsov authored on 2016/08/10 00:06:57
Showing 102 changed files
... ...
@@ -1,19 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-# Set a useful format for xtrace output
8
-# export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
9
-
10
-OS_ROOT=$(
11
-  unset CDPATH
12
-  origin_root=$(dirname "${BASH_SOURCE}")/../..
13
-  cd "${origin_root}"
14
-  pwd
15
-)
16
-source "${OS_ROOT}/hack/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
17 3
 source ${OS_ROOT}/contrib/vagrant/provision-util.sh
18 4
 
19 5
 # Passed as arguments to provisioning script
... ...
@@ -4,18 +4,8 @@
4 4
 #
5 5
 # Set OS_IMAGE_PUSH=true to push images to a registry
6 6
 #
7
-
8
-set -o errexit
9
-set -o nounset
10
-set -o pipefail
11
-
12 7
 STARTTIME=$(date +%s)
13
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
14
-source "${OS_ROOT}/hack/lib/init.sh"
15
-os::log::stacktrace::install
16
-
17
-# Go to the top of the tree.
18
-cd "${OS_ROOT}"
8
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
19 9
 
20 10
 oc="$(os::build::find-binary oc ${OS_ROOT})"
21 11
 if [[ -z "${oc}" ]]; then
... ...
@@ -1,15 +1,8 @@
1 1
 #!/bin/bash
2 2
 
3 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 4
 STARTTIME=$(date +%s)
10
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
11
-source "${OS_ROOT}/hack/lib/init.sh"
12
-os::log::stacktrace::install
5
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
13 6
 
14 7
 platforms=( "${OS_CROSS_COMPILE_PLATFORMS[@]}" )
15 8
 if [[ -n "${OS_ONLY_BUILD_PLATFORMS-}" ]]; then
... ...
@@ -1,15 +1,8 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # This script sets up a go workspace locally and builds all go components.
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9 4
 STARTTIME=$(date +%s)
10
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
11
-source "${OS_ROOT}/hack/lib/init.sh"
12
-os::log::stacktrace::install
5
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
13 6
 
14 7
 # only works on Linux for now, all other platforms must build binaries themselves
15 8
 if [[ -z "$@" ]]; then
... ...
@@ -6,19 +6,9 @@
6 6
 # NOTE:  you only need to run this script if your code changes are part of
7 7
 # any images OpenShift runs internally such as origin-sti-builder, origin-docker-builder,
8 8
 # origin-deployer, etc.
9
-
10
-set -o errexit
11
-set -o nounset
12
-set -o pipefail
13
-
14 9
 STARTTIME=$(date +%s)
15
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
16
-source "${OS_ROOT}/hack/lib/init.sh"
10
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
17 11
 source "${OS_ROOT}/contrib/node/install-sdn.sh"
18
-os::log::stacktrace::install
19
-
20
-# Go to the top of the tree.
21
-cd "${OS_ROOT}"
22 12
 
23 13
 if [[ "${OS_RELEASE:-}" == "n" ]]; then
24 14
   # Use local binaries
... ...
@@ -2,20 +2,14 @@
2 2
 
3 3
 # This script build the sources in openshift/origin-release image using
4 4
 # the Fedora environment and Go compiler.
5
-
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10
-function absolute_path() { 
5
+function absolute_path() {
11 6
   pushd . > /dev/null
12 7
   [ -d "$1" ] && cd "$1" && dirs -l +0
13 8
   popd > /dev/null
14 9
 }
15 10
 
16 11
 STARTTIME=$(date +%s)
17
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
18
-source "${OS_ROOT}/hack/lib/init.sh"
12
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
19 13
 origin_path="src/github.com/openshift/origin"
20 14
 
21 15
 # TODO: Remove this check and fix the docker command instead after the
... ...
@@ -4,18 +4,8 @@
4 4
 # image to be built prior to executing this command via hack/build-base-images.sh.
5 5
 
6 6
 # NOTE:   only committed code is built.
7
-
8
-set -o errexit
9
-set -o nounset
10
-set -o pipefail
11
-
12 7
 STARTTIME=$(date +%s)
13
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
14
-source "${OS_ROOT}/hack/lib/init.sh"
15
-os::log::stacktrace::install
16
-
17
-# Go to the top of the tree.
18
-cd "${OS_ROOT}"
8
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
19 9
 
20 10
 context="${OS_ROOT}/_output/buildenv-context"
21 11
 
... ...
@@ -1,17 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # See HACKING.md for usage
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/lib/init.sh"
11
-os::log::stacktrace::install
12
-
13
-# Go to the top of the tree.
14
-cd "${OS_ROOT}"
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
15 5
 
16 6
 repo="${UPSTREAM_REPO:-k8s.io/kubernetes}"
17 7
 package="${UPSTREAM_PACKAGE:-pkg/api}"
... ...
@@ -3,24 +3,6 @@
3 3
 # This script provides common script functions for the hacks
4 4
 # Requires OS_ROOT to be set
5 5
 
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10
-# The root of the build/dist directory
11
-readonly OS_ROOT=$(
12
-  unset CDPATH
13
-  os_root=$(dirname "${BASH_SOURCE}")/..
14
-
15
-  cd "${os_root}"
16
-  os_root=`pwd`
17
-  if [ -h "${os_root}" ]; then
18
-    readlink "${os_root}"
19
-  else
20
-    pwd
21
-  fi
22
-)
23
-
24 6
 readonly OS_BUILD_ENV_GOLANG="${OS_BUILD_ENV_GOLANG:-1.6}"
25 7
 readonly OS_BUILD_ENV_IMAGE="${OS_BUILD_ENV_IMAGE:-openshift/origin-release:golang-${OS_BUILD_ENV_GOLANG}}"
26 8
 
... ...
@@ -1,16 +1,9 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6 3
 # this will allow matching files also in subdirs with **/*.json pattern
7 4
 shopt -s globstar
8 5
 
9
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
10
-source "${OS_ROOT}/hack/lib/init.sh"
11
-
12
-# Go to the top of the tree.
13
-cd "${OS_ROOT}"
6
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
14 7
 
15 8
 GODEP_ROOT="${OS_ROOT}/vendor"
16 9
 KUBE_ROOT=${1:-""}
... ...
@@ -4,16 +4,6 @@
4 4
 # image to be built prior to executing this command via hack/build-base-images.sh.
5 5
 
6 6
 # NOTE:   only committed code is built.
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/lib/init.sh"
14
-os::log::stacktrace::install
15
-
16
-# Go to the top of the tree.
17
-cd "${OS_ROOT}"
7
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
18 8
 
19 9
 os::build::environment::run "$@"
20 10
\ No newline at end of file
... ...
@@ -5,15 +5,7 @@
5 5
 #
6 6
 #   $ source hack/export-certs.sh ./openshift.local.config/master/admin
7 7
 #   $ curl $CURL_ARGS <a protected URL>
8
-
9
-set -o errexit
10
-set -o nounset
11
-set -o pipefail
12
-
13
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
14
-source "${OS_ROOT}/hack/lib/init.sh"
15
-
16
-set -e
8
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
17 9
 
18 10
 DEF="${1:-}"
19 11
 CERT_DIR="${CERT_DIR:-$DEF}"
... ...
@@ -2,16 +2,7 @@
2 2
 
3 3
 # This script extracts a valid release tar into _output/releases. It requires hack/build-release.sh
4 4
 # to have been executed
5
-
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
11
-source "${OS_ROOT}/hack/lib/init.sh"
12
-
13
-# Go to the top of the tree.
14
-cd "${OS_ROOT}"
5
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
15 6
 
16 7
 # Copy the release archives release back to the local _output/local/bin/... directories.
17 8
 # NOTE: On Mac and Windows you must pass WARN=1 in order to extract the output.
... ...
@@ -13,10 +13,7 @@
13 13
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 14
 # See the License for the specific language governing permissions and
15 15
 # limitations under the License.
16
-
17
-set -o errexit
18
-set -o nounset
19
-set -o pipefail
16
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
20 17
 
21 18
 #### HACK ####
22 19
 # Sometimes godep just can't handle things. This lets use manually put
... ...
@@ -59,8 +56,6 @@ pin-godep() {
59 59
   popd > /dev/null
60 60
 }
61 61
 
62
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
63
-
64 62
 # build the godep tool
65 63
 # Again go get stinks, hence || true
66 64
 go get -u github.com/tools/godep 2>/dev/null || true
... ...
@@ -13,10 +13,7 @@
13 13
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 14
 # See the License for the specific language governing permissions and
15 15
 # limitations under the License.
16
-
17
-set -o errexit
18
-set -o nounset
19
-set -o pipefail
16
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
20 17
 
21 18
 pin-godep() {
22 19
   pushd "${GOPATH}/src/github.com/tools/godep" > /dev/null
... ...
@@ -25,8 +22,6 @@ pin-godep() {
25 25
   popd > /dev/null
26 26
 }
27 27
 
28
-ORIGIN_ROOT=$(dirname "${BASH_SOURCE}")/..
29
-
30 28
 # build the godep tool
31 29
 # Again go get stinks, hence || true
32 30
 go get -u github.com/tools/godep 2>/dev/null || true
... ...
@@ -43,6 +38,4 @@ REQUIRED_BINS=(
43 43
   "./..."
44 44
 )
45 45
 
46
-pushd "${ORIGIN_ROOT}" > /dev/null
47 46
 "${GODEP}" save -t "${REQUIRED_BINS[@]}"
48
-popd > /dev/null
... ...
@@ -1,14 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -e
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/lib/init.sh"
11
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 3
 
13 4
 etcd_version=$(go run ${OS_ROOT}/tools/godepversion/godepversion.go ${OS_ROOT}/Godeps/Godeps.json github.com/coreos/etcd/etcdserver)
14 5
 
... ...
@@ -1,10 +1,6 @@
1 1
 #!/bin/bash
2
-
3
-set -e
4
-
5 2
 STARTTIME=$(date +%s)
6
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
7
-source "${OS_ROOT}/hack/lib/init.sh"
3
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
8 4
 
9 5
 GO_VERSION=($(go version))
10 6
 echo "Detected go version: $(go version)"
... ...
@@ -5,10 +5,33 @@
5 5
 # sively `source`s *.sh files in this directory tree. As such, no files should be `source`ed outside
6 6
 # of this script to ensure that we do not attempt to overwrite read-only variables.
7 7
 
8
-if [[ -z "${OS_ROOT:-}" ]]; then
9
-	echo "[ERROR] In order to import OpenShift Bash libraries, \$OS_ROOT must be set."
10
-	exit 1
11
-fi
8
+set -o errexit
9
+set -o nounset
10
+set -o pipefail
11
+
12
+# os::util::absolute_path returns the absolute path to the directory provided
13
+function os::util::absolute_path() {
14
+	local relative_path="$1"
15
+	local absolute_path
16
+
17
+	pushd "${relative_path}" >/dev/null
18
+	relative_path="$( pwd )"
19
+	if [[ -h "${relative_path}" ]]; then
20
+		absolute_path="$( readlink "${relative_path}" )"
21
+	else
22
+		absolute_path="${relative_path}"
23
+	fi
24
+	popd >/dev/null
25
+
26
+	echo "${absolute_path}"
27
+}
28
+readonly -f os::util::absolute_path
29
+
30
+# find the absolute path to the root of the Origin source tree
31
+init_source="$( dirname "${BASH_SOURCE}" )/../.."
32
+OS_ROOT="$( os::util::absolute_path "${init_source}" )"
33
+export OS_ROOT
34
+cd "${OS_ROOT}"
12 35
 
13 36
 library_files=( $( find "${OS_ROOT}/hack/lib" -type f -name '*.sh' -not -path '*/hack/lib/init.sh' ) )
14 37
 # TODO(skuzmets): Move the contents of the following files into respective library files.
... ...
@@ -19,4 +42,8 @@ for library_file in "${library_files[@]}"; do
19 19
 	source "${library_file}"
20 20
 done
21 21
 
22
-unset library_files library_file
23 22
\ No newline at end of file
23
+unset library_files library_file init_source
24
+
25
+# all of our Bash scripts need to have the stacktrace
26
+# handler installed to deal with errors
27
+os::log::stacktrace::install
24 28
\ No newline at end of file
... ...
@@ -121,8 +121,9 @@ function os::util::find-go-binary() {
121 121
 
122 122
   IFS=":"
123 123
   for part in $GOPATH; do
124
-    if [[ -f "$part/bin/$binary_name" && -x "${part}/bin/${binary_name}" ]]; then
125
-      echo $part/bin/$binary_name
124
+  	local binary="${part}/bin/${binary_name}"
125
+    if [[ -f "${binary}" && -x "${binary}" ]]; then
126
+      echo "${binary}"
126 127
       break
127 128
     fi
128 129
   done
... ...
@@ -1,14 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-# Go to the top of the tree.
11
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 3
 
13 4
 os::build::setup_env
14 5
 
... ...
@@ -6,17 +6,7 @@
6 6
 #  2. Set TARGET_BRANCH for the new branch to work in
7 7
 #  3. In your kube git directory, set the current branch to the level to want to apply patches to
8 8
 #  4. Run `hack/move-upstream.sh master...<commit hash you want to start pulling patches from>`
9
-
10
-set -o errexit
11
-set -o nounset
12
-set -o pipefail
13
-
14
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
15
-source "${OS_ROOT}/hack/lib/init.sh"
16
-os::log::stacktrace::install
17
-
18
-# Go to the top of the tree.
19
-cd "${OS_ROOT}"
9
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
20 10
 
21 11
 repo="${UPSTREAM_REPO:-k8s.io/kubernetes}"
22 12
 package="${UPSTREAM_PACKAGE:-pkg/api}"
... ...
@@ -5,17 +5,8 @@
5 5
 # Set OS_PUSH_BASE_IMAGES=true to push base images
6 6
 # Set OS_PUSH_BASE_REGISTRY to prefix the destination images
7 7
 #
8
-
9
-set -o errexit
10
-set -o nounset
11
-set -o pipefail
12
-
13 8
 STARTTIME=$(date +%s)
14
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
15
-source "${OS_ROOT}/hack/lib/init.sh"
16
-
17
-# Go to the top of the tree.
18
-cd "${OS_ROOT}"
9
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
19 10
 
20 11
 # Allow a release to be repushed with a tag
21 12
 tag="${OS_PUSH_TAG:-}"
... ...
@@ -5,13 +5,7 @@
5 5
 
6 6
 # Prereq:
7 7
 # go get github.com/fzipp/pythia
8
-
9
-set -o errexit
10
-set -o nounset
11
-set -o pipefail
12
-
13
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
14
-source "${OS_ROOT}/hack/lib/init.sh"
8
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
15 9
 
16 10
 # Check for `go` binary and set ${GOPATH}.
17 11
 os::build::setup_env
... ...
@@ -1,11 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
9 3
 
10 4
 "${OS_ROOT}/hack/build-go.sh" tools/rebasehelpers/godepchecker
11 5
 
... ...
@@ -1,16 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # This script builds and pushes a release to DockerHub.
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/lib/init.sh"
11
-
12
-# Go to the top of the tree.
13
-cd "${OS_ROOT}"
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
14 5
 
15 6
 tag="${OS_TAG:-}"
16 7
 if [[ -z "${tag}" ]]; then
... ...
@@ -1,16 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # This script builds and pushes a release to DockerHub.
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/lib/init.sh"
11
-
12
-# Go to the top of the tree.
13
-cd "${OS_ROOT}"
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
14 5
 
15 6
 tag="${OS_TAG:-}"
16 7
 if [[ -z "${tag}" ]]; then
... ...
@@ -2,16 +2,8 @@
2 2
 
3 3
 # This command checks that the built commands can function together for
4 4
 # simple scenarios.  It does not require Docker so it can run in travis.
5
-
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10 5
 STARTTIME=$(date +%s)
11
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
12
-cd "${OS_ROOT}"
13
-source "${OS_ROOT}/hack/lib/init.sh"
14
-os::log::stacktrace::install
6
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
15 7
 os::util::environment::setup_time_vars
16 8
 
17 9
 function cleanup()
... ...
@@ -2,14 +2,8 @@
2 2
 
3 3
 # This script tests the high level end-to-end functionality demonstrated
4 4
 # as part of the examples/sample-app
5
-
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10 5
 STARTTIME=$(date +%s)
11
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
12
-source "${OS_ROOT}/hack/lib/init.sh"
6
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
13 7
 
14 8
 echo "[INFO] Starting containerized end-to-end test"
15 9
 
... ...
@@ -33,7 +27,7 @@ function cleanup()
33 33
 	set +e
34 34
 	dump_container_logs
35 35
 
36
-	# pull information out of the server log so that we can get failure management in jenkins to highlight it and 
36
+	# pull information out of the server log so that we can get failure management in jenkins to highlight it and
37 37
 	# really have it smack people in their logs.  This is a severe correctness problem
38 38
     grep -a5 "CACHE.*ALTERED" ${LOG_DIR}/container-origin.log
39 39
 
... ...
@@ -2,13 +2,8 @@
2 2
 
3 3
 # This script tests the high level end-to-end functionality demonstrated
4 4
 # as part of the examples/sample-app
5
-
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10 5
 STARTTIME=$(date +%s)
11
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
6
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 7
 
13 8
 readonly JQSETPULLPOLICY='(.items[] | select(.kind == "DeploymentConfig") | .spec.template.spec.containers[0].imagePullPolicy) |= "IfNotPresent"'
14 9
 
... ...
@@ -21,9 +16,6 @@ if [[ "${TEST_END_TO_END:-}" != "direct" ]]; then
21 21
 	echo "++ Docker is not installed, running end-to-end against local binaries"
22 22
 fi
23 23
 
24
-source "${OS_ROOT}/hack/lib/init.sh"
25
-os::log::stacktrace::install
26
-
27 24
 ensure_iptables_or_die
28 25
 
29 26
 echo "[INFO] Starting end-to-end test"
... ...
@@ -19,11 +19,6 @@
19 19
 #  - JUNIT_REPORT:        toggles the creation of jUnit XML from the test output and changes this script's output behavior
20 20
 #                         to use the 'junitreport' tool for summarizing the tests.
21 21
 #  - DLV_DEBUG            toggles running tests using delve debugger
22
-
23
-set -o errexit
24
-set -o nounset
25
-set -o pipefail
26
-
27 22
 function exit_trap() {
28 23
     local return_code=$?
29 24
 
... ...
@@ -42,10 +37,7 @@ function exit_trap() {
42 42
 trap exit_trap EXIT
43 43
 
44 44
 start_time=$(date +%s)
45
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
46
-source "${OS_ROOT}/hack/lib/init.sh"
47
-cd "${OS_ROOT}"
48
-os::log::stacktrace::install
45
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
49 46
 os::build::setup_env
50 47
 os::util::environment::setup_tmpdir_vars "test-go"
51 48
 
... ...
@@ -1,16 +1,6 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7 2
 STARTTIME=$(date +%s)
8
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
9
-source "${OS_ROOT}/hack/lib/init.sh"
10
-os::log::stacktrace::install
11
-
12
-# Go to the top of the tree.
13
-cd "${OS_ROOT}"
3
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
14 4
 
15 5
 os::build::setup_env
16 6
 
... ...
@@ -21,17 +21,7 @@
21 21
 #
22 22
 # KUBE_ROOT=../kubernetes hack/test-kube-e2e.sh --ginkgo.focus="Network.*intra"
23 23
 #
24
-
25
-set -o errexit
26
-set -o nounset
27
-set -o pipefail
28
-
29
-OS_ROOT=$(
30
-  unset CDPATH
31
-  origin_root=$(dirname "${BASH_SOURCE}")/..
32
-  cd "${origin_root}"
33
-  pwd
34
-)
24
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
35 25
 
36 26
 KUBE_ROOT=${KUBE_ROOT:-""}
37 27
 
... ...
@@ -1,16 +1,11 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # This script runs all of the test written for our Bash libraries.
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9 4
 function exit_trap() {
10 5
     local return_code=$?
11 6
 
12 7
     end_time=$(date +%s)
13
-    
8
+
14 9
     if [[ "${return_code}" -eq "0" ]]; then
15 10
         verb="succeeded"
16 11
     else
... ...
@@ -24,9 +19,7 @@ function exit_trap() {
24 24
 trap exit_trap EXIT
25 25
 
26 26
 start_time=$(date +%s)
27
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
28
-source "${OS_ROOT}/hack/lib/init.sh"
29
-os::log::stacktrace::install
27
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
30 28
 os::util::environment::setup_tmpdir_vars "test-lib"
31 29
 
32 30
 cd "${OS_ROOT}"
... ...
@@ -2,15 +2,11 @@
2 2
 #
3 3
 # This script tests os::test::junit functionality.
4 4
 
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9 5
 function exit_trap() {
10 6
     local return_code=$?
11 7
 
12 8
     end_time=$(date +%s)
13
-    
9
+
14 10
     if [[ "${return_code}" -eq "0" ]]; then
15 11
         verb="succeeded"
16 12
     else
... ...
@@ -24,9 +20,7 @@ function exit_trap() {
24 24
 trap exit_trap EXIT
25 25
 
26 26
 start_time=$(date +%s)
27
-OS_ROOT="$( dirname "${BASH_SOURCE}" )"/../../..
28
-source "${OS_ROOT}/hack/lib/init.sh"
29
-os::log::stacktrace::install
27
+source "$( dirname "${BASH_SOURCE}" )/../../lib/init.sh"
30 28
 
31 29
 # envars used to track these interactions are not propagated out of the subshells used to run these commands
32 30
 # therefore each os::cmd call is its own sandbox and complicated scenarios need to play out inside one call
... ...
@@ -1,14 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-# Go to the top of the tree.
11
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 3
 
13 4
 os::build::setup_env
14 5
 
... ...
@@ -1,16 +1,8 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # This command runs any exposed integration tests for the developer tools
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9 4
 STARTTIME=$(date +%s)
10
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
11
-cd "${OS_ROOT}"
12
-source "${OS_ROOT}/hack/lib/init.sh"
13
-os::log::stacktrace::install
5
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
14 6
 
15 7
 os::test::junit::declare_suite_start 'tools'
16 8
 
... ...
@@ -1,14 +1,6 @@
1 1
 #!/bin/bash
2 2
 # This file ensures that the helper functions in util.sh behave as expected
3
-
4
-set -o errexit
5
-set -o nounset
6
-set -o pipefail
7
-# set -x
8
-
9
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
10
-source "${OS_ROOT}/hack/lib/init.sh"
11
-os::log::stacktrace::install
3
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 4
 trap os::test::junit::reconcile_output EXIT
13 5
 
14 6
 BASETMPDIR="${TMPDIR:-/tmp}/openshift/test-tools"
... ...
@@ -166,7 +158,7 @@ os::cmd::expect_success_and_text 'echo $(( 1 - 20 ))' '\-19' # we need to escape
166 166
 # redirects
167 167
 os::cmd::expect_failure_and_text 'grep' '(Usage|usage)'
168 168
 
169
-os::cmd::expect_success_and_not_text 'pwd 1>/dev/null' '.' 
169
+os::cmd::expect_success_and_not_text 'pwd 1>/dev/null' '.'
170 170
 
171 171
 os::cmd::expect_failure_and_not_text 'grep 2>/dev/null' '(Usage|usage)'
172 172
 
... ...
@@ -186,161 +178,161 @@ os::test::junit::declare_suite_start "cmd/util/output"
186 186
 
187 187
 # expect_code
188 188
 output=$(os::cmd::expect_code 'exit 0' '0')
189
-echo "${output}" | grep -q 'SUCCESS' 
189
+echo "${output}" | grep -q 'SUCCESS'
190 190
 
191 191
 output=$(os::cmd::expect_code 'exit 1' '0') || true
192
-echo "${output}" | grep -q 'FAILURE' 
193
-echo "${output}" | grep -q 'the command returned the wrong error code' 
192
+echo "${output}" | grep -q 'FAILURE'
193
+echo "${output}" | grep -q 'the command returned the wrong error code'
194 194
 
195 195
 output=$(os::cmd::expect_code 'exit 1' '1')
196
-echo "${output}" | grep -q 'SUCCESS' 
196
+echo "${output}" | grep -q 'SUCCESS'
197 197
 
198 198
 output=$(os::cmd::expect_code 'exit 0' '1') || true
199
-echo "${output}" | grep -q 'FAILURE' 
200
-echo "${output}" | grep -q 'the command returned the wrong error code' 
199
+echo "${output}" | grep -q 'FAILURE'
200
+echo "${output}" | grep -q 'the command returned the wrong error code'
201 201
 
202 202
 output=$(os::cmd::expect_code 'exit 99' '99')
203
-echo "${output}" | grep -q 'SUCCESS' 
203
+echo "${output}" | grep -q 'SUCCESS'
204 204
 
205 205
 output=$(os::cmd::expect_code 'exit 1' '99') || true
206
-echo "${output}" | grep -q 'FAILURE' 
207
-echo "${output}" | grep -q 'the command returned the wrong error code' 
206
+echo "${output}" | grep -q 'FAILURE'
207
+echo "${output}" | grep -q 'the command returned the wrong error code'
208 208
 
209 209
 # expect_success
210 210
 output=$(os::cmd::expect_success 'exit 0')
211
-echo "${output}" | grep -q 'SUCCESS' 
211
+echo "${output}" | grep -q 'SUCCESS'
212 212
 
213 213
 output=$(os::cmd::expect_success 'exit 1') || true
214
-echo "${output}" | grep -q 'FAILURE' 
215
-echo "${output}" | grep -q 'the command returned the wrong error code' 
214
+echo "${output}" | grep -q 'FAILURE'
215
+echo "${output}" | grep -q 'the command returned the wrong error code'
216 216
 
217 217
 # expect_failure
218 218
 output=$(os::cmd::expect_failure 'exit 1')
219
-echo "${output}" | grep -q 'SUCCESS' 
219
+echo "${output}" | grep -q 'SUCCESS'
220 220
 
221 221
 output=$(os::cmd::expect_failure 'exit 0') || true
222
-echo "${output}" | grep -q 'FAILURE' 
223
-echo "${output}" | grep -q 'the command returned the wrong error code' 
222
+echo "${output}" | grep -q 'FAILURE'
223
+echo "${output}" | grep -q 'the command returned the wrong error code'
224 224
 
225 225
 # expect_code_and_text
226 226
 output=$(os::cmd::expect_code_and_text 'echo "hello" && exit 0' '0' 'hello')
227
-echo "${output}" | grep -q 'SUCCESS' 
227
+echo "${output}" | grep -q 'SUCCESS'
228 228
 
229 229
 output=$(os::cmd::expect_code_and_text 'echo "hello" && exit 1' '0' 'hello') || true
230
-echo "${output}" | grep -q 'FAILURE' 
231
-echo "${output}" | grep -q 'the command returned the wrong error code' 
232
-echo "${output}" | grep -q 'hello' 
230
+echo "${output}" | grep -q 'FAILURE'
231
+echo "${output}" | grep -q 'the command returned the wrong error code'
232
+echo "${output}" | grep -q 'hello'
233 233
 
234 234
 output=$(os::cmd::expect_code_and_text 'echo "goodbye" && exit 0' '0' 'hello') || true
235
-echo "${output}" | grep -q 'FAILURE' 
236
-echo "${output}" | grep -q 'the output content test failed' 
237
-echo "${output}" | grep -q 'goodbye' 
235
+echo "${output}" | grep -q 'FAILURE'
236
+echo "${output}" | grep -q 'the output content test failed'
237
+echo "${output}" | grep -q 'goodbye'
238 238
 
239 239
 output=$(os::cmd::expect_code_and_text 'echo "goodbye" && exit 1' '0' 'hello') || true
240
-echo "${output}" | grep -q 'FAILURE' 
241
-echo "${output}" | grep -q 'the command returned the wrong error code' 
242
-echo "${output}" | grep -q '; the output content test failed' 
243
-echo "${output}" | grep -q 'goodbye' 
240
+echo "${output}" | grep -q 'FAILURE'
241
+echo "${output}" | grep -q 'the command returned the wrong error code'
242
+echo "${output}" | grep -q '; the output content test failed'
243
+echo "${output}" | grep -q 'goodbye'
244 244
 
245 245
 # expect_success_and_text
246 246
 output=$(os::cmd::expect_success_and_text 'echo "hello" && exit 0' 'hello')
247
-echo "${output}" | grep -q 'SUCCESS' 
247
+echo "${output}" | grep -q 'SUCCESS'
248 248
 
249 249
 output=$(os::cmd::expect_success_and_text 'echo "hello" && exit 1' 'hello') || true
250
-echo "${output}" | grep -q 'FAILURE' 
251
-echo "${output}" | grep -q 'the command returned the wrong error code' 
252
-echo "${output}" | grep -q 'hello' 
250
+echo "${output}" | grep -q 'FAILURE'
251
+echo "${output}" | grep -q 'the command returned the wrong error code'
252
+echo "${output}" | grep -q 'hello'
253 253
 
254 254
 output=$(os::cmd::expect_success_and_text 'echo "goodbye" && exit 0' 'hello') || true
255
-echo "${output}" | grep -q 'FAILURE' 
256
-echo "${output}" | grep -q 'the output content test failed' 
257
-echo "${output}" | grep -q 'goodbye' 
255
+echo "${output}" | grep -q 'FAILURE'
256
+echo "${output}" | grep -q 'the output content test failed'
257
+echo "${output}" | grep -q 'goodbye'
258 258
 
259 259
 output=$(os::cmd::expect_success_and_text 'echo "goodbye" && exit 1' 'hello') || true
260
-echo "${output}" | grep -q 'FAILURE' 
261
-echo "${output}" | grep -q 'the command returned the wrong error code' 
262
-echo "${output}" | grep -q '; the output content test failed' 
263
-echo "${output}" | grep -q 'goodbye' 
260
+echo "${output}" | grep -q 'FAILURE'
261
+echo "${output}" | grep -q 'the command returned the wrong error code'
262
+echo "${output}" | grep -q '; the output content test failed'
263
+echo "${output}" | grep -q 'goodbye'
264 264
 
265 265
 # expect_failure_and_text
266 266
 output=$(os::cmd::expect_failure_and_text 'echo "hello" && exit 1' 'hello')
267
-echo "${output}" | grep -q 'SUCCESS' 
267
+echo "${output}" | grep -q 'SUCCESS'
268 268
 
269 269
 output=$(os::cmd::expect_failure_and_text 'echo "hello" && exit 0' 'hello') || true
270
-echo "${output}" | grep -q 'FAILURE' 
271
-echo "${output}" | grep -q 'the command returned the wrong error code' 
272
-echo "${output}" | grep -q 'hello' 
270
+echo "${output}" | grep -q 'FAILURE'
271
+echo "${output}" | grep -q 'the command returned the wrong error code'
272
+echo "${output}" | grep -q 'hello'
273 273
 
274 274
 output=$(os::cmd::expect_failure_and_text 'echo "goodbye" && exit 1' 'hello') || true
275
-echo "${output}" | grep -q 'FAILURE' 
276
-echo "${output}" | grep -q 'the output content test failed' 
277
-echo "${output}" | grep -q 'goodbye' 
275
+echo "${output}" | grep -q 'FAILURE'
276
+echo "${output}" | grep -q 'the output content test failed'
277
+echo "${output}" | grep -q 'goodbye'
278 278
 
279 279
 output=$(os::cmd::expect_failure_and_text 'echo "goodbye" && exit 0' 'hello') || true
280
-echo "${output}" | grep -q 'FAILURE' 
281
-echo "${output}" | grep -q 'the command returned the wrong error code' 
282
-echo "${output}" | grep -q '; the output content test failed' 
283
-echo "${output}" | grep -q 'goodbye' 
280
+echo "${output}" | grep -q 'FAILURE'
281
+echo "${output}" | grep -q 'the command returned the wrong error code'
282
+echo "${output}" | grep -q '; the output content test failed'
283
+echo "${output}" | grep -q 'goodbye'
284 284
 
285 285
 # expect_code_and_not_text
286 286
 output=$(os::cmd::expect_code_and_not_text 'echo "goodbye" && exit 0' '0' 'hello')
287
-echo "${output}" | grep -q 'SUCCESS' 
287
+echo "${output}" | grep -q 'SUCCESS'
288 288
 
289 289
 output=$(os::cmd::expect_code_and_not_text 'echo "goodbye" && exit 1' '0' 'hello') || true
290
-echo "${output}" | grep -q 'FAILURE' 
291
-echo "${output}" | grep -q 'the command returned the wrong error code' 
292
-echo "${output}" | grep -q 'goodbye' 
290
+echo "${output}" | grep -q 'FAILURE'
291
+echo "${output}" | grep -q 'the command returned the wrong error code'
292
+echo "${output}" | grep -q 'goodbye'
293 293
 
294 294
 output=$(os::cmd::expect_code_and_not_text 'echo "hello" && exit 0' '0' 'hello') || true
295
-echo "${output}" | grep -q 'FAILURE' 
296
-echo "${output}" | grep -q 'the output content test failed' 
297
-echo "${output}" | grep -q 'hello' 
295
+echo "${output}" | grep -q 'FAILURE'
296
+echo "${output}" | grep -q 'the output content test failed'
297
+echo "${output}" | grep -q 'hello'
298 298
 
299 299
 output=$(os::cmd::expect_code_and_not_text 'echo "hello" && exit 1' '0' 'hello') || true
300
-echo "${output}" | grep -q 'FAILURE' 
301
-echo "${output}" | grep -q 'the command returned the wrong error code' 
302
-echo "${output}" | grep -q '; the output content test failed' 
303
-echo "${output}" | grep -q 'hello' 
300
+echo "${output}" | grep -q 'FAILURE'
301
+echo "${output}" | grep -q 'the command returned the wrong error code'
302
+echo "${output}" | grep -q '; the output content test failed'
303
+echo "${output}" | grep -q 'hello'
304 304
 
305 305
 # expect_success_and_not_text
306 306
 output=$(os::cmd::expect_success_and_not_text 'echo "goodbye" && exit 0' 'hello')
307
-echo "${output}" | grep -q 'SUCCESS' 
307
+echo "${output}" | grep -q 'SUCCESS'
308 308
 
309 309
 output=$(os::cmd::expect_success_and_not_text 'echo "goodbye" && exit 1' 'hello') || true
310
-echo "${output}" | grep -q 'FAILURE' 
311
-echo "${output}" | grep -q 'the command returned the wrong error code' 
312
-echo "${output}" | grep -q 'goodbye' 
310
+echo "${output}" | grep -q 'FAILURE'
311
+echo "${output}" | grep -q 'the command returned the wrong error code'
312
+echo "${output}" | grep -q 'goodbye'
313 313
 
314 314
 output=$(os::cmd::expect_success_and_not_text 'echo "hello" && exit 0' 'hello') || true
315
-echo "${output}" | grep -q 'FAILURE' 
316
-echo "${output}" | grep -q 'the output content test failed' 
317
-echo "${output}" | grep -q 'hello' 
315
+echo "${output}" | grep -q 'FAILURE'
316
+echo "${output}" | grep -q 'the output content test failed'
317
+echo "${output}" | grep -q 'hello'
318 318
 
319 319
 output=$(os::cmd::expect_success_and_not_text 'echo "hello" && exit 1' 'hello') || true
320
-echo "${output}" | grep -q 'FAILURE' 
321
-echo "${output}" | grep -q 'the command returned the wrong error code' 
322
-echo "${output}" | grep -q '; the output content test failed' 
323
-echo "${output}" | grep -q 'hello' 
320
+echo "${output}" | grep -q 'FAILURE'
321
+echo "${output}" | grep -q 'the command returned the wrong error code'
322
+echo "${output}" | grep -q '; the output content test failed'
323
+echo "${output}" | grep -q 'hello'
324 324
 
325 325
 # expect_failure_and_not_text
326 326
 output=$(os::cmd::expect_failure_and_not_text 'echo "goodbye" && exit 1' 'hello')
327
-echo "${output}" | grep -q 'SUCCESS' 
327
+echo "${output}" | grep -q 'SUCCESS'
328 328
 
329 329
 output=$(os::cmd::expect_failure_and_not_text 'echo "goodbye" && exit 0' 'hello') || true
330
-echo "${output}" | grep -q 'FAILURE' 
331
-echo "${output}" | grep -q 'the command returned the wrong error code' 
332
-echo "${output}" | grep -q 'goodbye' 
330
+echo "${output}" | grep -q 'FAILURE'
331
+echo "${output}" | grep -q 'the command returned the wrong error code'
332
+echo "${output}" | grep -q 'goodbye'
333 333
 
334 334
 output=$(os::cmd::expect_failure_and_not_text 'echo "hello" && exit 1' 'hello') || true
335
-echo "${output}" | grep -q 'FAILURE' 
336
-echo "${output}" | grep -q 'the output content test failed' 
337
-echo "${output}" | grep -q 'hello' 
335
+echo "${output}" | grep -q 'FAILURE'
336
+echo "${output}" | grep -q 'the output content test failed'
337
+echo "${output}" | grep -q 'hello'
338 338
 
339 339
 output=$(os::cmd::expect_failure_and_not_text 'echo "hello" && exit 0' 'hello') || true
340
-echo "${output}" | grep -q 'FAILURE' 
341
-echo "${output}" | grep -q 'the command returned the wrong error code' 
342
-echo "${output}" | grep -q '; the output content test failed' 
343
-echo "${output}" | grep -q 'hello' 
340
+echo "${output}" | grep -q 'FAILURE'
341
+echo "${output}" | grep -q 'the command returned the wrong error code'
342
+echo "${output}" | grep -q '; the output content test failed'
343
+echo "${output}" | grep -q 'hello'
344 344
 
345 345
 echo "output tests: ok"
346 346
 os::test::junit::declare_suite_end
... ...
@@ -4,12 +4,7 @@
4 4
 # so they can be included directly in our repository.
5 5
 # Feeds off a README.md file with well defined syntax that informs this
6 6
 # script how to pull the file down.
7
-
8
-set -o errexit
9
-set -o nounset
10
-set -o pipefail
11
-
12
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
7
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
13 8
 
14 9
 # For now the only external examples are in examples/quickstarts.
15 10
 QUICKSTARTS_DIR="${OS_ROOT}/examples/quickstarts"
... ...
@@ -1,13 +1,6 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7 2
 STARTTIME=$(date +%s)
8
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
9
-source "${OS_ROOT}/hack/lib/init.sh"
10
-os::log::stacktrace::install
3
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 4
 
12 5
 EXAMPLES=examples
13 6
 OUTPUT_PARENT=${OUTPUT_ROOT:-$OS_ROOT}
... ...
@@ -1,11 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
9 3
 
10 4
 os::build::setup_env
11 5
 
... ...
@@ -1,15 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # This script sets up a go workspace locally and builds all go components.
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/lib/init.sh"
11
-
12
-cd ${OS_ROOT}
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
13 5
 
14 6
 # ensure we have the latest compiled binaries
15 7
 "${OS_ROOT}/hack/build-go.sh"
... ...
@@ -1,14 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-# Go to the top of the tree.
11
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 3
 
13 4
 os::build::setup_env
14 5
 
... ...
@@ -1,14 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-# Go to the top of the tree.
11
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 3
 
13 4
 os::build::setup_env
14 5
 
... ...
@@ -1,13 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # This script sets up a go workspace locally and builds all go components.
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/lib/init.sh"
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 5
 
12 6
 "${OS_ROOT}/hack/build-go.sh" tools/gendocs tools/genman
13 7
 
... ...
@@ -1,14 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-# Go to the top of the tree.
11
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 3
 
13 4
 if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3.0."* ]]; then
14 5
   echo "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and"
... ...
@@ -7,15 +7,7 @@
7 7
 # This script accepts the following parameters as environment variables:
8 8
 #  - VERIFY:  run the script to verify current documentation
9 9
 #  - DRY_RUN: print which files would be generated and exit
10
-
11
-set -o errexit
12
-set -o nounset
13
-set -o pipefail
14
-
15
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
16
-cd "${OS_ROOT}"
17
-source "${OS_ROOT}/hack/lib/init.sh"
18
-os::log::stacktrace::install
10
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
19 11
 
20 12
 # read in envar options
21 13
 verify="${VERIFY:-}"
... ...
@@ -1,14 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # Script to create latest swagger spec.
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/lib/init.sh"
11
-os::log::stacktrace::install
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
12 5
 
13 6
 function cleanup()
14 7
 {
... ...
@@ -1,15 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # Script to generate docs from the latest swagger spec.
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
10
-cd "${OS_ROOT}"
11
-source "${OS_ROOT}/hack/lib/init.sh"
12
-os::log::stacktrace::install
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
13 5
 
14 6
 pushd "${OS_ROOT}/hack/swagger-doc" > /dev/null
15 7
 gradle gendocs --info
... ...
@@ -8,13 +8,7 @@
8 8
 #                        directory will be used.
9 9
 #   - CONSOLE_REPO_PATH: specifies a directory path to look for the web console repo.  If not set it is assumed to be
10 10
 #                        a sibling to this repository.
11
-
12
-set -o errexit
13
-set -o nounset
14
-set -o pipefail
15
-
16
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
17
-source "${OS_ROOT}/hack/lib/init.sh"
11
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
18 12
 
19 13
 CONSOLE_REPO_PATH=${CONSOLE_REPO_PATH:-$OS_ROOT/../origin-web-console}
20 14
 if [[ ! -d "$CONSOLE_REPO_PATH" ]]; then
... ...
@@ -1,13 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 3
 
12 4
 echo "===== Verifying Generated Bootstrap Bindata ====="
13 5
 
... ...
@@ -1,12 +1,6 @@
1 1
 #!/bin/bash
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
2 3
 
3
-set -o nounset
4
-set -o pipefail
5
-
6
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
7
-source "${OS_ROOT}/hack/lib/init.sh"
8
-
9
-cd "${OS_ROOT}"
10 4
 echo "===== Verifying Generated Client sets ====="
11 5
 output=$(VERIFY=true ${OS_ROOT}/hack/update-generated-clientsets.sh 2>&1)
12 6
 
... ...
@@ -1,13 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 3
 
12 4
 echo "===== Verifying Generated Completions ====="
13 5
 
... ...
@@ -1,13 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 3
 
12 4
 echo "===== Verifying Generated Conversions ====="
13 5
 
... ...
@@ -1,13 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 3
 
12 4
 echo "===== Verifying Generated Deep Copies ====="
13 5
 
... ...
@@ -1,13 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 3
 
12 4
 echo "===== Verifying Generated Docs ====="
13 5
 
... ...
@@ -1,11 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
9 3
 
10 4
 APIROOTS=${APIROOTS:-pkg}
11 5
 _tmp="${OS_ROOT}/_output/diff"
... ...
@@ -1,12 +1,7 @@
1 1
 #!/bin/bash
2 2
 #
3 3
 # This script verifies that generated Swagger self-describing documentation is up to date.
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
10 5
 
11 6
 echo "===== Verifying Generated Swagger Descriptions ====="
12 7
 
... ...
@@ -1,13 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-
10
-cd "${OS_ROOT}"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 3
 
12 4
 echo "===== Verifying API Swagger Spec ====="
13 5
 
... ...
@@ -1,18 +1,8 @@
1 1
 #!/bin/bash
2
-
3
-# GoFmt apparently is changing @ head...
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/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
11 3
 
12 4
 os::golang::verify_go_version
13 5
 
14
-cd "${OS_ROOT}"
15
-
16 6
 bad_files=$(find_files | xargs gofmt -s -l)
17 7
 if [[ -n "${bad_files}" ]]; then
18 8
 	echo "!!! gofmt needs to be run on the following files: " >&2
... ...
@@ -1,16 +1,9 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o pipefail
5
-
6
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
7
-source "${OS_ROOT}/hack/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
8 3
 
9 4
 os::golang::verify_go_version
10 5
 os::golang::verify_golint_version
11 6
 
12
-cd "${OS_ROOT}"
13
-
14 7
 arg="${1:-""}"
15 8
 bad_files=""
16 9
 
... ...
@@ -1,14 +1,8 @@
1 1
 #!/bin/bash
2
-
3
-set -o nounset
4
-set -o pipefail
5
-
6
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
7
-source "${OS_ROOT}/hack/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
8 3
 
9 4
 os::golang::verify_go_version
10 5
 
11
-cd "${OS_ROOT}"
12 6
 mkdir -p _output/govet
13 7
 
14 8
 os::build::setup_env
... ...
@@ -12,11 +12,7 @@
12 12
 # automatically:
13 13
 # $ ./hack/verify-jsonformat.sh --format --fix
14 14
 #
15
-
16
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
17
-source "${OS_ROOT}/hack/lib/init.sh"
18
-
19
-cd "${OS_ROOT}"
15
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
20 16
 
21 17
 json_files=$(find {api,examples,docs,images,plugins,test} -name "*.json")
22 18
 tmp_dir=$(mktemp -d)
... ...
@@ -1,15 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # Script to create latest swagger spec.
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/lib/init.sh"
11
-
12
-os::log::stacktrace::install
4
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
13 5
 
14 6
 # Open port scanning
15 7
 echo "[INFO] Checking open ports ('sudo openshift start' should already be running)"
... ...
@@ -1,11 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/..
8
-source "${OS_ROOT}/hack/lib/init.sh"
2
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
9 3
 
10 4
 if ! git status &> /dev/null; then
11 5
   echo "SKIPPED: Not a Git repository"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 project="$( oc project -q )"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 os::test::junit::declare_suite_start "cmd/completions"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # This test validates the diagnostics command
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 os::test::junit::declare_suite_start "cmd/help"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -16,7 +9,7 @@ trap os::test::junit::reconcile_output EXIT
16 16
   exit 0
17 17
 ) &>/dev/null
18 18
 
19
-project=$(oc project -q)
19
+project="$(oc project -q)"
20 20
 idled_at_annotation='idling.alpha.openshift.io/idled-at'
21 21
 unidle_target_annotation='idling.alpha.openshift.io/unidle-targets'
22 22
 idled_at_template="{{index .metadata.annotations \"${idled_at_annotation}\"}}"
... ...
@@ -29,13 +22,16 @@ setup_idling_resources() {
29 29
     os::cmd::expect_success 'oc create -f test/extended/testdata/idling-echo-server.yaml'
30 30
     os::cmd::expect_success 'oc describe deploymentconfigs idling-echo'
31 31
     os::cmd::try_until_success 'oc describe endpoints idling-echo'
32
-    local endpoints_json=$(oc get endpoints idling-echo -o json)
32
+    local endpoints_json
33
+    endpoints_json="$(oc get endpoints idling-echo -o json)"
33 34
     os::cmd::expect_success 'oc delete service idling-echo'
34 35
     os::cmd::expect_success "echo '${endpoints_json}' | oc create -f -"
35 36
     os::cmd::expect_success 'oc describe endpoints idling-echo'
36 37
     # deployer pod won't work, so just scale up the rc ourselves
37 38
     os::cmd::expect_success 'oc scale replicationcontroller idling-echo-1 --replicas=2'
38
-    pod_name=$(oc get pod -l app=idling-echo -o go-template='{{ (index .items 0).metadata.name }}')
39
+    os::cmd::try_until_text "oc get pod -l app=idling-echo -o go-template='{{ len .items }}'" "2"
40
+    local pod_name
41
+    pod_name="$(oc get pod -l app=idling-echo -o go-template='{{ (index .items 0).metadata.name }}')"
39 42
     fake_endpoints_patch=$(cat <<EOF
40 43
 {
41 44
     "subsets": [{
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 project="$( oc project -q )"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 source "${OS_ROOT}/test/cmd/images_tests.sh"
13 6
\ No newline at end of file
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 project="$( oc project -q )"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Test that resource printer includes resource kind on multiple resources
... ...
@@ -1,12 +1,6 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
3
+trap os::test::junit::reconcile_output EXIT
10 4
 
11 5
 # Cleanup cluster resources created by this test
12 6
 (
... ...
@@ -24,16 +18,16 @@ os::cmd::expect_failure_and_text 'oc process name1 name2' 'template name must be
24 24
 # fail to pass a filename or template by name
25 25
 os::cmd::expect_failure_and_text 'oc process' 'Must pass a filename or name of stored template'
26 26
 # can't ask for parameters and try process the template
27
-os::cmd::expect_failure_and_text 'oc process template-name --parameters --value=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-value' 
28
-os::cmd::expect_failure_and_text 'oc process template-name --parameters -v someval' '\-\-parameters flag does not process the template, can.t be used with \-\-value' 
29
-os::cmd::expect_failure_and_text 'oc process template-name --parameters --labels=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-labels' 
30
-os::cmd::expect_failure_and_text 'oc process template-name --parameters -l someval' '\-\-parameters flag does not process the template, can.t be used with \-\-labels' 
31
-os::cmd::expect_failure_and_text 'oc process template-name --parameters --output=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-output' 
32
-os::cmd::expect_failure_and_text 'oc process template-name --parameters -o someval' '\-\-parameters flag does not process the template, can.t be used with \-\-output' 
33
-os::cmd::expect_failure_and_text 'oc process template-name --parameters --output-version=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-output-version' 
34
-os::cmd::expect_failure_and_text 'oc process template-name --parameters --raw' '\-\-parameters flag does not process the template, can.t be used with \-\-raw' 
35
-os::cmd::expect_failure_and_text 'oc process template-name --parameters --template=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-template' 
36
-os::cmd::expect_failure_and_text 'oc process template-name --parameters -t someval' '\-\-parameters flag does not process the template, can.t be used with \-\-template' 
27
+os::cmd::expect_failure_and_text 'oc process template-name --parameters --value=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-value'
28
+os::cmd::expect_failure_and_text 'oc process template-name --parameters -v someval' '\-\-parameters flag does not process the template, can.t be used with \-\-value'
29
+os::cmd::expect_failure_and_text 'oc process template-name --parameters --labels=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-labels'
30
+os::cmd::expect_failure_and_text 'oc process template-name --parameters -l someval' '\-\-parameters flag does not process the template, can.t be used with \-\-labels'
31
+os::cmd::expect_failure_and_text 'oc process template-name --parameters --output=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-output'
32
+os::cmd::expect_failure_and_text 'oc process template-name --parameters -o someval' '\-\-parameters flag does not process the template, can.t be used with \-\-output'
33
+os::cmd::expect_failure_and_text 'oc process template-name --parameters --output-version=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-output-version'
34
+os::cmd::expect_failure_and_text 'oc process template-name --parameters --raw' '\-\-parameters flag does not process the template, can.t be used with \-\-raw'
35
+os::cmd::expect_failure_and_text 'oc process template-name --parameters --template=someval' '\-\-parameters flag does not process the template, can.t be used with \-\-template'
36
+os::cmd::expect_failure_and_text 'oc process template-name --parameters -t someval' '\-\-parameters flag does not process the template, can.t be used with \-\-template'
37 37
 
38 38
 # providing a value more than once should fail
39 39
 os::cmd::expect_failure_and_text 'oc process template-name key=value key=value' 'provided more than once: key'
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 os::test::junit::declare_suite_start "cmd/projects"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 os::test::junit::declare_suite_start "cmd/quota"
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -1,12 +1,5 @@
1 1
 #!/bin/bash
2
-
3
-set -o errexit
4
-set -o nounset
5
-set -o pipefail
6
-
7
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
8
-source "${OS_ROOT}/hack/lib/init.sh"
9
-os::log::stacktrace::install
2
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 3
 trap os::test::junit::reconcile_output EXIT
11 4
 
12 5
 # Cleanup cluster resources created by this test
... ...
@@ -2,14 +2,8 @@
2 2
 
3 3
 # This script tests the high level end-to-end functionality demonstrated
4 4
 # as part of the examples/sample-app
5
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
5 6
 
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
11
-source "${OS_ROOT}/hack/lib/init.sh"
12
-os::log::stacktrace::install
13 7
 os::util::environment::setup_time_vars
14 8
 trap os::test::junit::reconcile_output EXIT
15 9
 
... ...
@@ -227,7 +221,7 @@ os::cmd::expect_success 'oc policy add-role-to-user system:image-puller system:a
227 227
 os::cmd::try_until_text 'oc policy who-can get imagestreams/layers -n custom' 'system:anonymous'
228 228
 os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/custom/cross:namespace-pull"
229 229
 os::cmd::expect_success "docker pull ${DOCKER_REGISTRY}/custom/cross:namespace-pull-id"
230
-# unauthorized pushes return authorization errors, regardless of backing data 
230
+# unauthorized pushes return authorization errors, regardless of backing data
231 231
 os::cmd::expect_failure_and_text "docker push ${DOCKER_REGISTRY}/missing/image:tag"              "authentication required"
232 232
 os::cmd::expect_failure_and_text "docker push ${DOCKER_REGISTRY}/custom/cross:namespace-pull"    "authentication required"
233 233
 os::cmd::expect_failure_and_text "docker push ${DOCKER_REGISTRY}/custom/cross:namespace-pull-id" "authentication required"
... ...
@@ -1,14 +1,7 @@
1 1
 #!/bin/bash
2 2
 #
3 3
 # This script will run all test scripts that are in test/extended.
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/lib/init.sh"
11
-cd "${OS_ROOT}"
4
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
12 5
 
13 6
 test_scripts=`find test/extended -maxdepth 1 -name "*.sh" -not  \( -name "all.sh" \)`
14 7
 
... ...
@@ -1,15 +1,7 @@
1 1
 #!/bin/bash
2 2
 #
3 3
 # This scripts starts the OpenShift server with custom TLS certs, and verifies generated kubeconfig files can be used to talk to it.
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
10
-cd "${OS_ROOT}"
11
-source "${OS_ROOT}/hack/lib/init.sh"
12
-os::log::stacktrace::install
4
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
13 5
 
14 6
 os::util::environment::setup_all_server_vars "test-extended-alternate-certs/"
15 7
 reset_tmp_dir
... ...
@@ -52,8 +44,8 @@ os::cmd::expect_success "openshift start --master=https://localhost:${API_PORT}
52 52
 # Don't try this at home.  We don't have flags for setting etcd ports in the config, but we want deconflicted ones.  Use sed to replace defaults in a completely unsafe way
53 53
 os::util::sed "s/:4001$/:${ETCD_PORT}/g" master/master-config.yaml
54 54
 os::util::sed "s/:7001$/:${ETCD_PEER_PORT}/g" master/master-config.yaml
55
-# replace top-level namedCertificates config 
56
-os::util::sed 's#^  namedCertificates: null#  namedCertificates: [{"certFile":"custom.crt","keyFile":"custom.key","names":["localhost"]}]#' master/master-config.yaml 
55
+# replace top-level namedCertificates config
56
+os::util::sed 's#^  namedCertificates: null#  namedCertificates: [{"certFile":"custom.crt","keyFile":"custom.key","names":["localhost"]}]#' master/master-config.yaml
57 57
 
58 58
 # Start master
59 59
 OPENSHIFT_PROFILE=web OPENSHIFT_ON_PANIC=crash openshift start master \
... ...
@@ -3,15 +3,7 @@
3 3
 # This scripts starts the OpenShift server with a default configuration.
4 4
 # The OpenShift Docker registry and router are installed.
5 5
 # It will run all tests that are imported into test/extended.
6
-
7
-set -o errexit
8
-set -o nounset
9
-set -o pipefail
10
-
11
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
12
-cd "${OS_ROOT}"
13
-source "${OS_ROOT}/hack/lib/init.sh"
14
-os::log::stacktrace::install
6
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
15 7
 
16 8
 os::util::environment::setup_all_server_vars "test-extended-alternate-launches/"
17 9
 reset_tmp_dir
... ...
@@ -4,18 +4,9 @@
4 4
 # No registry or router is setup.
5 5
 # It is intended to test cli commands that may require docker and therefore
6 6
 # cannot be run under Travis.
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/lib/init.sh"
14
-os::log::stacktrace::install
7
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
15 8
 os::util::environment::setup_time_vars
16 9
 
17
-cd "${OS_ROOT}"
18
-
19 10
 os::build::setup_env
20 11
 
21 12
 function cleanup()
... ...
@@ -1,14 +1,8 @@
1 1
 #!/bin/bash
2 2
 #
3 3
 # Runs the conformance extended tests for OpenShift
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
8
-
9
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
4
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
10 5
 source "${OS_ROOT}/test/extended/setup.sh"
11
-cd "${OS_ROOT}"
12 6
 
13 7
 os::test::extended::setup
14 8
 os::test::extended::focus "$@"
... ...
@@ -2,14 +2,8 @@
2 2
 #
3 3
 # Runs all standard extended tests against either an existing cluster (TEST_ONLY=1)
4 4
 # or a standard started server.
5
-
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
9
-
10
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
5
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
11 6
 source "${OS_ROOT}/test/extended/setup.sh"
12
-cd "${OS_ROOT}"
13 7
 
14 8
 os::test::extended::setup
15 9
 os::test::extended::focus "$@"
... ...
@@ -1,27 +1,19 @@
1 1
 #!/usr/bin/env bash
2 2
 #
3 3
 # Extended tests for logging in using GSSAPI
4
-
5
-set -o errexit
6
-set -o nounset
7
-set -o pipefail
4
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
8 5
 
9 6
 starttime="$(date +%s)"
10 7
 
11 8
 project_name='gssapiproxy'
12 9
 test_name="test-extended/${project_name}"
13 10
 
14
-OS_ROOT="$(dirname "${BASH_SOURCE}")/../.."
15
-cd "${OS_ROOT}"
16
-source hack/lib/init.sh
17
-
18 11
 os::build::setup_env
19 12
 
20 13
 os::util::environment::setup_time_vars
21 14
 os::util::environment::setup_all_server_vars "${test_name}"
22 15
 os::util::environment::use_sudo
23 16
 
24
-os::log::stacktrace::install
25 17
 os::log::start_system_logger
26 18
 
27 19
 ensure_iptables_or_die
... ...
@@ -3,18 +3,9 @@
3 3
 # This scripts starts the OpenShift server with a default configuration.
4 4
 # The OpenShift Docker registry and router are installed.
5 5
 # It will run all tests that are imported into test/extended.
6
-
7
-set -o errexit
8
-set -o nounset
9
-set -o pipefail
10
-
11
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
12
-source "${OS_ROOT}/hack/lib/init.sh"
13
-os::log::stacktrace::install
6
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
14 7
 os::util::environment::setup_time_vars
15 8
 
16
-cd "${OS_ROOT}"
17
-
18 9
 os::build::setup_env
19 10
 
20 11
 function cleanup()
... ...
@@ -2,10 +2,7 @@
2 2
 
3 3
 # This script runs the networking e2e tests. See CONTRIBUTING.adoc for
4 4
 # documentation.
5
-
6
-set -o errexit
7
-set -o nounset
8
-set -o pipefail
5
+source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
9 6
 
10 7
 if [[ -n "${OPENSHIFT_VERBOSE_OUTPUT:-}" ]]; then
11 8
   set -o xtrace
... ...
@@ -15,10 +12,6 @@ fi
15 15
 # Ensure that subshells inherit bash settings (specifically xtrace)
16 16
 export SHELLOPTS
17 17
 
18
-OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
19
-source "${OS_ROOT}/hack/lib/init.sh"
20
-os::log::stacktrace::install
21
-
22 18
 # These strings filter the available tests.
23 19
 #
24 20
 # The EmptyDir test is a canary; it will fail if mount propagation is
... ...
@@ -1,4 +1,4 @@
1
-  #!/bin/bash
1
+#!/bin/bash
2 2
 #
3 3
 # This abstracts starting up an extended server.
4 4
 
... ...
@@ -21,9 +21,6 @@ function os::test::extended::focus {
21 21
 #   and then tests are executed.  Tests that depend on fine grained setup should
22 22
 #   be done in other contexts.
23 23
 function os::test::extended::setup {
24
-  source "${OS_ROOT}/hack/lib/init.sh"
25
-  os::log::stacktrace::install
26
-
27 24
   # build binaries
28 25
   if [[ -z $(os::build::find-binary ginkgo) ]]; then
29 26
     hack/build-go.sh vendor/github.com/onsi/ginkgo/ginkgo