Commit 8a2e2414 authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

Add EE license to review app

parent 62ce7dd7
Pipeline #36269543 failed with stages
in 9 minutes and 42 seconds
......@@ -84,6 +84,7 @@ review:
- create_secret
- install_external_dns
- deploy
- add_license
- echo "export QA_ENVIRONMENT_URL=gitlab-$CI_ENVIRONMENT_SLUG.$AUTO_DEVOPS_DOMAIN" >> variables
- echo "export GITLAB_ROOT_DOMAIN=$CI_ENVIRONMENT_SLUG.$AUTO_DEVOPS_DOMAIN" >> variables
- echo "export GITLAB_URL=gitlab-$CI_ENVIRONMENT_SLUG.$AUTO_DEVOPS_DOMAIN" >> variables
......@@ -462,6 +463,42 @@ danger-review:
.
}
function add_license() {
if [ -z "${REVIEW_APPS_EE_LICENSE}" ]; then echo "License not found" && return; fi
while [ -z "$(kubectl get pods -n ${KUBE_NAMESPACE} --field-selector=status.phase=Running -lapp=task-runner,release=${CI_ENVIRONMENT_SLUG} --no-headers -o=custom-columns=NAME:.metadata.name)" ]; do
echo "Waiting till task-runner pod is ready";
sleep 5;
done
task_runner_pod=$(kubectl get pods -n ${KUBE_NAMESPACE} --field-selector=status.phase=Running -lapp=task-runner,release=${CI_ENVIRONMENT_SLUG} --no-headers -o=custom-columns=NAME:.metadata.name)
if [ -z "${task_runner_pod}" ]; then echo "Task runner pod not found" && return; fi
echo "Task runner pod is ${task_runner_pod}"
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';
"
}
function setup_test_db() {
if [ -z ${KUBERNETES_PORT+x} ]; then
DB_HOST=postgres
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment