]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Modifying .gitlab-ci.yml for dependency to the correct VSphere
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 24 Jun 2020 09:32:41 +0000 (11:32 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 24 Jun 2020 09:32:41 +0000 (11:32 +0200)
.gitlab-ci.yml

index 5a490dcb5e6af8b811e1d2bb8efd9152ba044d5a..b78928e21c98d11f371121ea16d6307ed0ba044e 100644 (file)
@@ -15,12 +15,12 @@ variables:
   VSPHERE_API_PORT: 443
   VSPHERE_API_USER: 'Administrator@vsphere.local'
   VSPHERE_API_PASSWD_PROD: 'secret'
-  VSPHERE_DC: 'vmcc'
-  VSPHERE_CLUSTER: 'vmcc-l105-01'
+  VSPHERE_DC: ''
+  VSPHERE_CLUSTER: ''
   VSPHERE_VM_FOLDER: 'templates'
   MAX_NR_TEMPLATES_STAY: 4
-  TEMPLATE_VM_NAME: 'template.pixelpark.com'
-  TEMPLATE_NAME: 'oracle-linux-7-template'
+  TEMPLATE_VM_NAME: 'template.pixelpark.com'
+  TEMPLATE_NAME: 'oracle-linux-7-template'
   VMWARE_CONFIG_VERSION: 'vmx-15'
   VM_OS_VERSION: 'oracleLinux7_64Guest'
   VM_DISK_SIZE_GB: 32
@@ -71,11 +71,23 @@ variables:
                 VSPHERE_HOST="test-vcsa01.pixelpark.net";
             fi
         fi'
-    - 'echo "VCenter Host: \"${VSPHERE_HOST}\""'
+    - ' if [ -z "${VSPHERE_DC}" ] ; then
+            if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then
+                VSPHERE_DC="vmcc";
+            else
+                VSPHERE_DC="test-vmcc";
+            fi
+        fi'
+    - ' if [ -z "${VSPHERE_CLUSTER}" ] ; then
+            if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then
+                VSPHERE_CLUSTER="vmcc-l105-01";
+            else
+                VSPHERE_CLUSTER="test-vmcc-l105-01";
+            fi
+        fi'
     - 'CONFIG_FILE=etc/create-${OS_ID}-${SYSTEM_STATUS}.ini'
     - 'echo "Configuration file: \"${CONFIG_FILE}\""'
     - 'touch "${CONFIG_FILE}"'
-    - 'ls -l "${CONFIG_FILE}" || true'
     - 'echo "Finished common part"'
   tags:
     - deploy
@@ -183,7 +195,7 @@ Create Centos8 template:
        ls -l "${CONFIG_FILE}" || true;
        echo;
        echo "-->";
-       cat "${CONFIG_FILE}" | sed -e "s/^\(root_password\) .*/\1 = ********/"-e "s/^\(password\) .*/\1 = ********/";
+       cat "${CONFIG_FILE}" | sed -e "s/^\(root_password\) .*/\1 = ********/" -e "s/^\(password\) .*/\1 = ********/";
        echo "<-- EOF"'
   environment:
     name: ${SYSTEM_STATUS}