Skip to content

Commit b19fb0a

Browse files
committed
Clean up artifacts variables in hack scripts
1 parent f2d7eed commit b19fb0a

File tree

8 files changed

+30
-18
lines changed

8 files changed

+30
-18
lines changed

hack/jenkins/benchmark-dockerized.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ retry go get github.com/cespare/prettybench
3939
export KUBE_RACE=" "
4040
# Disable coverage report
4141
export KUBE_COVER="n"
42-
export ARTIFACTS_DIR=${WORKSPACE}/_artifacts
42+
export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"}
4343

44-
mkdir -p "${ARTIFACTS_DIR}"
44+
mkdir -p "${ARTIFACTS}"
4545
cd /go/src/k8s.io/kubernetes
4646

4747
./hack/install-etcd.sh
4848

4949
# Run the benchmark tests and pretty-print the results into a separate file.
5050
make test-integration WHAT="$*" KUBE_TEST_ARGS="-run='XXX' -bench=. -benchmem" \
5151
| tee \
52-
>(prettybench -no-passthrough > ${ARTIFACTS_DIR}/BenchmarkResults.txt) \
53-
>(go run test/integration/benchmark/jsonify/main.go ${ARTIFACTS_DIR}/BenchmarkResults_benchmark_$(date -u +%Y-%m-%dT%H:%M:%SZ).json || cat > /dev/null)
52+
>(prettybench -no-passthrough > ${ARTIFACTS}/BenchmarkResults.txt) \
53+
>(go run test/integration/benchmark/jsonify/main.go ${ARTIFACTS}/BenchmarkResults_benchmark_$(date -u +%Y-%m-%dT%H:%M:%SZ).json || cat > /dev/null)

hack/jenkins/gotest.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ go get -u github.com/jstemmer/go-junit-report
3636

3737
# Enable the Go race detector.
3838
export KUBE_RACE=-race
39-
# Produce a JUnit-style XML test report for Jenkins.
40-
export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/_artifacts
39+
# Set artifacts directory
40+
export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"}
41+
# Produce a JUnit-style XML test report
42+
export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}"
4143
# Save the verbose stdout as well.
4244
export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y
4345

hack/jenkins/test-dockerized.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ retry go get github.com/jstemmer/go-junit-report
3939
export KUBE_RACE=-race
4040
# Disable coverage report
4141
export KUBE_COVER="n"
42-
# Produce a JUnit-style XML test report for Jenkins.
43-
export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/artifacts
44-
export ARTIFACTS_DIR=${WORKSPACE}/artifacts
42+
# Set artifacts directory
43+
export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"}
44+
# Produce a JUnit-style XML test report
45+
export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}"
4546
# Save the verbose stdout as well.
4647
export KUBE_KEEP_VERBOSE_TEST_OUTPUT=y
4748
export KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=4

hack/jenkins/verify-dockerized.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ retry() {
3131

3232
export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
3333

34-
# Produce a JUnit-style XML test report
35-
export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/artifacts
3634
# Set artifacts directory
37-
export ARTIFACTS_DIR=${WORKSPACE}/artifacts
35+
export ARTIFACTS=${ARTIFACTS:-"${WORKSPACE}/artifacts"}
36+
# Produce a JUnit-style XML test report
37+
export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}"
3838

3939
export LOG_LEVEL=4
4040

hack/lib/etcd.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ kube::etcd::start() {
7070

7171
# Start etcd
7272
ETCD_DIR=${ETCD_DIR:-$(mktemp -d 2>/dev/null || mktemp -d -t test-etcd.XXXXXX)}
73-
if [[ -d "${ARTIFACTS_DIR:-}" ]]; then
74-
ETCD_LOGFILE="${ARTIFACTS_DIR}/etcd.$(uname -n).$(id -un).log.DEBUG.$(date +%Y%m%d-%H%M%S).$$"
73+
if [[ -d "${ARTIFACTS:-}" ]]; then
74+
ETCD_LOGFILE="${ARTIFACTS}/etcd.$(uname -n).$(id -un).log.DEBUG.$(date +%Y%m%d-%H%M%S).$$"
7575
else
7676
ETCD_LOGFILE=${ETCD_LOGFILE:-"/dev/null"}
7777
fi

hack/make-rules/test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ KUBE_TEST_API_VERSIONS="${KUBE_TEST_API_VERSIONS:-${ALL_VERSIONS_CSV}}"
120120
# once we have multiple group supports
121121
# Create a junit-style XML test report in this directory if set.
122122
KUBE_JUNIT_REPORT_DIR=${KUBE_JUNIT_REPORT_DIR:-}
123+
# If KUBE_JUNIT_REPORT_DIR is unset, and ARTIFACTS is set, then have them match.
124+
if [[ -z "${KUBE_JUNIT_REPORT_DIR:-}" && -n "${ARTIFACTS:-}" ]]; then
125+
export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}"
126+
fi
123127
# Set to 'y' to keep the verbose stdout from tests when KUBE_JUNIT_REPORT_DIR is
124128
# set.
125129
KUBE_KEEP_VERBOSE_TEST_OUTPUT=${KUBE_KEEP_VERBOSE_TEST_OUTPUT:-n}

hack/make-rules/verify.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ set -o pipefail
2121
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
2222
source "${KUBE_ROOT}/hack/lib/util.sh"
2323

24+
# If KUBE_JUNIT_REPORT_DIR is unset, and ARTIFACTS is set, then have them match.
25+
if [[ -z "${KUBE_JUNIT_REPORT_DIR:-}" && -n "${ARTIFACTS:-}" ]]; then
26+
export KUBE_JUNIT_REPORT_DIR="${ARTIFACTS}"
27+
fi
28+
2429
# include shell2junit library
2530
source "${KUBE_ROOT}/third_party/forked/shell2junit/sh2ju.sh"
2631

hack/verify-godeps.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ pushd "${KUBE_ROOT}" > /dev/null 2>&1
9494
echo "(The above output can be saved as godepdiff.patch if you're not running this locally)" >&2
9595
echo "(The patch file should also be exported as a build artifact if run through CI)" >&2
9696
KEEP_TMP=true
97-
if [[ -f godepdiff.patch && -d "${ARTIFACTS_DIR:-}" ]]; then
97+
if [[ -f godepdiff.patch && -d "${ARTIFACTS:-}" ]]; then
9898
echo "Copying patch to artifacts.."
99-
cp godepdiff.patch "${ARTIFACTS_DIR:-}/"
99+
cp godepdiff.patch "${ARTIFACTS:-}/"
100100
fi
101101
ret=1
102102
fi
@@ -111,9 +111,9 @@ pushd "${KUBE_ROOT}" > /dev/null 2>&1
111111
echo "(The above output can be saved as godepdiff.patch if you're not running this locally)" >&2
112112
echo "(The patch file should also be exported as a build artifact if run through CI)" >&2
113113
KEEP_TMP=true
114-
if [[ -f vendordiff.patch && -d "${ARTIFACTS_DIR:-}" ]]; then
114+
if [[ -f vendordiff.patch && -d "${ARTIFACTS:-}" ]]; then
115115
echo "Copying patch to artifacts.."
116-
cp vendordiff.patch "${ARTIFACTS_DIR:-}/"
116+
cp vendordiff.patch "${ARTIFACTS:-}/"
117117
fi
118118
ret=1
119119
fi

0 commit comments

Comments
 (0)