This commit is contained in:
Artur Kuś 2025-09-04 21:55:29 +02:00
parent e47d4156c0
commit ede5718102
1 changed files with 9 additions and 8 deletions

View File

@ -7,16 +7,17 @@ def projects = [
"arti-angular-app"
]
def programs = "/_sd_/_programs_/"
def git_take(projects, git_remote) {
withCredentials([usernamePassword(credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) {
projects.each { project ->
def projectPath = "${env.WORKSPACE}/${project}"
def projectPath = "${programs}/${project}"
if (fileExists(project)) {
dir(project) {
if (fileExists(projectPath)) {
dir(projectPath) {
sh """
echo "=== Updating ${project} ==="
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 --depth=1000 origin main
git reset --hard origin/main
@ -25,14 +26,14 @@ def git_take(projects, git_remote) {
} else {
sh """
echo "=== Cloning ${project} (last year only) ==="
git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git
git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git ${projectPath}
"""
if (!fileExists(project)) {
if (!fileExists(projectPath)) {
error("❌ Nie udało się sklonować repozytorium ${project}")
}
}
dir(project) {
dir(projectPath) {
sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short"
}
}
@ -51,7 +52,7 @@ pipeline {
steps {
script {
disableSafeDirCheck()
dir("/_sd_/_programs_") {
dir("${programs}") {
git_take(projects, git_remote)
}
}