Skip to content

Commit 8b75703

Browse files
committed
e2e: Add support for overriding the kubectl binary when gather artifacts
Signed-off-by: timflannagan <[email protected]>
1 parent 73a2b07 commit 8b75703

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: test/e2e/collect-ci-artifacts.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ set -o errexit
77
: "${KUBECONFIG:?}"
88
: "${TEST_NAMESPACE:?}"
99
: "${TEST_ARTIFACTS_DIR:?}"
10+
: "${KUBECTL:=kubectl}"
1011

12+
echo "Using the ${KUBECTL} kubectl binary"
13+
echo "Using the ${TEST_ARTIFACTS_DIR} output directory"
1114
mkdir -p "${TEST_ARTIFACTS_DIR}"
1215

1316
commands=()
@@ -23,5 +26,5 @@ echo "Storing the test artifact output in the ${TEST_ARTIFACTS_DIR} directory"
2326
for command in "${commands[@]}"; do
2427
echo "Collecting ${command} output..."
2528
COMMAND_OUTPUT_FILE=${TEST_ARTIFACTS_DIR}/${command// /_}
26-
kubectl -n ${TEST_NAMESPACE} ${command} >> "${COMMAND_OUTPUT_FILE}"
29+
${KUBECTL} -n ${TEST_NAMESPACE} ${command} >> "${COMMAND_OUTPUT_FILE}"
2730
done

Diff for: test/e2e/ctx/ctx.go

+4
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func (ctx TestContext) DumpNamespaceArtifacts(namespace string) error {
132132
"TEST_ARTIFACTS_DIR=" + logDir,
133133
"KUBECONFIG=" + kubeconfigPath,
134134
}
135+
kubectl := os.Getenv("KUBECTL")
136+
if kubectl != "" {
137+
envvars = append(envvars, fmt.Sprintf("KUBECTL=%s", kubectl))
138+
}
135139

136140
cmd := exec.Command(ctx.artifactsScriptPath)
137141
cmd.Env = append(cmd.Env, envvars...)

0 commit comments

Comments
 (0)