diff --git a/deploy-this/update-from-git.jenkinsfile b/deploy-this/update-from-git.jenkinsfile index 45a6d7a..1338134 100755 --- a/deploy-this/update-from-git.jenkinsfile +++ b/deploy-this/update-from-git.jenkinsfile @@ -12,18 +12,22 @@ def git_take(projects, git_remote) { projects.each { project -> if (fileExists(project)) { dir(project) { - sh ''' + sh """ echo "=== Updating ${project} ===" git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git 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 || exit 1 + """ + if (!fileExists(project)) { + error("Nie udało się pobrać lub utworzyć katalogu projektu ${project}") + } + } dir(project) { sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short"