From 53867c9d037ef0e9a1ffb5afe8c444388a9fe951 Mon Sep 17 00:00:00 2001 From: Dany LE Date: Fri, 16 Sep 2022 11:53:15 +0200 Subject: [PATCH] Separate build based on current branch name --- Jenkinsfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 555e71a..368aca7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,6 +29,9 @@ pipeline{ { stage('Prebuild build') { steps { + sh''' + export -p | tee env.source + ''' sshCommand remote: remote, command: ''' set -e export WORKSPACE=$(realpath "./jenkins/workspace/antos") @@ -46,8 +49,10 @@ pipeline{ set -e export WORKSPACE=$(realpath "./jenkins/workspace/antos") cd $WORKSPACE - [ -d build ] && rm -rf build - export BUILDDIR="$WORKSPACE/build/opt/www/htdocs/os" + source env.source + buildir="build/$GIT_BRANCH" + [ -d "$buildir" ] && rm -rf "$buildir" + export BUILDDIR="$WORKSPACE/$buildir/opt/www/htdocs/os" make release ''' script {