From 76fed48f60ab915d3d90bb9985cff76c21bd6609 Mon Sep 17 00:00:00 2001 From: Bartosz Cichocki Date: Mon, 9 Aug 2021 14:14:20 +0200 Subject: [PATCH] [EGD-7314] Fix branch out-of-date checks Due to introducing release branch, the check was working faulty Now it's fixed --- Jenkinsfile | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 05e5028ce79f3403fe1b70076a875525194863a7..570fab96bba1df60e3deac152fc2522c4f74d9ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,8 +50,7 @@ pipeline { echo "Check if branch needs rebasing" sh '''#!/bin/bash -e pushd ${WORKSPACE} - - if [[ $(git log origin/${CHANGE_TARGET}..HEAD) ]]; then + if [ $(git rev-list --count origin/${CHANGE_TARGET}...`(git merge-base ${GIT_COMMIT} origin/${CHANGE_TARGET})`) = 0 ]; then echo "Branch OK" else echo "Branch is not rebased. Exiting" @@ -80,6 +79,17 @@ pipeline { } stage('Build RT1051') { steps { + echo "Check if branch needs rebasing" + sh '''#!/bin/bash -e + pushd ${WORKSPACE} + if [ $(git rev-list --count origin/${CHANGE_TARGET}...`(git merge-base ${GIT_COMMIT} origin/${CHANGE_TARGET})`) = 0 ]; then + echo "Branch OK" + else + echo "Branch is not rebased. Exiting" + exit 1 + fi + popd''' + sh '''#!/bin/bash -e PATH="/usr/local/cmake-3.19.5-Linux-x86_64/bin:/usr/local/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH" export JOBS=${JOBS:-6} @@ -125,9 +135,22 @@ pipeline { environment { PATH="/usr/local/cmake-3.19.5-Linux-x86_64/bin:/usr/local/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH" CCACHE_DIR="/ccache/Linux" + XDG_CACHE_HOME="/clang-cache" + } steps { + echo "Check if branch needs rebasing" + sh '''#!/bin/bash -e + pushd ${WORKSPACE} + if [ $(git rev-list --count origin/${CHANGE_TARGET}...`(git merge-base ${GIT_COMMIT} origin/${CHANGE_TARGET})`) = 0 ]; then + echo "Branch OK" + else + echo "Branch is not rebased. Exiting" + exit 1 + fi + popd''' + echo "Configure" sh '''#!/bin/bash -e echo "JOBS=${JOBS}" @@ -198,9 +221,21 @@ pipeline { environment { PATH="/usr/local/cmake-3.19.5-Linux-x86_64/bin:/usr/local/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH" CCACHE_DIR="/ccache/Linux" + XDG_CACHE_HOME="/clang-cache" } steps { + echo "Check if branch needs rebasing" + sh '''#!/bin/bash -e + pushd ${WORKSPACE} + if [ $(git rev-list --count origin/${CHANGE_TARGET}...`(git merge-base ${GIT_COMMIT} origin/${CHANGE_TARGET})`) = 0 ]; then + echo "Branch OK" + else + echo "Branch is not rebased. Exiting" + exit 1 + fi + popd''' + echo "Configure" sh '''#!/bin/bash -e echo "JOBS=${JOBS}"