diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-27 18:06:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-27 18:06:30 +0000 |
commit | 20758bc3b33c04121d214cb89646baf880037a27 (patch) | |
tree | 66b821724d9e050002a956acefc1111c2ef0feab /scripts | |
parent | a98649b71085bcd21af674a47d6a746336c56a65 (diff) | |
download | gitlab-ce-20758bc3b33c04121d214cb89646baf880037a27.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/review_apps/review-apps.sh | 22 | ||||
-rwxr-xr-x | scripts/trigger-build | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh index 1c33bff719d..62360dfe298 100755 --- a/scripts/review_apps/review-apps.sh +++ b/scripts/review_apps/review-apps.sh @@ -48,11 +48,31 @@ function delete_release() { return fi - echoinfo "Deleting release '${release}'..." true + helm_delete_release "${namespace}" "${release}" + kubectl_cleanup_release "${namespace}" "${release}" +} + +function helm_delete_release() { + local namespace="${1}" + local release="${2}" + + echoinfo "Deleting Helm release '${release}'..." true helm delete --tiller-namespace "${namespace}" --purge "${release}" } +function kubectl_cleanup_release() { + local namespace="${1}" + local release="${2}" + + echoinfo "Deleting all K8s resources matching '${release}'..." true + kubectl --namespace "${namespace}" get ingress,svc,pdb,hpa,deploy,statefulset,job,pod,secret,configmap,pvc,secret,clusterrole,clusterrolebinding,role,rolebinding,sa,crd 2>&1 \ + | grep "${release}" \ + | awk '{print $1}' \ + | xargs kubectl --namespace "${namespace}" delete \ + || true +} + function delete_failed_release() { local namespace="${KUBE_NAMESPACE}" local release="${CI_ENVIRONMENT_SLUG}" diff --git a/scripts/trigger-build b/scripts/trigger-build index 74c1df258c0..537b2692b27 100755 --- a/scripts/trigger-build +++ b/scripts/trigger-build @@ -71,7 +71,7 @@ module Trigger # Can be overridden def version_param_value(version_file) - File.read(version_file).strip + ENV[version_file]&.strip || File.read(version_file).strip end def variables |