Easer update-from-git

This commit is contained in:
Artur Kuś 2025-03-26 20:58:26 +01:00
parent 2e665ac468
commit ea4a700239
1 changed files with 9 additions and 14 deletions

View File

@ -8,21 +8,16 @@ def projects = [
] ]
def git_take(projects, git_remote) { def git_take(projects, git_remote) {
if (projects.empty) { projects.each { project ->
sh "git pull" if (fileExists(project)) {
sh "git log -n 1"
} else {
projects.each { project ->
if (fileExists(project)) {
dir(project) {
sh "git fetch --all && git reset --hard origin/HEAD"
}
} else {
sh "git clone ${git_remote}/${project}.git"
}
dir(project) { dir(project) {
sh "git log -n 1" sh "git fetch --all && git reset --hard origin/HEAD"
} }
} else {
sh "git clone ${git_remote}/${project}.git"
}
dir(project) {
sh "git log -n 1"
} }
} }
} }
@ -39,7 +34,7 @@ pipeline {
steps { steps {
script { script {
disableSafeDirCheck() disableSafeDirCheck()
dir("/_programs_") { dir("_programs_") {
git_take(projects, git_remote) // Dodano git_remote jako argument git_take(projects, git_remote) // Dodano git_remote jako argument
} }
} }