some changes with git clone and fetch

This commit is contained in:
Artur Kuś 2025-09-04 11:25:28 +02:00
parent cb3c073681
commit 7c0258246e
1 changed files with 6 additions and 6 deletions

View File

@ -8,21 +8,21 @@ def projects = [
]
def git_take(projects, git_remote) {
withCredentials([usernamePassword(credentialsId: 'c3c1f5bf-8f6e-4686-b26c-3f419ef7973e', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) {
withCredentials([usernamePassword(credentialsId: 'gitea-creds', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) {
projects.each { project ->
if (fileExists(project)) {
dir(project) {
sh """
echo "=== Updating ${project} ==="
git fetch https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git --all
git fetch origin
git reset --hard origin/main
"""
}
} else {
sh """
echo "=== Cloning ${project} ==="
git clone https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git
"""
sh '''
git clone https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/project.git
'''
}
dir(project) {
sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short"