order in update form gitea

This commit is contained in:
Artur Kuś 2025-03-26 20:47:32 +01:00
parent d0d7fcb6ed
commit 2e665ac468
1 changed files with 30 additions and 42 deletions

View File

@ -1,61 +1,49 @@
def git_remote = "https://git.arti24.eu/gitea" def git_remote = "https://git.arti24.eu/gitea"
def projects = [ def projects = [
"proxy-nginx", "proxy-nginx",
"arti24", "arti24",
"angular-services", "angular-services",
"arti-angular-app" "arti-angular-app"
] ]
def git_take( projects, git_remote ){ def git_take(projects, git_remote) {
if (projects.empty) {
if( 0 == projects.size() ){ sh "git pull"
def git_pull ="git pull" sh "git log -n 1"
sh( git_pull ) } else {
sh("git log -n 1") projects.each { project ->
}else{ if (fileExists(project)) {
for( project in projects ){ dir(project) {
sh "git fetch --all && git reset --hard origin/HEAD"
if( fileExists( project ) ){
dir( project ){
sh "git fetch --all && git reset --hard origin/HEAD"
} }
}else{ } else {
sh "git clone "+git_remote+"/"+project+".git" sh "git clone ${git_remote}/${project}.git"
} }
dir( project ){ dir(project) {
sh( "git log -n 1"); sh "git log -n 1"
} }
}
}
} }
} }
def disableSafeDirCheck(){ def disableSafeDirCheck() {
def disableSafeDirCheck="git config --global --add safe.directory '*'" sh "git config --global --add safe.directory '*'"
sh( disableSafeDirCheck )
} }
pipeline { pipeline {
agent any
agent any
stages { stages {
stage('Update from git') { stage('Update from git') {
steps { steps {
script{ script {
disableSafeDirCheck() disableSafeDirCheck()
dir("/_programs_") {
git_take(projects, git_remote) // Dodano git_remote jako argument
}
} }
dir("/_programs_"){
script{
git_take( projects )
}
}
} }
} }
} }
}
}