always ignore submodule templates and check out a fresh copy of HTLLE-DA-Vorlage

This commit is contained in:
Clemens Lauermann 2020-04-20 10:42:59 +02:00
parent ed3c301872
commit aed5337dc4

35
Jenkinsfile vendored
View File

@ -25,8 +25,9 @@ pipeline {
} }
stages { stages {
stage('Set some variables'){ stage('Set some variables and clean workspace'){
steps{ steps{
cleanWs()
script { script {
// set template values // set template values
env.TEMPLATE_URL = 'https://itsp.htl-leoben.at/git/Hg/HTLLE-DA-Vorlage.git' env.TEMPLATE_URL = 'https://itsp.htl-leoben.at/git/Hg/HTLLE-DA-Vorlage.git'
@ -54,8 +55,10 @@ pipeline {
} }
} }
stage('Checkout DA') { stage('Checkout DA') {
when {
expression { env.TEMPLATE_URL != env.REPOSITORY }
}
steps { steps {
cleanWs()
// checkout out the repository including submodules // checkout out the repository including submodules
// builduser acc used in git // builduser acc used in git
checkout([ checkout([
@ -64,10 +67,10 @@ pipeline {
doGenerateSubmoduleConfigurations: false, doGenerateSubmoduleConfigurations: false,
extensions: [[ extensions: [[
$class: 'SubmoduleOption', $class: 'SubmoduleOption',
disableSubmodules: false, disableSubmodules: true,
parentCredentials: true, parentCredentials: true,
recursiveSubmodules: true, recursiveSubmodules: false,
shallow: false, shallow: true,
reference: '', reference: '',
trackingSubmodules: false trackingSubmodules: false
]], ]],
@ -79,6 +82,26 @@ pipeline {
]) ])
} }
} }
stage('Checkout template') {
steps {
// remove template folder and fresh checkout
sh "rm -rf ${env.TEMPLATE_NAME}"
checkout([
$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[
$class: 'RelativeTargetDirectory',
relativeTargetDir: "${env.GIT_PATH}${env.TEMPLATE_NAME}"
]],
submoduleCfg: [],
userRemoteConfigs: [[
credentialsId: 'd65d903b-21ee-4055-98aa-ef82a903e287',
url: "${env.TEMPLATE_URL}"
]]
])
}
}
stage('Build DA') { stage('Build DA') {
when { when {
expression { env.TEMPLATE_URL != env.REPOSITORY } expression { env.TEMPLATE_URL != env.REPOSITORY }
@ -96,8 +119,6 @@ pipeline {
steps { steps {
// build the template with the examples from DA point of view // build the template with the examples from DA point of view
sh """#!/bin/bash sh """#!/bin/bash
mkdir ${env.TEMPLATE_NAME}
ls | grep -v ${env.TEMPLATE_NAME} | xargs mv -t ${env.TEMPLATE_NAME}
cp -rv ${env.TEMPLATE_NAME}/example/. . cp -rv ${env.TEMPLATE_NAME}/example/. .
make pdf -C ${env.TEMPLATE_NAME} SOURCEDIR=`pwd` make pdf -C ${env.TEMPLATE_NAME} SOURCEDIR=`pwd`
""" """