From 9088ec44d118fb103918979f4f924ee5858bc4c1 Mon Sep 17 00:00:00 2001 From: Artur Date: Sun, 6 Oct 2024 15:08:55 +0200 Subject: [PATCH] Update from git --- deploy-this/update-from-git.jenkinsfile | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 deploy-this/update-from-git.jenkinsfile diff --git a/deploy-this/update-from-git.jenkinsfile b/deploy-this/update-from-git.jenkinsfile new file mode 100644 index 0000000..8693077 --- /dev/null +++ b/deploy-this/update-from-git.jenkinsfile @@ -0,0 +1,61 @@ +def projects = [ + "proxy-nginx", + "arti-angular-app", + "angular-services" +] + +def git_take( projects ){ + + if( 0 == projects.size() ){ + def git_pull ="git -c http.sslVerify=false pull" + sh( git_pull ) + sh("git log -n 1") + }else{ + for( project in projects ){ + def git_take ="git -c http.sslVerify=false " + if( fileExists( project ) ){ + git_take = git_take +"-C "+project+" pull" + }else{ + git_take = git_take +"clone "+ "https://artikus.dynu.net:7990/r/"+project+".git" + } + sh( git_take ) + dir( "./" + project ){ + sh("git log -n 1") + } + + + } + } + +} + +def disableSafeDirCheck(){ + def disableSafeDirCheck="git config --global --add safe.directory '*'" + sh( disableSafeDirCheck ) +} + + +pipeline { + + agent any + + stages { + stage('Update from git') { + steps { + script{ + disableSafeDirCheck() + } + dir("/_programs_"){ + script{ + git_take( projects ) + } + } + + + } + } + } + +} + +