This commit is contained in:
Artur Kuś 2025-09-04 23:43:39 +02:00
parent 01eca704e7
commit b4e0ee381e
1 changed files with 29 additions and 25 deletions

View File

@ -1,34 +1,38 @@
pipeline { def projects = [
agent { "proxy-nginx",
node { "arti24",
label 'master' // lub inna działająca etykieta "angular-services",
customWorkspace '/_sd_/_programs_' "arti-angular-app"
} ]
}
pipeline {
agent any // NAJBEZPIECZNIEJSZA OPCJA
stages { stages {
stage('Update from git') { stage('Update Git Repositories') {
steps { steps {
script { dir('/_sd_/_programs_') {
withCredentials([usernamePassword( script {
credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe', withCredentials([usernamePassword(
usernameVariable: 'GIT_USER', credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe',
passwordVariable: 'GIT_PASS')]) { usernameVariable: 'GIT_USER',
passwordVariable: 'GIT_PASS')]) {
projects.each { project ->
if (fileExists(project)) { projects.each { project ->
dir(project) { if (fileExists(project)) {
dir(project) {
sh """
git config --global --add safe.directory \$(pwd)
git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git
git fetch --prune origin
git checkout -B main origin/main
"""
}
} else {
sh """ sh """
git config --global --add safe.directory \$(pwd) git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git ${project}
git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git
git fetch --prune origin
git checkout -B main origin/main
""" """
} }
} else {
sh """
git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git ${project}
"""
} }
} }
} }