From ede57181027a74d6f4a0b56c0da0d90e698f1f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Ku=C5=9B?= Date: Thu, 4 Sep 2025 21:55:29 +0200 Subject: [PATCH] _sd_ --- deploy-this/update-from-git.jenkinsfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/deploy-this/update-from-git.jenkinsfile b/deploy-this/update-from-git.jenkinsfile index 4e31824..6fd4781 100755 --- a/deploy-this/update-from-git.jenkinsfile +++ b/deploy-this/update-from-git.jenkinsfile @@ -7,16 +7,17 @@ def projects = [ "arti-angular-app" ] +def programs = "/_sd_/_programs_/" + def git_take(projects, git_remote) { withCredentials([usernamePassword(credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) { projects.each { project -> - def projectPath = "${env.WORKSPACE}/${project}" + def projectPath = "${programs}/${project}" - if (fileExists(project)) { - dir(project) { + if (fileExists(projectPath)) { + dir(projectPath) { sh """ echo "=== Updating ${project} ===" - git config --global --add safe.directory \$(pwd) git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git git fetch --depth=1000 origin main git reset --hard origin/main @@ -25,14 +26,14 @@ def git_take(projects, git_remote) { } else { sh """ echo "=== Cloning ${project} (last year only) ===" - git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git + git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git ${projectPath} """ - if (!fileExists(project)) { + if (!fileExists(projectPath)) { error("❌ Nie udało się sklonować repozytorium ${project}") } } - dir(project) { + dir(projectPath) { sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short" } } @@ -51,7 +52,7 @@ pipeline { steps { script { disableSafeDirCheck() - dir("/_sd_/_programs_") { + dir("${programs}") { git_take(projects, git_remote) } }