diff --git a/deploy-this/update-from-git.jenkinsfile b/deploy-this/update-from-git.jenkinsfile index 35f4d1f..90daa52 100755 --- a/deploy-this/update-from-git.jenkinsfile +++ b/deploy-this/update-from-git.jenkinsfile @@ -1,37 +1,34 @@ +def git_remote = "https://git.arti24.eu/gitea" + def projects = [ "proxy-nginx", "arti24", - "arti-angular-app", - "angular-services" + "angular-services", + "arti-angular-app" ] -def git_take( projects ){ +def git_take( projects, git_remote ){ - if( 0 == projects.size() ){ - def git_pull ="git pull" + if( 0 == projects.size() ){ + def git_pull ="git pull" sh( git_pull ) - sh("git log -n 1") - }else{ + sh("git log -n 1") + }else{ for( project in projects ){ - def git_take ="git " + if( fileExists( project ) ){ - dir( project ){ - git_reset = git_take +" reset --hard " - sh( git_reset ) - git_take = git_take +"pull" - sh( git_take ) - } + dir( project ){ + sh "git fetch --all && git reset --hard origin/HEAD" + } }else{ - git_take = git_take +"clone https://git.arti24.eu/gitea/"+project+".git" - sh( git_take ) + sh "git clone "+git_remote+"/"+project+".git" } dir( project ){ - sh( "git log -n 1"); + sh( "git log -n 1"); } - - - } - } + + } + } } @@ -40,7 +37,6 @@ def disableSafeDirCheck(){ sh( disableSafeDirCheck ) } - pipeline { agent any @@ -56,8 +52,6 @@ pipeline { git_take( projects ) } } - - } } }