From 7c0258246e0e984e15b1493fa29d45dfd95cbe30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Ku=C5=9B?= Date: Thu, 4 Sep 2025 11:25:28 +0200 Subject: [PATCH] some changes with git clone and fetch --- deploy-this/update-from-git.jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy-this/update-from-git.jenkinsfile b/deploy-this/update-from-git.jenkinsfile index 3218408..6ccc003 100755 --- a/deploy-this/update-from-git.jenkinsfile +++ b/deploy-this/update-from-git.jenkinsfile @@ -8,21 +8,21 @@ def projects = [ ] def git_take(projects, git_remote) { - withCredentials([usernamePassword(credentialsId: 'c3c1f5bf-8f6e-4686-b26c-3f419ef7973e', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) { + withCredentials([usernamePassword(credentialsId: 'gitea-creds', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) { projects.each { project -> if (fileExists(project)) { dir(project) { sh """ echo "=== Updating ${project} ===" - git fetch https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git --all + git fetch origin git reset --hard origin/main """ } } else { - sh """ - echo "=== Cloning ${project} ===" - git clone https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git - """ + sh ''' + git clone https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/project.git + ''' + } dir(project) { sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short"