feat: allow passing a fixed test namespace and token.
@@ -51,7 +51,9 @@ and the following options:
--clean Run clean builds (mvn clean)
--batch-mode Run mvn in batch mode
- --pool-namespace <ns> Specify the pool namespace to use for testing
+ --test-namespace <ns> The test namespace to use
+ --test-token <token> The token for the test namespace
+ --pool-namespace <ns> Specify the pool namespace to use for testing (mutually exclusive with --test-namespace)
--create-lock <prefix> Create project pool locks for system-tests for the projects with the given prefix
--help Display this help message
@@ -387,10 +389,15 @@ run_test() {
local initial_namespace=$(oc project -q)
local pool_namespace=$(readopt --pool-namespace)
+ local test_namespace=$(readopt --test-namespace)
+ local test_token=$(readopt --test-token)
+
local build_id=${JOB_NAME:-}${BUILD_NUMBER:-}
if [ -z "$build_id" ]; then
build_id="cli"
fi
+
+ if [ -z "$test_namespace" ] || [ -z "$test_token" ]; then
echo "Trying to allocate project for: $build_id"
if [ -z "$pool_namespace" ]; then
@@ -432,6 +439,13 @@ run_test() {
fi
trap "teardown_project_pool $namespace $pool_namespace $initial_namespace $initial_token" EXIT
+ else
+ echo "Using test namespace: $test_namespace"
+ namespace=$test_namespace
+ oc login --token=$test_token --server=$(current_server)
+ trap "oc login --token=$initial_token --server=$(current_server) && oc project $initial_namespace" EXIT
+ fi
+
oc project $namespace
export NAMESPACE_USE_EXISTING=$namespace
export KUBERNETES_NAMESPACE=$namespace
