From ea4a7002399d2eaf5e8ec444177e0ff53451ba55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Ku=C5=9B?= Date: Wed, 26 Mar 2025 20:58:26 +0100 Subject: [PATCH] Easer update-from-git --- deploy-this/update-from-git.jenkinsfile | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/deploy-this/update-from-git.jenkinsfile b/deploy-this/update-from-git.jenkinsfile index 1dee118..0ba5936 100755 --- a/deploy-this/update-from-git.jenkinsfile +++ b/deploy-this/update-from-git.jenkinsfile @@ -8,21 +8,16 @@ def projects = [ ] def git_take(projects, git_remote) { - if (projects.empty) { - sh "git pull" - 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" - } + projects.each { project -> + if (fileExists(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 { script { disableSafeDirCheck() - dir("/_programs_") { + dir("_programs_") { git_take(projects, git_remote) // Dodano git_remote jako argument } }