Browse code

Refactored scripts to use binaries directly now that they're in PATH

Once the $PATH was amended to search the Origin output binary directory
first and foremost, it is no longer necessary to search for binaries
before using them.

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

Steve Kuznetsov authored on 2016/11/08 01:18:11
Showing 18 changed files
... ...
@@ -8,7 +8,7 @@ source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
8 8
 os::util::ensure::built_binary_exists 'oc'
9 9
 
10 10
 function build() {
11
-  eval "'${oc}' ex dockerbuild $2 $1 ${OS_BUILD_IMAGE_ARGS:-}"
11
+  eval "oc ex dockerbuild $2 $1 ${OS_BUILD_IMAGE_ARGS:-}"
12 12
 }
13 13
 
14 14
 # Build the images
... ...
@@ -47,7 +47,7 @@ fi
47 47
 os::util::ensure::built_binary_exists 'oc'
48 48
 
49 49
 function build() {
50
-  eval "'${oc}' ex dockerbuild $2 $1 ${OS_BUILD_IMAGE_ARGS:-}"
50
+  eval "oc ex dockerbuild $2 $1 ${OS_BUILD_IMAGE_ARGS:-}"
51 51
 }
52 52
 
53 53
 # Create link to file if the FS supports hardlinks, otherwise copy the file
... ...
@@ -1,5 +1,5 @@
1 1
 #!/bin/bash
2 2
 source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
3 3
 
4
-$godepchecker "$@"
5 4
 os::util::ensure::built_binary_exists 'godepchecker'
5
+godepchecker "$@"
... ...
@@ -38,14 +38,14 @@ function cleanup()
38 38
       os::test::junit::check_test_counters
39 39
 
40 40
       # use the junitreport tool to generate us a report
41
-      cat "${JUNIT_REPORT_OUTPUT}"                             \
42
-        | "${junitreport}" --type oscmd                        \
43
-                           --suites nested                     \
44
-                           --roots github.com/openshift/origin \
45
-                           --output "${ARTIFACT_DIR}/report.xml"
46
-      cat "${ARTIFACT_DIR}/report.xml" | "${junitreport}" summarize
47 41
       os::util::ensure::built_binary_exists 'junitreport'
48 42
 
43
+      cat "${JUNIT_REPORT_OUTPUT}"                        \
44
+        | junitreport --type oscmd                        \
45
+                      --suites nested                     \
46
+                      --roots github.com/openshift/origin \
47
+                      --output "${ARTIFACT_DIR}/report.xml"
48
+      cat "${ARTIFACT_DIR}/report.xml" | junitreport summarize
49 49
     fi
50 50
 
51 51
     ENDTIME=$(date +%s); echo "$0 took $(($ENDTIME - $STARTTIME)) seconds"
... ...
@@ -212,18 +212,18 @@ if [[ -n "${junit_report}" ]]; then
212 212
 
213 213
     go test ${gotest_flags} ${test_packages} 2>"${test_error_file}" \
214 214
         | tee "${test_output_file}"                                 \
215
-        | "${junitreport}" --type gotest                            \
216
-                           --suites nested                          \
217
-                           --roots github.com/openshift/origin      \
218
-                           --stream                                 \
219
-                           --output "${junit_report_file}"
215
+        | junitreport --type gotest                                 \
216
+                      --suites nested                               \
217
+                      --roots github.com/openshift/origin           \
218
+                      --stream                                      \
219
+                      --output "${junit_report_file}"
220 220
 
221 221
     test_return_code="${PIPESTATUS[0]}"
222 222
 
223 223
     set -o pipefail
224 224
 
225 225
     echo
226
-    summary="$( "${junitreport}" summarize < "${junit_report_file}" )"
226
+    summary="$( junitreport summarize < "${junit_report_file}" )"
227 227
     echo "${summary}"
228 228
 
229 229
     if echo "${summary}" | grep -q ', 0 failed,'; then
... ...
@@ -16,4 +16,4 @@ echo
16 16
 REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY="${REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY:-/tmp/registry}" \
17 17
   DOCKER_REGISTRY_URL="${url}" \
18 18
 	KUBECONFIG=openshift.local.config/master/openshift-registry.kubeconfig \
19
-	${dockerregistry} images/dockerregistry/config.yml
19
+	dockerregistry images/dockerregistry/config.yml
... ...
@@ -23,7 +23,7 @@ function generate_clientset_for() {
23 23
   local package="$1";shift
24 24
   local name="$1";shift
25 25
   echo "-- Generating ${name} client set for ${package} ..."
26
-  $clientgen --clientset-path="${package}/client/clientset_generated" \
26
+  client-gen --clientset-path="${package}/client/clientset_generated" \
27 27
              --clientset-api-path="/oapi"                             \
28 28
              --input-base="${package}/api"                            \
29 29
              --output-base="../../.."                                 \
... ...
@@ -5,4 +5,4 @@ os::build::setup_env
5 5
 
6 6
 os::util::ensure::built_binary_exists 'genconversion'
7 7
 
8
-${genconversion} --output-base="${GOPATH}/src" "$@"
9 8
\ No newline at end of file
9
+genconversion --output-base="${GOPATH}/src" "$@"
10 10
\ No newline at end of file
... ...
@@ -5,4 +5,4 @@ os::build::setup_env
5 5
 
6 6
 os::util::ensure::built_binary_exists 'gendeepcopy'
7 7
 
8
-${gendeepcopy} --output-base="${GOPATH}/src" "$@"
9 8
\ No newline at end of file
9
+gendeepcopy --output-base="${GOPATH}/src" "$@"
10 10
\ No newline at end of file
... ...
@@ -25,4 +25,4 @@ os::build::setup_env
25 25
 os::util::ensure::built_binary_exists 'genprotobuf'
26 26
 os::util::ensure::built_binary_exists 'protoc-gen-gogo' vendor/k8s.io/kubernetes/cmd/libs/go2idl/go-to-protobuf/protoc-gen-gogo
27 27
 
28
-PATH="$( dirname "${genprotobuf}" ):${PATH}" ${genprotobuf} --output-base="${GOPATH}/src" "$@"
28
+genprotobuf --output-base="${GOPATH}/src" "$@"
... ...
@@ -30,7 +30,7 @@ fi
30 30
 failed='false'
31 31
 for file in ${source_files}; do
32 32
 	swagger_file="$( dirname "${file}" )/swagger_doc.go"
33
-	if ! ${genswaggerdoc} --input="${file}" --verify >/tmp/openshift/generate/swaggerdoc/verify.txt 2>&1; then
33
+	if ! genswaggerdoc --input="${file}" --verify >/tmp/openshift/generate/swaggerdoc/verify.txt 2>&1; then
34 34
 		echo "[ERROR] Errors in \"${file}\" must be addressed before Swagger documentation can be generated:"
35 35
 		cat /tmp/openshift/generate/swaggerdoc/verify.txt
36 36
 		failed='true'
... ...
@@ -45,7 +45,7 @@ for file in ${source_files}; do
45 45
 // by hack/update-generated-swagger-descriptions.sh and should be run after a full build of OpenShift.
46 46
 // ==== DO NOT EDIT THIS FILE MANUALLY ====
47 47
 " >> "${tmp_output_file}"
48
-		${genswaggerdoc} --input="${file}" --output="${tmp_output_file}"
48
+		genswaggerdoc --input="${file}" --output="${tmp_output_file}"
49 49
 		gofmt -s -w "${tmp_output_file}"
50 50
 
51 51
 		if [[ -n "${verify}" ]]; then
... ...
@@ -6,7 +6,7 @@ echo "===== Verifying CLI Conventions ====="
6 6
 # ensure we have the latest compiled binaries
7 7
 os::util::ensure::built_binary_exists 'clicheck'
8 8
 
9
-if ! output=`$clicheck 2>&1`
9
+if ! output=$(clicheck 2>&1)
10 10
 then
11 11
 	echo "FAILURE: CLI is not following one or more required conventions:"
12 12
 	echo "$output"
... ...
@@ -2,7 +2,7 @@
2 2
 source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
3 3
 
4 4
 os::golang::verify_go_version
5
-os::golang::verify_golint_version
5
+os::util::ensure::system_binary_exists 'golint'
6 6
 
7 7
 arg="${1:-""}"
8 8
 bad_files=""
... ...
@@ -9,5 +9,5 @@ fi
9 9
 os::util::ensure::built_binary_exists 'commitchecker'
10 10
 
11 11
 echo "===== Verifying UPSTREAM Commits ====="
12
-$commitchecker
12
+commitchecker
13 13
 echo "SUCCESS: All commits are valid."
... ...
@@ -21,8 +21,8 @@ ss=$(join '|' "${serial_exclude[@]}")
21 21
 
22 22
 
23 23
 os::log::info "Running the following tests:"
24
-TEST_REPORT_DIR= TEST_OUTPUT_QUIET=true ${EXTENDEDTEST} "--ginkgo.focus=${pf}" "--ginkgo.skip=${ps}" --ginkgo.dryRun --ginkgo.noColor | grep ok | grep -v skip | cut -c 20- | sort
25
-TEST_REPORT_DIR= TEST_OUTPUT_QUIET=true ${EXTENDEDTEST} "--ginkgo.focus=${sf}" "--ginkgo.skip=${ss}" --ginkgo.dryRun --ginkgo.noColor | grep ok | grep -v skip | cut -c 20- | sort
24
+TEST_REPORT_DIR= TEST_OUTPUT_QUIET=true extended.test "--ginkgo.focus=${pf}" "--ginkgo.skip=${ps}" --ginkgo.dryRun --ginkgo.noColor | grep ok | grep -v skip | cut -c 20- | sort
25
+TEST_REPORT_DIR= TEST_OUTPUT_QUIET=true extended.test "--ginkgo.focus=${sf}" "--ginkgo.skip=${ss}" --ginkgo.dryRun --ginkgo.noColor | grep ok | grep -v skip | cut -c 20- | sort
26 26
 echo
27 27
 
28 28
 exitstatus=0
... ...
@@ -30,10 +30,10 @@ exitstatus=0
30 30
 # run parallel tests
31 31
 nodes="${PARALLEL_NODES:-5}"
32 32
 os::log::info "Running parallel tests N=${nodes}"
33
-TEST_REPORT_FILE_NAME=conformance_parallel ${GINKGO} -v "-focus=${pf}" "-skip=${ps}" -p -nodes "${nodes}" ${EXTENDEDTEST} -- -ginkgo.v -test.timeout 6h || exitstatus=$?
33
+TEST_REPORT_FILE_NAME=conformance_parallel ginkgo -v "-focus=${pf}" "-skip=${ps}" -p -nodes "${nodes}" "$( os::util::find::built_binary extended.test )" -- -ginkgo.v -test.timeout 6h || exitstatus=$?
34 34
 
35 35
 # run tests in serial
36 36
 os::log::info "Running serial tests"
37
-TEST_REPORT_FILE_NAME=conformance_serial ${GINKGO} -v "-focus=${sf}" "-skip=${ss}" ${EXTENDEDTEST} -- -ginkgo.v -test.timeout 2h || exitstatus=$?
37
+TEST_REPORT_FILE_NAME=conformance_serial ginkgo -v "-focus=${sf}" "-skip=${ss}" "$( os::util::find::built_binary extended.test )" -- -ginkgo.v -test.timeout 2h || exitstatus=$?
38 38
 
39 39
 exit $exitstatus
... ...
@@ -47,14 +47,14 @@ function cleanup() {
47 47
       os::test::junit::check_test_counters
48 48
 
49 49
       # use the junitreport tool to generate us a report
50
-      cat "${JUNIT_REPORT_OUTPUT}" "${junit_gssapi_output}"    \
51
-        | "${junitreport}" --type oscmd                        \
52
-                           --suites nested                     \
53
-                           --roots github.com/openshift/origin \
54
-                           --output "${ARTIFACT_DIR}/report.xml"
55
-      cat "${ARTIFACT_DIR}/report.xml" | "${junitreport}" summarize
56 50
       os::util::ensure::built_binary_exists 'junitreport'
57 51
 
52
+      cat "${JUNIT_REPORT_OUTPUT}" "${junit_gssapi_output}" \
53
+        | junitreport --type oscmd                          \
54
+                      --suites nested                       \
55
+                      --roots github.com/openshift/origin   \
56
+                      --output "${ARTIFACT_DIR}/report.xml"
57
+      cat "${ARTIFACT_DIR}/report.xml" | junitreport summarize
58 58
     fi
59 59
 
60 60
     endtime=$(date +%s); echo "$0 took $((endtime - starttime)) seconds"
... ...
@@ -216,7 +216,7 @@ function run-extended-tests() {
216 216
     local test_cmd="dlv exec ${extended_test} -- ${test_args}"
217 217
   else
218 218
     # run tests normally
219
-    local test_cmd="${TEST_BINARY} ${test_args}"
219
+    local test_cmd="extended.test ${test_args}"
220 220
   fi
221 221
 
222 222
   if [[ -n "${log_path}" ]]; then
... ...
@@ -268,7 +268,6 @@ else
268 268
   # cgo must be disabled to have the symbol table available
269 269
   CGO_ENABLED=0 hack/build-go.sh test/extended/extended.test
270 270
 fi
271
-TEST_BINARY="${OS_ROOT}/$(os::build::find-binary extended.test)"
272 271
 
273 272
 # enable-selinux/disable-selinux use the shared control variable
274 273
 # SELINUX_DISABLED to determine whether to re-enable selinux after it
... ...
@@ -11,7 +11,7 @@ function os::test::extended::focus {
11 11
 			os::log::error "No tests would be run"
12 12
 			exit 1
13 13
 		fi
14
-		${EXTENDEDTEST} "$@"
14
+		extended.test "$@"
15 15
 		exit $?
16 16
 	fi
17 17
 }
... ...
@@ -32,10 +32,6 @@ function os::test::extended::setup () {
32 32
 	os::util::environment::setup_all_server_vars "test-extended/core"
33 33
 
34 34
 	# ensure proper relative directories are set
35
-	GINKGO="$(os::build::find-binary ginkgo)"
36
-	EXTENDEDTEST="$(os::build::find-binary extended.test)"
37
-	export GINKGO
38
-	export EXTENDEDTEST
39 35
 	export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
40 36
 	export KUBE_REPO_ROOT="${OS_ROOT}/vendor/k8s.io/kubernetes"
41 37
 
... ...
@@ -175,7 +171,7 @@ function os::test::extended::test_list () {
175 175
 
176 176
 	while IFS= read -r; do
177 177
 		full_test_list+=( "${REPLY}" )
178
-	done < <(TEST_OUTPUT_QUIET=true "${EXTENDEDTEST}" "$@" --ginkgo.dryRun --ginkgo.noColor )
178
+	done < <(TEST_OUTPUT_QUIET=true extended.test "$@" --ginkgo.dryRun --ginkgo.noColor )
179 179
 	if [[ "{$REPLY}" ]]; then lines+=( "$REPLY" ); fi
180 180
 
181 181
 	for test in "${full_test_list[@]}"; do