From: Frank Brehm Date: Fri, 2 Nov 2018 14:04:30 +0000 (+0100) Subject: Updating create_vmware_template.groovy for two different jobs. X-Git-Tag: 0.3.2^2~4 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=3a2a15e546fa7dadc30036937d71c5b6c9e6c79d;p=pixelpark%2Fcreate-vmware-tpl.git Updating create_vmware_template.groovy for two different jobs. --- diff --git a/create_vmware_template.groovy b/create_vmware_template.groovy index d676316..a4ff19a 100644 --- a/create_vmware_template.groovy +++ b/create_vmware_template.groovy @@ -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 {