]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Updating create_vmware_template.groovy for two different jobs.
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 2 Nov 2018 14:04:30 +0000 (15:04 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 2 Nov 2018 14:04:30 +0000 (15:04 +0100)
create_vmware_template.groovy

index d67631606cba1a5d9151505932b0ac5be3111bde..a4ff19a5bebefe7b6c0e5503912454069312bc0f 100644 (file)
@@ -7,7 +7,9 @@ def jenkinsJobAdmins = ['frabrehm', 'mickraus', 'grenaeck', 'svebuchh1']
 //def emailReceivers = 'frank.brehm@pixelpark.com, michael.krause@pixelpark.com, gregor.naeckel@pixelpark.com, sven.buchholz@pixelpark.com'
 def emailReceivers = 'frank.brehm@pixelpark.com'
 
-STEPS = '''#!/bin/bash
+STEPS_OEL = '''#!/bin/bash
+
+CFGFILE=etc/create-vmware-template-test-cluster1.ini
 
 echo
 echo "---------------------------------------------------"
@@ -20,6 +22,8 @@ echo
 echo "Build-Nummer:                 ${BUILD_NUMBER}"
 echo "Build ID:                     ${BUILD_ID}"
 echo
+echo "Config file:                  ${CFGFILE}
+echo
 
 echo "---------------------------------------------------"
 echo "Preparing virtual environment ..."
@@ -41,11 +45,67 @@ echo "Installed modules:"
 echo
 pip list --format columns
 
+if [[ ! -f "${CFGFILE}" ]] ; then
+    echo "File '${CFGFILE}' not found." >&2
+    exit 5
+fi
+
 echo
 echo "---------------------------------------------------"
 echo "Executing ..."
 echo
-bin/create-vmware-template --verbose --color yes
+bin/create-vmware-template --verbose --color yes --config "${CFGFILE}"
+
+'''
+
+STEPS_CENTOS = '''#!/bin/bash
+
+CFGFILE=etc/create-vmware-template-centos-cluster1.ini
+
+echo
+echo "---------------------------------------------------"
+echo "Aktuelles Arbeitsverzeichnis: '$( pwd )'"
+echo "Workspace:                    '${WORKSPACE}'"
+echo "Git URL / Branch:             '${GIT_URL}' / '${GIT_BRANCH}'"
+echo "Git Committer:                '${GIT_COMMITTER_NAME}' <${GIT_COMMITTER_EMAIL}>"
+echo "Git Autor:                    '${GIT_AUTHOR_NAME}' <${GIT_AUTHOR_EMAIL}>"
+echo
+echo "Build-Nummer:                 ${BUILD_NUMBER}"
+echo "Build ID:                     ${BUILD_ID}"
+echo
+echo "Config file:                  ${CFGFILE}
+echo
+
+echo "---------------------------------------------------"
+echo "Preparing virtual environment ..."
+echo
+if [[ ! -f venv/bin/activate ]] ; then
+    virtualenv-3 venv
+fi
+
+. venv/bin/activate
+
+echo
+echo "---------------------------------------------------"
+echo "Installing and/or upgrading necessary modules ..."
+echo
+pip install --upgrade --upgrade-strategy eager --requirement requirements.txt
+echo
+echo "---------------------------------------------------"
+echo "Installed modules:"
+echo
+pip list --format columns
+
+if [[ ! -f "${CFGFILE}" ]] ; then
+    echo "File '${CFGFILE}' not found." >&2
+    exit 5
+fi
+
+echo
+echo "---------------------------------------------------"
+echo "Executing ..."
+echo
+bin/create-vmware-template --verbose --color yes --config "${CFGFILE}"
 
 '''
 
@@ -64,9 +124,9 @@ listView("create-vmware-template") {
     }
 }
 
-job("create-vmware-template") {
+job("create-vmware-template-oel") {
 
-    displayName('Creating VMWare Template')
+    displayName('Creating VMWare Template Oracle Linux')
 
     parameters {
         gitParam('GIT_BRANCH') {
@@ -111,7 +171,77 @@ job("create-vmware-template") {
     }
 
     steps {
-        shell(STEPS)
+        shell(STEPS_OEL)
+    }
+
+    wrappers {
+        colorizeOutput()
+    }
+
+    publishers {
+        mailer {
+            recipients(emailReceivers)
+            notifyEveryUnstableBuild(true)
+            sendToIndividuals(false)
+        }
+    }
+
+    authorization {
+        jenkinsJobAdmins.each { name ->
+            permissionAll(name)
+        }
+    }
+
+}
+
+job("create-vmware-template-centos") {
+
+    displayName('Creating VMWare Template CentOS')
+
+    parameters {
+        gitParam('GIT_BRANCH') {
+        description('Bitte zu bauenden Branch waehlen')
+        type('BRANCH')
+        branch('*/master')
+        tagFilter('*')
+        sortMode('ASCENDING')
+        defaultValue('origin/master')
+        }
+    }
+
+    logRotator{
+        daysToKeep(30)
+    }
+
+    triggers {
+        cron('H H(5-6) * * 1-5')
+    }
+
+    scm {
+        git {
+            remote {
+                url("git@git.pixelpark.com:${group}/${projectName}.git")
+                name('origin')
+                credentials('d1d6ad59-8d5a-45b4-acfb-64a36d7fd8cd')
+            }
+            branch('${GIT_BRANCH}')
+            extensions {
+                pruneBranches()
+                submoduleOptions {
+                    recursive()
+                }
+            }
+            browser {
+                gitLab {
+                    repoUrl("https://${gitServerUrl}/${group}/${projectName}")
+                    version('10.3')
+                }
+            }
+        }
+    }
+
+    steps {
+        shell(STEPS_CENTOS)
     }
 
     wrappers {