From ff9c678a1e6b6cb4d6458f532d712f50e462dab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 22 Nov 2022 13:40:45 +0100 Subject: [PATCH] ci: extract git cleanup to separate script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It needs to be separate script, because once the submodules are broken and the `variables.mk` file is not available from `nimbus-build-system` then we cannot even call `make clean-git` successfully because it will be caught by the `if` clause that checks for `variables.mk`. Possible fix for issues with submodules not being updated in some windows release builds. Signed-off-by: Jakub SokoĊ‚owski --- Makefile | 4 +--- ci/Jenkinsfile.linux | 2 +- ci/Jenkinsfile.linux-cpp | 2 +- ci/Jenkinsfile.macos | 2 +- ci/Jenkinsfile.macos-cpp.todo | 2 +- ci/Jenkinsfile.uitests | 2 +- ci/Jenkinsfile.windows | 2 +- ci/Jenkinsfile.windows-cpp.todo | 2 +- scripts/clean-git.sh | 5 +++++ 9 files changed, 13 insertions(+), 10 deletions(-) create mode 100755 scripts/clean-git.sh diff --git a/Makefile b/Makefile index 8304793c62..654cf28733 100644 --- a/Makefile +++ b/Makefile @@ -612,9 +612,7 @@ clean: | clean-common + $(MAKE) -C vendor/DOtherSide/build --no-print-directory clean clean-git: - git clean -qfdx - git submodule foreach --recursive git reset -q --hard - git submodule foreach --recursive git clean -qfdx + ./scripts/clean-git.sh force-rebuild-status-go: bash ./scripts/force-rebuild-status-go.sh $(STATUSGO) diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index c418f220a0..df0cbffad1 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -94,6 +94,6 @@ pipeline { post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make clean-git' } + cleanup { sh './scripts/clean-git.sh' } } } diff --git a/ci/Jenkinsfile.linux-cpp b/ci/Jenkinsfile.linux-cpp index 545ed1e40f..8304bdc504 100644 --- a/ci/Jenkinsfile.linux-cpp +++ b/ci/Jenkinsfile.linux-cpp @@ -85,6 +85,6 @@ pipeline { post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make clean-git' } + cleanup { sh './scripts/clean-git.sh' } } } diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index 9455ed3468..d226683b47 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -106,6 +106,6 @@ pipeline { post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make clean-git' } + cleanup { sh './scripts/clean-git.sh' } } } diff --git a/ci/Jenkinsfile.macos-cpp.todo b/ci/Jenkinsfile.macos-cpp.todo index 10fce709a6..aa1556c33a 100644 --- a/ci/Jenkinsfile.macos-cpp.todo +++ b/ci/Jenkinsfile.macos-cpp.todo @@ -77,6 +77,6 @@ pipeline { post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make clean-git' } + cleanup { sh './scripts/clean-git.sh' } } } diff --git a/ci/Jenkinsfile.uitests b/ci/Jenkinsfile.uitests index 1c39941a63..681cbadfac 100644 --- a/ci/Jenkinsfile.uitests +++ b/ci/Jenkinsfile.uitests @@ -144,6 +144,6 @@ pipeline { post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make clean-git' } + cleanup { sh './scripts/clean-git.sh' } } } diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows index faa07deaf6..667b0b4ac6 100644 --- a/ci/Jenkinsfile.windows +++ b/ci/Jenkinsfile.windows @@ -97,6 +97,6 @@ pipeline { post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make clean-git' } + cleanup { sh './scripts/clean-git.sh' } } } diff --git a/ci/Jenkinsfile.windows-cpp.todo b/ci/Jenkinsfile.windows-cpp.todo index f07297e321..633d260e48 100644 --- a/ci/Jenkinsfile.windows-cpp.todo +++ b/ci/Jenkinsfile.windows-cpp.todo @@ -78,6 +78,6 @@ pipeline { post { success { script { github.notifyPR(true) } } failure { script { github.notifyPR(false) } } - cleanup { sh 'make clean-git' } + cleanup { sh './scripts/clean-git.sh' } } } diff --git a/scripts/clean-git.sh b/scripts/clean-git.sh new file mode 100755 index 0000000000..59edec787c --- /dev/null +++ b/scripts/clean-git.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Extracted from Makefile to avoid nimbus-build-system blocking use. +git clean -qfdx +git submodule foreach --recursive git reset -q --hard +git submodule foreach --recursive git clean -qfdx