jobs/common: added cleanup function restoring unstaged changes

with the script updating the source revisions some unstaged
changes reside in the repository. A following job will be unable
to succeed as the clone will fail. Thus, adding this function
which now can be used in the specific jobs.

Signed-off-by: Marc Mattmüller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmüller 2023-08-29 08:53:51 +02:00
parent 3364307149
commit 246c859a35
1 changed files with 7 additions and 0 deletions

View File

@ -144,6 +144,13 @@ def gitCheckout(gitUrl, branchTag, repoDir, hasSubmodules) {
println "Last 3 git commits:\n-----------------------------\n${gitHistory}" println "Last 3 git commits:\n-----------------------------\n${gitHistory}"
} }
} }
//-----------------------------------------------------------------------------
def cleanupRepository(repoDir) {
println "cleanup repository (e.g. temporary source revision updates)..."
dir("${repoDir}") {
sh("git restore .")
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------