From 12a447369aeb7e55ea8b6354e0915a49ae72dc6e Mon Sep 17 00:00:00 2001
From: Ilia Eriomenco <ilia.eriomenco@endava.com>
Date: Wed, 31 Mar 2021 15:58:17 +0300
Subject: [PATCH] ci: move  in var in eLife test

---
 .gitlab-ci.elife.yml | 76 ++++++++++++++++++++++----------------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/.gitlab-ci.elife.yml b/.gitlab-ci.elife.yml
index 1f74ff13fd..1e2affe7af 100644
--- a/.gitlab-ci.elife.yml
+++ b/.gitlab-ci.elife.yml
@@ -1,6 +1,7 @@
 variables:
   IMAGE_ORG: kotahi
   IMAGE_NAME: kotahi
+  INSTALL_PGCRYPTO_EXT: psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
 
 stages:
   - build
@@ -67,37 +68,7 @@ deploy:
 #     - cd ${HOME}
 #     - npm run lint
 
-# .test_template: &run_test_template
-#   image: $IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
-#   stage: test
-#   variables:
-#     GIT_STRATEGY: none
-#     # setup data for postgres image
-#     POSTGRES_USER: kotahidev
-#     POSTGRES_PASSWORD: kotahidev
-#     # used by psql
-#     PGUSER: kotahidev
-#     PGPASSWORD: kotahidev
-#   services:
-#     - postgres
-
-# .script_templ: &run_script_templ
-#    - cd ${HOME}
-#    - apt-get -y install postgresql-client
-#    # use the example env for tests
-#    - cp .env.example .env
-#    - echo "INSTANCE_NAME=elife" >> .env
-    
-# test-chrome:
-#   <<: *run_test_template
-#   script:
-#     - *run_script_templ
-#     # this is needed for pgboss initial setup
-#     - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
-#     # specify host here else it confuses the linked postgres image
-#     - POSTGRES_HOST=postgres yarn test:all:chrome:elife
-
-test-chrome:
+.test_template: &run_test_template
   image: $IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
   stage: test
   variables:
@@ -108,21 +79,50 @@ test-chrome:
     # used by psql
     PGUSER: kotahidev
     PGPASSWORD: kotahidev
-    # this is used to ignore self signed certs
-    #START_SERVER_AND_TEST_INSECURE: 1
-    INSTANCE_NAME: elife
   services:
     - postgres
   script:
     - cd ${HOME}
     - apt-get -y install postgresql-client
-    # this is needed for pgboss initial setup
-    - hostname
-    - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
     # use the example env for tests
     - cp .env.example .env
+    # this is needed for pgboss initial setup
+    - $INSTALL_PGCRYPTO_EXT
     # specify host here else it confuses the linked postgres image
-    - POSTGRES_HOST=postgres yarn test:all:chrome:elife
+    - POSTGRES_HOST=postgres yarn test:all:$TEST_ITEM
+    
+test-chrome:
+  <<: *run_test_template
+  variables:
+    TEST_ITEM: chrome:elife
+
+
+# test-chrome:
+#   image: $IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
+#   stage: test
+#   variables:
+#     GIT_STRATEGY: none
+#     # setup data for postgres image
+#     POSTGRES_USER: kotahidev
+#     POSTGRES_PASSWORD: kotahidev
+#     # used by psql
+#     PGUSER: kotahidev
+#     PGPASSWORD: kotahidev
+#     # this is used to ignore self signed certs
+#     #START_SERVER_AND_TEST_INSECURE: 1
+#     INSTANCE_NAME: elife
+#   services:
+#     - postgres
+#   script:
+#     - cd ${HOME}
+#     - apt-get -y install postgresql-client
+#     # this is needed for pgboss initial setup
+#     - hostname
+#     - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
+#     # use the example env for tests
+#     - cp .env.example .env
+#     # specify host here else it confuses the linked postgres image
+#     - POSTGRES_HOST=postgres yarn test:all:chrome:elife
 
 # test-chrome-samsung:
 #   <<: *run_test_template
-- 
GitLab