summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-04 18:06:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-04 18:06:28 +0000
commit7b25b12016eeca73262cf2a618b411fb911295e1 (patch)
tree9198dc42c9f1151184f276d11d90c5193544eb1c /scripts
parentaa542224bb345acf0cb9a1a606f0a802c16b0336 (diff)
downloadgitlab-ce-7b25b12016eeca73262cf2a618b411fb911295e1.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/review_apps/review-apps.sh50
1 files changed, 19 insertions, 31 deletions
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index fbef3ebd231..b405e992b63 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -179,6 +179,17 @@ function create_application_secret() {
"${CI_ENVIRONMENT_SLUG}-gitlab-initial-root-password" \
--from-literal="password=${REVIEW_APPS_ROOT_PASSWORD}" \
--dry-run -o json | kubectl apply -f -
+
+ if [ -z "${REVIEW_APPS_EE_LICENSE}" ]; then echo "License not found" && return; fi
+
+ echoinfo "Creating the ${CI_ENVIRONMENT_SLUG}-gitlab-license secret in the ${KUBE_NAMESPACE} namespace..." true
+
+ echo "${REVIEW_APPS_EE_LICENSE}" > /tmp/license.gitlab
+
+ kubectl create secret generic -n "$KUBE_NAMESPACE" \
+ "${CI_ENVIRONMENT_SLUG}-gitlab-license" \
+ --from-file=license=/tmp/license.gitlab \
+ --dry-run -o json | kubectl apply -f -
}
function download_chart() {
@@ -252,6 +263,14 @@ HELM_CMD=$(cat << EOF
EOF
)
+if [ -n "${REVIEW_APPS_EE_LICENSE}" ]; then
+HELM_CMD=$(cat << EOF
+ ${HELM_CMD} \
+ --set global.gitlab.license.secret="${CI_ENVIRONMENT_SLUG}-gitlab-license"
+EOF
+)
+fi
+
HELM_CMD=$(cat << EOF
${HELM_CMD} \
--namespace="$KUBE_NAMESPACE" \
@@ -276,34 +295,3 @@ function display_deployment_debug() {
echoinfo "Unsuccessful Jobs for release ${CI_ENVIRONMENT_SLUG}"
kubectl get jobs -n "$KUBE_NAMESPACE" -lrelease=${CI_ENVIRONMENT_SLUG} --field-selector=status.successful!=1
}
-
-function add_license() {
- if [ -z "${REVIEW_APPS_EE_LICENSE}" ]; then echo "License not found" && return; fi
-
- task_runner_pod=$(get_pod "task-runner");
- if [ -z "${task_runner_pod}" ]; then echo "Task runner pod not found" && return; fi
-
- echoinfo "Installing license..." true
-
- echo "${REVIEW_APPS_EE_LICENSE}" > /tmp/license.gitlab
- kubectl -n "$KUBE_NAMESPACE" cp /tmp/license.gitlab "${task_runner_pod}":/tmp/license.gitlab
- rm /tmp/license.gitlab
-
- kubectl -n "$KUBE_NAMESPACE" exec -it "${task_runner_pod}" -- /srv/gitlab/bin/rails runner -e production \
- '
- content = File.read("/tmp/license.gitlab").strip;
- FileUtils.rm_f("/tmp/license.gitlab");
-
- unless License.where(data:content).empty?
- puts "License already exists";
- Kernel.exit 0;
- end
-
- unless License.new(data: content).save
- puts "Could not add license";
- Kernel.exit 0;
- end
-
- puts "License added";
- '
-}