adding credintials id
This commit is contained in:
parent
a4f5f585ed
commit
cb3c073681
|
|
@ -8,16 +8,25 @@ def projects = [
|
||||||
]
|
]
|
||||||
|
|
||||||
def git_take(projects, git_remote) {
|
def git_take(projects, git_remote) {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'c3c1f5bf-8f6e-4686-b26c-3f419ef7973e', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) {
|
||||||
projects.each { project ->
|
projects.each { project ->
|
||||||
if (fileExists(project)) {
|
if (fileExists(project)) {
|
||||||
dir(project) {
|
dir(project) {
|
||||||
sh "git fetch --all && git reset --hard origin/HEAD"
|
sh """
|
||||||
|
echo "=== Updating ${project} ==="
|
||||||
|
git fetch https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git --all
|
||||||
|
git reset --hard origin/main
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sh "git clone ${git_remote}/${project}.git"
|
sh """
|
||||||
|
echo "=== Cloning ${project} ==="
|
||||||
|
git clone https://${GIT_USER}:${GIT_PASS}@git.arti24.eu/gitea/${project}.git
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
dir(project) {
|
dir(project) {
|
||||||
sh "git log -n 1"
|
sh "git --no-pager log -n 1 --pretty=format:'%h %ad %s' --date=short"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -35,7 +44,7 @@ pipeline {
|
||||||
script {
|
script {
|
||||||
disableSafeDirCheck()
|
disableSafeDirCheck()
|
||||||
dir("/_sd_/_programs_") {
|
dir("/_sd_/_programs_") {
|
||||||
git_take(projects, git_remote) // Dodano git_remote jako argument
|
git_take(projects, git_remote)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue