From b4e0ee381e373984719eae0e9629120201166de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Ku=C5=9B?= Date: Thu, 4 Sep 2025 23:43:39 +0200 Subject: [PATCH] _sd_ --- deploy-this/update-from-git.jenkinsfile | 54 +++++++++++++------------ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/deploy-this/update-from-git.jenkinsfile b/deploy-this/update-from-git.jenkinsfile index 661c3c0..bea038e 100755 --- a/deploy-this/update-from-git.jenkinsfile +++ b/deploy-this/update-from-git.jenkinsfile @@ -1,34 +1,38 @@ -pipeline { - agent { - node { - label 'master' // lub inna działająca etykieta - customWorkspace '/_sd_/_programs_' - } - } +def projects = [ + "proxy-nginx", + "arti24", + "angular-services", + "arti-angular-app" +] +pipeline { + agent any // NAJBEZPIECZNIEJSZA OPCJA + stages { - stage('Update from git') { + stage('Update Git Repositories') { steps { - script { - withCredentials([usernamePassword( - credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe', - usernameVariable: 'GIT_USER', - passwordVariable: 'GIT_PASS')]) { - - projects.each { project -> - if (fileExists(project)) { - dir(project) { + dir('/_sd_/_programs_') { + script { + withCredentials([usernamePassword( + credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe', + usernameVariable: 'GIT_USER', + passwordVariable: 'GIT_PASS')]) { + + projects.each { project -> + if (fileExists(project)) { + dir(project) { + sh """ + 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 --prune origin + git checkout -B main origin/main + """ + } + } else { sh """ - 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 --prune origin - git checkout -B main origin/main + git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git ${project} """ } - } else { - sh """ - git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git ${project} - """ } } }