From 946dbd22e61f7f1c296cb698a90227368ebb7fab Mon Sep 17 00:00:00 2001
From: Tim Schubert <tim.schubert@tu-bs.de>
Date: Fri, 21 Sep 2018 12:46:11 +0200
Subject: [PATCH] Build config using bash script

---
 .gitlab-ci.yml                       | 11 ++---------
 python-gitlab.cfg => build-config.sh |  7 ++++++-
 2 files changed, 8 insertions(+), 10 deletions(-)
 rename python-gitlab.cfg => build-config.sh (51%)
 mode change 100644 => 100755

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 21da223..ea4107e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -23,15 +23,8 @@ before_script:
   - ssh-keyscan $CI_REPO_HOST | tee ~/.ssh/known_hosts
   - chmod 644 ~/.ssh/known_hosts
   ## get API token from secret variable
-  - echo "\
-     [global]
-     default = default
-     ssl_verify = true
-     
-     [default]
-     url = $(echo ${CI_PROJECT_URL} | cut -d '/' -f -3)
-     api_version = 4
-     private_token = ${PRIVATE_API_TOKEN}" > $HOME/.python-gitlab.cfg
+  - ./build-config.sh 
+  - cp python-gitlab.cfg $HOME/.python-gitlab.cfg
   - python3 setup.py install
 
 deadlines:
diff --git a/python-gitlab.cfg b/build-config.sh
old mode 100644
new mode 100755
similarity index 51%
rename from python-gitlab.cfg
rename to build-config.sh
index 38c4668..b1b1d05
--- a/python-gitlab.cfg
+++ b/build-config.sh
@@ -1,7 +1,12 @@
+#!/bin/sh
+
+cat > python-gitlab.cfg <<EOF
 [global]
-default = default 
+default = default
 ssl_verify = true
 
 [default]
 url = $(echo ${CI_PROJECT_URL} | cut -d '/' -f -3)
 api_version = 4
+private_token = ${PRIVATE_API_TOKEN}
+EOF