From 947c825994fdc41d388464d8a46f4348a390d68f Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 14 Jan 2025 17:52:30 -0500 Subject: [PATCH] jjb: babeltrace: git untracked on review jobs only Enable the git untracked files check on review jobs only as it breaks multiple release branch jobs. I also want to enable this check on 'master' branches but this will require a more intrusive change that I'll do in another patch. Change-Id: I4fcd48ca50466e000e7ef919b804d5e6362c6ade Signed-off-by: Michael Jeanson --- jobs/babeltrace.yaml | 2 ++ scripts/babeltrace/build.sh | 29 ++++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/jobs/babeltrace.yaml b/jobs/babeltrace.yaml index 0eac519..8be55c8 100644 --- a/jobs/babeltrace.yaml +++ b/jobs/babeltrace.yaml @@ -335,6 +335,7 @@ - inject: properties-content: | PROJECT_NAME=babeltrace + BABELTRACE_GIT_UNTRACKED=yes - build-discarder: days-to-keep: 1 - throttle: @@ -410,6 +411,7 @@ properties-content: | PROJECT_NAME=babeltrace BABELTRACE_RUN_TESTS=no + BABELTRACE_GIT_UNTRACKED=yes - build-discarder: days-to-keep: 1 diff --git a/scripts/babeltrace/build.sh b/scripts/babeltrace/build.sh index 4ce38ac..120d46c 100755 --- a/scripts/babeltrace/build.sh +++ b/scripts/babeltrace/build.sh @@ -131,6 +131,7 @@ cc=${cc:-} BABELTRACE_MAKE_INSTALL="${BABELTRACE_MAKE_INSTALL:-yes}" BABELTRACE_MAKE_CLEAN="${BABELTRACE_MAKE_CLEAN:-yes}" BABELTRACE_GEN_COMPILE_COMMANDS="${BABELTRACE_GEN_COMPILE_COMMANDS:-no}" +BABELTRACE_GIT_UNTRACKED="${BABELTRACE_GIT_UNTRACKED:-no}" BABELTRACE_RUN_TESTS="${BABELTRACE_RUN_TESTS:-yes}" BABELTRACE_CLANG_TIDY="${BABELTRACE_CLANG_TIDY:-no}" @@ -468,20 +469,22 @@ if [ "$BABELTRACE_RUN_TESTS" = "yes" ]; then rsync -a --include 'test-suite.log' --include '*/' --exclude='*' tests/ "$WORKSPACE/log" fi -# Check that the git repository has no untracked files, meaning that -# .gitignore is not missing anything. -pushd "$SRCDIR" - -git_status_output=$(git status --short) -if [ -n "$git_status_output" ]; then - echo "Error: There are untracked or modified files in the repository:" - echo "git_status_output" - exit_status=1 -else - echo "No untracked or modified files." -fi +if [ "$BABELTRACE_GIT_UNTRACKED" = "yes" ]; then + # Check that the git repository has no untracked files, meaning that + # .gitignore is not missing anything. + pushd "$SRCDIR" -popd + git_status_output=$(git status --short) + if [ -n "$git_status_output" ]; then + echo "Error: There are untracked or modified files in the repository:" + echo "git_status_output" + exit_status=1 + else + echo "No untracked or modified files." + fi + + popd +fi # Clean the build directory if [ "$BABELTRACE_MAKE_CLEAN" = "yes" ]; then -- 2.39.5