This commit is contained in:
Artur Kuś 2025-09-04 23:39:57 +02:00
parent 36e1417af1
commit 01eca704e7
1 changed files with 28 additions and 50 deletions

View File

@ -1,15 +1,15 @@
def git_remote = "https://git.arti24.eu/gitea" pipeline {
agent {
node {
label 'master' // lub inna działająca etykieta
customWorkspace '/_sd_/_programs_'
}
}
def projects = [ stages {
"proxy-nginx", stage('Update from git') {
"arti24", steps {
"angular-services", script {
"arti-angular-app"
]
def programs = "/_sd_/_programs_"
def git_take(projects, git_remote) {
withCredentials([usernamePassword( withCredentials([usernamePassword(
credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe', credentialsId: '9e8daaa4-8c14-41ae-947b-65ba47965dfe',
usernameVariable: 'GIT_USER', usernameVariable: 'GIT_USER',
@ -19,7 +19,6 @@ def git_take(projects, git_remote) {
if (fileExists(project)) { if (fileExists(project)) {
dir(project) { dir(project) {
sh """ sh """
echo "=== Updating ${project} ==="
git config --global --add safe.directory \$(pwd) git config --global --add safe.directory \$(pwd)
git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git git remote set-url origin https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git
git fetch --prune origin git fetch --prune origin
@ -28,32 +27,11 @@ def git_take(projects, git_remote) {
} }
} else { } else {
sh """ 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 ${project} git clone --shallow-since="1 year ago" https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git ${project}
""" """
dir(project) { }
sh "git config --global --add safe.directory \$(pwd)" }
} }
}
dir(project) {
sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short"
}
}
}
}
pipeline {
agent any
environment {
CUSTOM_WORKSPACE = '/_sd_/_programs_'
}
stages {
stage('Update from git') {
steps {
script {
git_take(projects, git_remote)
} }
} }
} }