From b0f21964c5bcb4f008e79e15ea4b3f726ad82435 Mon Sep 17 00:00:00 2001 From: 12ww1160 <12ww1160@confdroid.com> Date: Sat, 13 Jun 2026 14:56:23 +0200 Subject: [PATCH] OP#618 add ssh-agent to last stage --- Jenkinsfile | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4959f6b..681bb75 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,21 +107,23 @@ pipeline { } stage('Mirror to Gitea') { steps { - withCredentials([usernamePassword( - credentialsId: 'Jenkins-gitea', - usernameVariable: 'GITEA_USER', - passwordVariable: 'GITEA_TOKEN')]) { - script { - sh ''' - git fetch origin - git checkout master - git reset --hard origin/master - git remote get-url master >/dev/null 2>&1 \ - && git remote set-url master https://sourcecode.confdroid.com/confdroid/confdroid_ssh.git \ - || git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_ssh.git - git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \ - push --force master refs/heads/master:refs/heads/master - ''' + sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) { + withCredentials([usernamePassword( + credentialsId: 'Jenkins-gitea', + usernameVariable: 'GITEA_USER', + passwordVariable: 'GITEA_TOKEN')]) { + script { + sh ''' + git fetch origin + git checkout master + git reset --hard origin/master + git remote get-url master >/dev/null 2>&1 \ + && git remote set-url master https://sourcecode.confdroid.com/confdroid/confdroid_ssh.git \ + || git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_ssh.git + git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \ + push --force master refs/heads/master:refs/heads/master + ''' + } } } }