From b6410c3a5ebe3bdde3868453688e44d9f0785650 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 5 Jul 2022 17:06:35 +0200 Subject: [PATCH] Updating .gitlab-ci.yml --- .gitlab-ci.yml | 89 +++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 191c49f..b469e45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,20 +17,32 @@ variables: FLAKE8_IGNORE_ERRORS: 'E226,E302,E41,E402' GIT_SUBMODULE_STRATEGY: 'recursive' VSPHERE_HOST: '' + VSPHERE_HOST_PROD: 'vcs01.ppbrln.internal' + VSPHERE_HOST_TEST: 'test-vcsa01.pixelpark.net' VSPHERE_API_PORT: 443 VSPHERE_API_USER: 'Administrator@vsphere.local' VSPHERE_API_PASSWD_PROD: 'secret' VSPHERE_DC: '' + VSPHERE_DC_PROD: 'vmcc' + VSPHERE_DC_TEST: 'test-vmcc' VSPHERE_CLUSTER: '' + VSPHERE_CLUSTER_PROD: 'vmcc-l105-01' + VSPHERE_CLUSTER_TEST: 'test-vmcc-l105-01' VSPHERE_STORAGE_CLUSTER: '' + VSPHERE_STORAGE_CLUSTER_PROD: 'ds-cluster-hdd-vmcc-l105-01' + VSPHERE_STORAGE_CLUSTER_TEST: 'Daten-Cluster-Gold_01' VSPHERE_VM_FOLDER: 'templates' - MAX_NR_TEMPLATES_STAY: 4 + MAX_NR_TEMPLATES_STAY: '' + MAX_NR_TEMPLATES_STAY_PROD: '4' + MAX_NR_TEMPLATES_STAY_TEST: '3' VMWARE_CONFIG_VERSION: 'vmx-15' VM_OS_VERSION: 'centos8_64Guest' VM_DISK_SIZE_GB: 20 VM_NUM_CPUS: 2 VM_RAM_MB: 4096 - VM_NETWORK: '192.168.88.0_23' + VM_NETWORK: '' + VM_NETWORK_PROD: '192.168.88.0_23' + VM_NETWORK_TEST: '192.168.145.0_24' VM_MAC_ADDRESS: '00:16:3e:54:ab:2b' MAX_WAIT_GENERAL: 60 MAX_WAIT_SHUTDOWN: 120 @@ -44,24 +56,21 @@ variables: ROOT_PASSWORD: 'blablub' SWAP_SPACE_MB: 512 COBBLER_DISTRO: 'CentOS-Stream-8-x86_64' - COBBLER_HOST: '' + COBBLER_HOST: '' COBBLER_HOST_PROD: 'cobbler.pixelpark.com' COBBLER_HOST_TEST: 'test-cobbler01.pixelpark.com' - COBBLER_SSH_USER: '' + COBBLER_SSH_USER: '' COBBLER_SSH_USER_PROD: 'root' COBBLER_SSH_USER_TEST: 'cobbler' COBBLER_SSH_TIMEOUT: 30 COBBLER_DNS_SERVERS: '93.188.109.11, 93.188.109.12, 93.188.109.13' COBBLER_DNS_SEARCH: 'pixelpark.net, pixelpark.com, pixelpark.de' COBBLER_ROOT_DIR: '/var/lib/cobbler' - COBBLER_TEMPLATES_DIR: '' + COBBLER_TEMPLATES_DIR: '' COBBLER_TEMPLATES_DIR_PROD: 'kickstarts' COBBLER_TEMPLATES_DIR_TEST: 'templates' COBBLER_SNIPPETS_DIR: 'snippets' COBBLER_WS_DOCROOT: '/var/www/html' - COBBLE_NETWORK: '' - COBBLE_NETWORK_PROD: '192.168.88.0_23' - COBBLE_NETWORK_TEST: '192.168.145.0_24' .template_job: before_script: @@ -79,50 +88,35 @@ variables: - pip install --upgrade --upgrade-strategy eager --requirement requirements.txt - pip list --format columns - if [ -x bin/compile-xlate-msgs.sh ] ; then bin/compile-xlate-msgs.sh; fi - - 'COBBLER_HOST="${COBBLER_HOST_TEST}"' - - 'COBBLER_SSH_USER="${COBBLER_SSH_USER_TEST}"' - - 'COBBLER_NETWORK="${COBBLER_NETWORK_TEST}"' - - 'COBBLER_TEMPLATES_DIR="${COBBLER_TEMPLATES_DIR_TEST}"' - - ' if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then + - 'if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then SYSTEM_STATUS="production"; - COBBLER_HOST="${COBBLER_HOST_PROD}"; - COBBLER_SSH_USER="${COBBLER_SSH_USER_TEST}"; - COBBLER_NETWORK="${COBBLER_NETWORK_PROD}"; - COBBLER_TEMPLATES_DIR="${COBBLER_TEMPLATES_DIR_PROD}"; elif [ "$CI_COMMIT_REF_NAME" = "test" -o "$CI_COMMIT_REF_NAME" = "testing" ] ; then SYSTEM_STATUS="testing"; else SYSTEM_STATUS="development"; fi' - 'echo "Ref name: ${CI_COMMIT_REF_NAME}"; echo "System status: ${SYSTEM_STATUS}"' - - ' if [ -z "${VSPHERE_HOST}" ] ; then - if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then - VSPHERE_HOST="vcs01.ppbrln.internal"; - else - VSPHERE_HOST="test-vcsa01.pixelpark.net"; - fi - fi' - - ' 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' - - ' if [ -z "${VSPHERE_STORAGE_CLUSTER}" ] ; then - if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then - VSPHERE_STORAGE_CLUSTER="ds-cluster-hdd-vmcc-l105-01"; - else - VSPHERE_STORAGE_CLUSTER="Daten-Cluster-Gold_01"; - fi - fi' + - 'if [ "${SYSTEM_STATUS}" == "production" ] ; then + if [ -z "${MAX_NR_TEMPLATES_STAY}" ] ; then MAX_NR_TEMPLATES_STAY="${MAX_NR_TEMPLATES_STAY_PROD}"; fi; + if [ -z "${VSPHERE_HOST}" ] ; then VSPHERE_HOST="${VSPHERE_HOST_PROD}"; fi; + if [ -z "${VSPHERE_DC}" ] ; then VSPHERE_DC="${VSPHERE_DC_PROD}"; fi; + if [ -z "${VSPHERE_CLUSTER}" ] ; then VSPHERE_CLUSTER="${VSPHERE_CLUSTER_PROD}"; fi; + if [ -z "${VSPHERE_STORAGE_CLUSTER}" ] ; then VSPHERE_STORAGE_CLUSTER="${VSPHERE_STORAGE_CLUSTER_PROD}"; fi; + if [ -z "${COBBLER_HOST}" ] ; then COBBLER_HOST="${COBBLER_HOST_PROD}"; fi; + if [ -z "${COBBLER_SSH_USER}" ] ; then COBBLER_SSH_USER="${COBBLER_SSH_USER_PROD}"; fi; + if [ -z "${COBBLER_TEMPLATES_DIR}" ] ; then COBBLER_TEMPLATES_DIR="${COBBLER_TEMPLATES_DIR_PROD}"; fi; + if [ -z "${VM_NETWORK}" ] ; then VM_NETWORK="${VM_NETWORK_PROD}"; fi; + else + if [ -z "${MAX_NR_TEMPLATES_STAY}" ] ; then MAX_NR_TEMPLATES_STAY="${MAX_NR_TEMPLATES_STAY_TEST}"; fi; + if [ -z "${VSPHERE_HOST}" ] ; then VSPHERE_HOST="${VSPHERE_HOST_TEST}"; fi; + if [ -z "${VSPHERE_DC}" ] ; then VSPHERE_DC="${VSPHERE_DC_TEST}"; fi; + if [ -z "${VSPHERE_CLUSTER}" ] ; then VSPHERE_CLUSTER="${VSPHERE_CLUSTER_TEST}"; fi; + if [ -z "${VSPHERE_STORAGE_CLUSTER}" ] ; then VSPHERE_STORAGE_CLUSTER="${VSPHERE_STORAGE_CLUSTER_TEST}"; fi; + if [ -z "${COBBLER_HOST}" ] ; then COBBLER_HOST="${COBBLER_HOST_TEST}"; fi; + if [ -z "${COBBLER_SSH_USER}" ] ; then COBBLER_SSH_USER="${COBBLER_SSH_USER_TEST}"; fi; + if [ -z "${COBBLER_TEMPLATES_DIR}" ] ; then COBBLER_TEMPLATES_DIR="${COBBLER_TEMPLATES_DIR_TEST}"; fi; + if [ -z "${VM_NETWORK}" ] ; then VM_NETWORK="${VM_NETWORK_TEST}"; fi; + fi' - 'echo "Configuration file: \"${CONFIG_FILE}\""' - 'touch "${CONFIG_FILE}"' - 'echo "Finished common part"' @@ -236,6 +230,11 @@ Linter: echo "<-- EOF"' # - bin/waitfor 1200 # - bin/create-vmware-template --verbose --color yes --config "${CONFIG_FILE}" + - 'if [ "${SYSTEM_STATUS}" = "development" ] ; then + echo "No build is done."; + else + echo "bin/create-vmware-template --verbose --color yes"; + fi' Create Centos8 template: extends: -- 2.39.5