diff --git a/ci_tests/cleanup_basic_grb_test.sh b/ci_tests/cleanup_basic_grb_test.sh
index 52205d1395d99c7c67de680f7958e0edd1ff6f95..31dbb28bb551d3f72d05c430563a26d4886a3300 100755
--- a/ci_tests/cleanup_basic_grb_test.sh
+++ b/ci_tests/cleanup_basic_grb_test.sh
@@ -1,3 +1,23 @@
 #!/usr/bin/env bash
 
-helm uninstall ${GRB_RELEASE_NAME}
\ No newline at end of file
+debug() {
+    >&2 echo "DEBUG: $@"
+}
+
+error() {
+    >&2 echo "ERROR: $@"
+    exit 1
+}
+
+check_and_uninstall() {
+    release_name=$1
+    if [[ -z ${release_name} ]]; then
+        # the chart was never created
+        return
+    fi
+    debug "Uninstalling ${release_name}"
+    helm uninstall ${release_name} | error "Could not uninstall chart $release_name"
+}
+
+source ./ci_tests/get_release_names.sh
+check_and_uninstall ${GRB_RELEASE_NAME}
\ No newline at end of file
diff --git a/ci_tests/get_release_names.sh b/ci_tests/get_release_names.sh
new file mode 100755
index 0000000000000000000000000000000000000000..35c0c80896a68af6b12e5218c371c2ded02d2830
--- /dev/null
+++ b/ci_tests/get_release_names.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+export RELEASE_PREFIX="${CI_JOB_NAME//_/-}-${CI_JOB_ID//_/-}"
+export GRB_RELEASE_NAME="${RELEASE_PREFIX}-cspp-geo-grb"
diff --git a/ci_tests/gitlab-ci.yaml b/ci_tests/gitlab-ci.yaml
index 6cd94264805a705eee20a463459c826908260ca9..1fe1f8eb0d416c5a2d039e6b9e98c64d1d58756d 100644
--- a/ci_tests/gitlab-ci.yaml
+++ b/ci_tests/gitlab-ci.yaml
@@ -70,8 +70,7 @@ test_basic_grb:
   extends: .helm_based_job
   stage: test
   script:
-    # need to source to get release name variables for cleanup
-    - source ./ci_tests/run_basic_grb_test.sh
+    - ./ci_tests/run_basic_grb_test.sh
   after_script:
     - ./ci_tests/cleanup_basic_grb_test.sh
   dependencies:
diff --git a/ci_tests/run_basic_grb_test.sh b/ci_tests/run_basic_grb_test.sh
index b509b929f93e3ed171bacc90d59300177eb63da1..aec9c0e9372b6d0400240d3da75902f6fa0f60f1 100755
--- a/ci_tests/run_basic_grb_test.sh
+++ b/ci_tests/run_basic_grb_test.sh
@@ -12,15 +12,17 @@ error() {
 set -e
 
 ns=$(./helpers/get_namespace.sh)
-cd geosphere-grb/chart
-export RELEASE_PREFIX="${CI_JOB_NAME//_/-}-${CI_JOB_ID//_/-}"
-export GRB_RELEASE_NAME="${RELEASE_PREFIX}-cspp-geo-grb"
+pushd geosphere-grb/chart
+source ci_tests/get_release_names.sh
 helm upgrade -v 2 --install --namespace $ns -f ../../ci_tests/values-grb-g16.yaml ${GRB_RELEASE_NAME} cspp-geo-grb/
+popd
 
 # give kubernetes a bit to create the pod
-sleep 5
+sleep 30
 
+debug "Getting pod name"
 GRB_POD_NAME=$(kubectl -n $ns get pods --selector=app.kubernetes.io/instance=${GRB_RELEASE_NAME} -o name)
+debug "GRB pod name: ${GRB_POD_NAME}"
 count=0
 while true; do
   num_files=$(kubectl exec -n $ns ${GRB_POD_NAME} -- ls -1 /dst/products | wc -l)