2020-04-16 14:08:44 +02:00
|
|
|
pipeline {
|
|
|
|
agent { label 'docker-lehrer' }
|
|
|
|
environment {
|
|
|
|
GIT_COMMIT_AUTHOR = """${sh(
|
|
|
|
returnStdout: true,
|
|
|
|
script: 'git show -s --pretty=%an'
|
|
|
|
)}"""
|
|
|
|
GIT_COMMIT_COMMENT = """${sh(
|
|
|
|
returnStdout: true,
|
|
|
|
script: 'git show -s --format=%s'
|
|
|
|
)}"""
|
|
|
|
}
|
|
|
|
options {
|
|
|
|
buildDiscarder(logRotator(artifactNumToKeepStr: '0'))
|
|
|
|
}
|
|
|
|
parameters {
|
|
|
|
string(name: 'USERNAME', defaultValue: 'Username', description: 'Benutzername')
|
|
|
|
password(name: 'PASSWORD', defaultValue: '', description: 'Passwort')
|
|
|
|
string(name: 'REPOSITORY', defaultValue: '.git', description: 'URL Git-Repository DA - default Wert: Baue Vorlage')
|
|
|
|
string(name: 'BRANCH', defaultValue: 'master', description: 'Branch')
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Checkout DA') {
|
|
|
|
when {
|
|
|
|
expression { '.git' != params.REPOSITORY }
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
login_url_sub="https://"$(params.USERNAME)":"$(params.PASSWORD)"@"
|
|
|
|
sub='https;//'
|
|
|
|
git clone $($(params.REPOSITORY)/$(sub)/$(login_url_sub)) .
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Build DA') {
|
|
|
|
when {
|
|
|
|
expression { '.git' != params.REPOSITORY }
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
make pdf -C HTLLE-DA-Vorlage SOURCEDIR=$(pwd)
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Build only template') {
|
|
|
|
when {
|
|
|
|
expression { '.git' == params.Repository }
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh '''
|
2020-04-16 15:05:36 +02:00
|
|
|
mkdir HTLLE-DA-Vorlage && mv * HTLLE-DA-Vorlage
|
2020-04-16 14:08:44 +02:00
|
|
|
cp -rv HTLLE-DA-Vorlage/example/* .
|
|
|
|
make pdf -C HTLLE-DA-Vorlage SOURCEDIR=$(pwd)
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Test if diplomarbeit.pdf was build') {
|
|
|
|
steps {
|
|
|
|
sh "test -f output/diplomarbeit.pdf"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
2020-04-16 14:11:06 +02:00
|
|
|
always {
|
2020-04-16 14:08:44 +02:00
|
|
|
emailext attachLog: true, attachmentsPattern: 'output/**',
|
|
|
|
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}",
|
|
|
|
recipientProviders: [requestor()],
|
|
|
|
subject: "Jenkins Diplomarbeit Build ${currentBuild.currentResult}"
|
|
|
|
cleanWs()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|