From aed5337dc489c6eb0f3277e18e761c0dabe0d127 Mon Sep 17 00:00:00 2001 From: Clemens Lauermann Date: Mon, 20 Apr 2020 10:42:59 +0200 Subject: [PATCH] always ignore submodule templates and check out a fresh copy of HTLLE-DA-Vorlage --- Jenkinsfile | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ddb577c..0e21d3c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,8 +25,9 @@ pipeline { } stages { - stage('Set some variables'){ + stage('Set some variables and clean workspace'){ steps{ + cleanWs() script { // set template values env.TEMPLATE_URL = 'https://itsp.htl-leoben.at/git/Hg/HTLLE-DA-Vorlage.git' @@ -54,8 +55,10 @@ pipeline { } } stage('Checkout DA') { + when { + expression { env.TEMPLATE_URL != env.REPOSITORY } + } steps { - cleanWs() // checkout out the repository including submodules // builduser acc used in git checkout([ @@ -64,10 +67,10 @@ pipeline { doGenerateSubmoduleConfigurations: false, extensions: [[ $class: 'SubmoduleOption', - disableSubmodules: false, + disableSubmodules: true, parentCredentials: true, - recursiveSubmodules: true, - shallow: false, + recursiveSubmodules: false, + shallow: true, reference: '', 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') { when { expression { env.TEMPLATE_URL != env.REPOSITORY } @@ -96,8 +119,6 @@ pipeline { steps { // build the template with the examples from DA point of view 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/. . make pdf -C ${env.TEMPLATE_NAME} SOURCEDIR=`pwd` """