error in empty project ? why ?

This commit is contained in:
Artur Kuś 2025-09-04 11:54:21 +02:00
parent 52b5e51c72
commit 2756d0042e
1 changed files with 10 additions and 6 deletions

View File

@ -12,18 +12,22 @@ def git_take(projects, git_remote) {
projects.each { project -> projects.each { project ->
if (fileExists(project)) { if (fileExists(project)) {
dir(project) { dir(project) {
sh ''' sh """
echo "=== Updating ${project} ===" echo "=== Updating ${project} ==="
git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git
git fetch origin git fetch origin
git reset --hard origin/main git reset --hard origin/main
''' """
} }
} else { } else {
sh ''' sh """
echo "=== Cloning ${project} ===" git clone https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git || exit 1
git clone https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git """
''' if (!fileExists(project)) {
error("Nie udało się pobrać lub utworzyć katalogu projektu ${project}")
}
} }
dir(project) { dir(project) {
sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short" sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short"