From 25454d6ca241e4e6f7e4627bdd2f2c8d0a232081 Mon Sep 17 00:00:00 2001
From: David Hoese <david.hoese@ssec.wisc.edu>
Date: Mon, 17 Aug 2020 14:08:37 -0500
Subject: [PATCH] Fix copy of main rabbitmq secrets to geosphere-test namespace

---
 ci_geosphere-test/gitlab-ci.yaml | 5 -----
 ci_geosphere/gitlab-ci.yaml      | 4 ++++
 helpers/deploy_rabbitmq.sh       | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/ci_geosphere-test/gitlab-ci.yaml b/ci_geosphere-test/gitlab-ci.yaml
index 5546366..28133b2 100644
--- a/ci_geosphere-test/gitlab-ci.yaml
+++ b/ci_geosphere-test/gitlab-ci.yaml
@@ -40,11 +40,6 @@ gstest deploy rabbit:
   stage: deploy rabbit
   script:
     - ./helpers/deploy_rabbitmq.sh ci_geosphere-test
-    - cp ${kubekorner_k3s_config} .
-    - kubeconfig=$(basename ${kubekorner_k3s_config})
-    # FIXME: This may never run. This should be put on the production side
-    - |-
-      kubectl get secret --kubeconfig "${kubeconfig}" geosphere-rabbit-rabbitmq --namespace=geosphere -oyaml | grep -v '^\s*namespace:\s' | grep -v "helm" | sed 's/ name: .*/ name: geosphere-rabbit-rabbitmq-production/' | kubectl apply --kubeconfig "${kubeconfig}" --namespace=geosphere-test -f -
   # this job doesn't actually need any artifacts from previous jobs
   dependencies: []
   rules:
diff --git a/ci_geosphere/gitlab-ci.yaml b/ci_geosphere/gitlab-ci.yaml
index ee9336c..c6ce827 100644
--- a/ci_geosphere/gitlab-ci.yaml
+++ b/ci_geosphere/gitlab-ci.yaml
@@ -57,6 +57,10 @@ gs deploy rabbit:
   stage: deploy rabbit
   script:
     - ./helpers/deploy_rabbitmq.sh ci_geosphere
+    - cp ${kubekorner_k3s_config} .
+    - kubeconfig=$(basename ${kubekorner_k3s_config})
+    - |-
+      kubectl get secret --kubeconfig "${kubeconfig}" geosphere-rabbit-rabbitmq --namespace=geosphere -oyaml | grep -v '^\s*namespace:\s' | grep -v "helm" | sed 's/ name: .*/ name: geosphere-rabbit-rabbitmq-production/' | kubectl apply --kubeconfig "${kubeconfig}" --namespace=geosphere-test -f -
   # this job doesn't actually need any artifacts from previous jobs
   dependencies: []
   rules:
diff --git a/helpers/deploy_rabbitmq.sh b/helpers/deploy_rabbitmq.sh
index 5fad1f6..723a7a8 100755
--- a/helpers/deploy_rabbitmq.sh
+++ b/helpers/deploy_rabbitmq.sh
@@ -32,7 +32,7 @@ if [[ "$sec_info" != "" ]]; then
     ec=$(kubectl --kubeconfig $kubeconfig get secret --namespace $ns $auth_sec -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 -d);
     EXTRA_ARGS="--set auth.password=$pw --set auth.erlangCookie=$ec";
 fi
-echo $EXTRA_ARGS
+echo "Adding extra arguments: $EXTRA_ARGS"
 # install third-party rabbitmq server
 helm repo add bitnami "https://charts.bitnami.com/bitnami"
 helm upgrade -v 2 --install --kubeconfig $kubeconfig -f ${values_base}/values-geosphere-rabbit.yaml $EXTRA_ARGS --namespace $ns geosphere-rabbit bitnami/rabbitmq
-- 
GitLab