From 4b0b3c24329c3c9c8a701e9f78c25d8e573e6cbc Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Fri, 26 Jul 2019 16:59:37 +0200
Subject: [PATCH] use YAML anchors to remove copy paste for postgres
 compatibility tests

---
 .gitlab-ci.yml | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ae95c4f6ad..8902cd8be8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -413,10 +413,9 @@ test_deploy_with_db_without_superadmin_rights:
     - test 200 = $(curl --write-out %{http_code} --silent --output /dev/null -c cookie.txt http://localhost:8080/minerva/api/doLogin)
     - test 200 = $(curl --write-out %{http_code} --silent --output /dev/null --cookie cookie.txt http://localhost:8080/minerva/api/projects/)
 
-test_postgres_9_3_compatibility:
+
+.test_database_template: &test_database_definition
   image: maven:3.6.0-jdk-8
-  services:
-    - postgres:9.3
   stage: test
   script:
     - mkdir /etc/minerva/
@@ -424,25 +423,17 @@ test_postgres_9_3_compatibility:
     - mvn -DskipTests=true clean install -pl persist -am
     - mvn test -pl persist
 
+test_postgres_9_3_compatibility:
+  <<: *test_database_definition
+  services:
+    - postgres:9.3
+
 test_postgres_10_compatibility:
-  image: maven:3.6.0-jdk-8
+  <<: *test_database_definition
   services:
     - postgres:10
-  stage: test
-  script:
-    - mkdir /etc/minerva/
-    - cp test-db-ci.properties /etc/minerva/db.properties
-    - mvn -DskipTests=true clean install -pl persist -am
-    - mvn test -pl persist
 
 test_postgres_11_compatibility:
-  image: maven:3.6.0-jdk-8
+  <<: *test_database_definition
   services:
     - postgres:11
-  stage: test
-  script:
-    - mkdir /etc/minerva/
-    - cp test-db-ci.properties /etc/minerva/db.properties
-    - mvn -DskipTests=true clean install -pl persist -am
-    - mvn test -pl persist
-
-- 
GitLab