forked from Hg/htlle-da-vorlage
72 lines
2.3 KiB
Groovy
72 lines
2.3 KiB
Groovy
pipeline {
|
|
agent { label 'docker-lehrer' }
|
|
|
|
options {
|
|
buildDiscarder(logRotator(artifactNumToKeepStr: '0'))
|
|
skipDefaultCheckout(true)
|
|
}
|
|
parameters {
|
|
string(name: 'USERNAME', defaultValue: 'Username', description: 'Benutzername')
|
|
password(name: 'PASSWORD', defaultValue: '', description: 'Passwort')
|
|
string(name: 'REPOSITORY', defaultValue: '.git', description: 'URL Git-Repository DA \n default Wert: Baue Vorlage \n Ohne https://')
|
|
string(name: 'PATH', defaultValue: '', description: "Pfad zur DA in git (z.B.: dipl/)")
|
|
}
|
|
stages {
|
|
stage('Clean checkout of the template') {
|
|
when {
|
|
expression { '.git' == params.REPOSITORY }
|
|
}
|
|
steps{
|
|
cleanWs()
|
|
dir('HTLLE-DA-Vorlage') {
|
|
checkout scm
|
|
}
|
|
}
|
|
}
|
|
stage('Build only template') {
|
|
when {
|
|
expression { '.git' == params.REPOSITORY }
|
|
}
|
|
steps {
|
|
sh '''
|
|
cp -rv HTLLE-DA-Vorlage/example/. .
|
|
make pdf -C HTLLE-DA-Vorlage SOURCEDIR=$(pwd) PATH=$PATH
|
|
'''
|
|
}
|
|
}
|
|
stage('Checkout DA') {
|
|
when {
|
|
expression { '.git' != params.REPOSITORY }
|
|
}
|
|
steps {
|
|
cleanWs()
|
|
sh "git clone --recurse-submodules --remote-submodules https://${params.USERNAME}:${params.PASSWORD}@${params.REPOSITORY} ."
|
|
}
|
|
}
|
|
stage('Build DA') {
|
|
when {
|
|
expression { '.git' != params.REPOSITORY }
|
|
}
|
|
steps {
|
|
sh '''
|
|
cd ${params.PATH}
|
|
make pdf -C HTLLE-DA-Vorlage SOURCEDIR=$(pwd)
|
|
'''
|
|
}
|
|
}
|
|
stage('Test if diplomarbeit.pdf was build') {
|
|
steps {
|
|
sh "test -f diplomarbeit.pdf"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always {
|
|
emailext attachLog: true, attachmentsPattern: 'diplomarbeit.pdf*',
|
|
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}",
|
|
recipientProviders: [requestor()],
|
|
subject: "Jenkins Diplomarbeit Build ${currentBuild.currentResult}"
|
|
}
|
|
}
|
|
}
|