Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-15 18:15:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-15 18:15:54 +0300
commit231a6ae572807c481b71d906cad717fdffc85e0f (patch)
tree8b2415e1d4420bb3a5a14b365a37c8ef92bf6728 /scripts
parent73b652cf4f890e91868055df8f76e6f869dd710d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/review_apps/review-apps.sh34
1 files changed, 28 insertions, 6 deletions
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index 81ff1db9478..695de95b8fc 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -1,5 +1,23 @@
[[ "$TRACE" ]] && set -x
+function namespace_exists() {
+ local namespace="${1}"
+ local namespace_exists
+
+ echoinfo "Checking if ${namespace} exists..." true
+
+ kubectl describe namespace "${namespace}" >/dev/null 2>&1
+ namespace_exists=$?
+
+ if [ $namespace_exists -eq 0 ]; then
+ echoinfo "Namespace ${namespace} found."
+ else
+ echoerr "Namespace ${namespace} NOT found."
+ fi
+
+ return $namespace_exists
+}
+
function deploy_exists() {
local namespace="${1}"
local release="${2}"
@@ -73,17 +91,20 @@ function delete_failed_release() {
# Cleanup and previous installs, as FAILED and PENDING_UPGRADE will cause errors with `upgrade`
if previous_deploy_failed "${namespace}" "${release}" ; then
echoinfo "Review App deployment in bad state, cleaning up namespace ${release}"
- delete_k8s_release_namespace
+ delete_namespace
else
echoinfo "Review App deployment in good state"
fi
fi
}
-function delete_k8s_release_namespace() {
+function delete_namespace() {
local namespace="${CI_ENVIRONMENT_SLUG}"
- kubectl delete namespace "${namespace}" --wait
+ if namespace_exists "${namespace}"; then
+ echoinfo "Deleting namespace ${namespace}..." true
+ kubectl delete namespace "${namespace}" --wait
+ fi
}
function get_pod() {
@@ -170,9 +191,10 @@ function check_kube_domain() {
function ensure_namespace() {
local namespace="${1}"
- echoinfo "Ensuring the ${namespace} namespace exists..." true
-
- kubectl describe namespace "${namespace}" || kubectl create namespace "${namespace}"
+ if ! namespace_exists "${namespace}"; then
+ echoinfo "Creating namespace ${namespace}..." true
+ kubectl create namespace "${namespace}"
+ fi
}
function label_namespace() {