From 4365fab0668ae11d6abfdfcb7d4277d13e3aefab Mon Sep 17 00:00:00 2001
From: Alex Iribarren <Alex.Iribarren@cern.ch>
Date: Thu, 27 Sep 2018 15:43:53 +0200
Subject: [PATCH] Save the variables in files instead

---
 .gitlab-ci.yml                         |  9 ++--
 dev.repos.d/downloads.mariadb.com.repo | 17 --------
 dev.repos.d/eolopenstackelX.repo       |  6 ---
 dev.repos.d/xrootd.repo                | 60 --------------------------
 dev.repos.yaml                         | 15 +++++++
 dev.variables.sh                       |  5 +++
 prod.variables.sh                      |  5 +++
 7 files changed, 29 insertions(+), 88 deletions(-)
 delete mode 100644 dev.repos.d/downloads.mariadb.com.repo
 delete mode 100644 dev.repos.d/eolopenstackelX.repo
 delete mode 100644 dev.repos.d/xrootd.repo
 create mode 100644 dev.repos.yaml
 create mode 100644 dev.variables.sh
 create mode 100644 prod.variables.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index df70981..d0183c4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,9 +6,8 @@ variables:
   VAULT_ADDR: "https://${CLUSTER_ADDR}:8200"
 
 before_script:
-  - if [[ $CI_COMMIT_REF_NAME == 'master' || -n ${CI_COMMIT_TAG+x} ]]; then PREFIX='PROD_'; else PREFIX='DEV_'; fi
-  - eval 'vars=${!'"$PREFIX"'@}'
-  - for v in $vars; do eval 'export '"${v#$PREFIX}"'=$'$v; done
+  - if [[ $CI_COMMIT_REF_NAME == 'master' || -n ${CI_COMMIT_TAG+x} ]]; then PREFIX='prod'; else PREFIX='dev'; fi
+  - source ${PREFIX}.variables.sh
 
 stages:
   - prepare
@@ -21,8 +20,8 @@ stages:
 prepare_dirs:
   stage: prepare
   script:
-    - cp -r ${REPOS}/ scheduler/
-    - cp repos.yaml scheduler/
+    - cp -r ${REPOS} scheduler/yum.repos.d
+    - cp ${REPOSCONF} scheduler/repos.yaml
   artifacts:
     paths:
       - scheduler/yum.repos.d/
diff --git a/dev.repos.d/downloads.mariadb.com.repo b/dev.repos.d/downloads.mariadb.com.repo
deleted file mode 100644
index 7caeab9..0000000
--- a/dev.repos.d/downloads.mariadb.com.repo
+++ /dev/null
@@ -1,17 +0,0 @@
-[downloads.mariadb.comm-maxscale-x86_64-el5]
-name=MariaDB maxscale for Centos 5
-baseurl=https://downloads.mariadb.com/MaxScale/2.0.2/centos/5/x86_64/
-enabled=1
-gpgcheck=0
-
-[downloads.mariadb.com-maxscale-x86_64-el6]
-name=MariaDB maxscale for Centos 6
-baseurl=https://downloads.mariadb.com/MaxScale/2.0.2/centos/6/x86_64/
-enabled=1
-gpgcheck=0
-
-[downloads.mariadb.com-maxscale-x86_64-el7]
-name=MariaDB maxscale for Centos 7
-baseurl=https://downloads.mariadb.com/MaxScale/2.0.2/centos/7/x86_64/
-enabled=1
-gpgcheck=0
diff --git a/dev.repos.d/eolopenstackelX.repo b/dev.repos.d/eolopenstackelX.repo
deleted file mode 100644
index 72452ae..0000000
--- a/dev.repos.d/eolopenstackelX.repo
+++ /dev/null
@@ -1,6 +0,0 @@
-[eolopenstackel6]
-name=openstack juno el6
-baseurl=http://mirror.centos.org/centos/6/cloud/x86_64/openstack-juno/
-enabled=1
-gpgcheck=0
-
diff --git a/dev.repos.d/xrootd.repo b/dev.repos.d/xrootd.repo
deleted file mode 100644
index 690a940..0000000
--- a/dev.repos.d/xrootd.repo
+++ /dev/null
@@ -1,60 +0,0 @@
-[xrootd-stable-5-i386]
-name=xrootd stable 5 i386
-baseurl=http://xrootd.cern.ch/sw/repos/stable/slc/5/i386/
-enabled=1
-gpgcheck=0
-
-[xrootd-stable-5-x86_64]
-name=xrootd stable 5 x86_64
-baseurl=http://xrootd.cern.ch/sw/repos/stable/slc/5/x86_64/
-enabled=1
-gpgcheck=0
-
-[xrootd-stable-6-i386]
-name=xrootd stable 6 i386
-baseurl=http://xrootd.cern.ch/sw/repos/stable/slc/6/i386/
-enabled=1
-gpgcheck=0
-
-[xrootd-stable-6-x86_64]
-name=xrootd stable 6 x86_64
-baseurl=http://xrootd.cern.ch/sw/repos/stable/slc/6/x86_64/
-enabled=1
-gpgcheck=0
-
-[xrootd-stable-7-x86_64]
-name=xrootd stable 7 x86_64
-baseurl=http://xrootd.cern.ch/sw/repos/stable/slc/7/x86_64/
-enabled=1
-gpgcheck=0
-
-[xrootd-testing-5-i386]
-name=xrootd testing 5 i386
-baseurl=http://xrootd.cern.ch/sw/repos/testing/slc/5/i386/
-enabled=1
-gpgcheck=0
-
-[xrootd-testing-5-x86_64]
-name=xrootd testing 5 x86_64
-baseurl=http://xrootd.cern.ch/sw/repos/testing/slc/5/x86_64/
-enabled=1
-gpgcheck=0
-
-[xrootd-testing-6-i386]
-name=xrootd testing 6 i386
-baseurl=http://xrootd.cern.ch/sw/repos/testing/slc/6/i386/
-enabled=1
-gpgcheck=0
-
-[xrootd-testing-6-x86_64]
-name=xrootd testing 6 x86_64
-baseurl=http://xrootd.cern.ch/sw/repos/testing/slc/6/x86_64/
-enabled=1
-gpgcheck=0
-
-[xrootd-testing-7-x86_64]
-name=xrootd testing 7 x86_64
-baseurl=http://xrootd.cern.ch/sw/repos/testing/slc/7/x86_64/
-enabled=1
-gpgcheck=0
-
diff --git a/dev.repos.yaml b/dev.repos.yaml
new file mode 100644
index 0000000..2e2fc3d
--- /dev/null
+++ b/dev.repos.yaml
@@ -0,0 +1,15 @@
+---
+# YAML configuration file
+# Add a dictionary for each .repo file where you want to overwrite the defaults.
+# The following keys are valid:
+#  pathroot: prefix of destination directory. Default: ""
+#  pathcut: cut the sync URL up to this point. What remains will be
+#    appended to "$PATHROOT/" to build the destination directory.
+#    Default: "//"
+
+#theforeman.repo:
+#  pathroot: foreman
+#  pathcut: yum.theforeman.org
+
+#xrootd.repo:
+#  pathroot: xrootd
diff --git a/dev.variables.sh b/dev.variables.sh
new file mode 100644
index 0000000..4dbd1da
--- /dev/null
+++ b/dev.variables.sh
@@ -0,0 +1,5 @@
+JOB_PREFIX="dev_"
+MOUNT_POINT="/mnt/data2/test/repos"
+REPOS="dev.repos.d"
+REPOSCONF="dev.repos.yaml"
+SCHEDULE="* * * * *"
diff --git a/prod.variables.sh b/prod.variables.sh
new file mode 100644
index 0000000..36f56f9
--- /dev/null
+++ b/prod.variables.sh
@@ -0,0 +1,5 @@
+JOB_PREFIX="prod_"
+MOUNT_POINT="/mnt/data2/test/repos2"
+REPOS="yum.repos.d"
+REPOSCONF="repos.yaml"
+SCHEDULE="0 */12 * * *"
-- 
GitLab