OP#618 add ssh-agent to last stage

This commit is contained in:
2026-06-13 14:49:53 +02:00
parent 2911d4d783
commit 3999ffc47f

38
Jenkinsfile vendored
View File

@@ -98,26 +98,28 @@ pipeline {
} }
} }
stage('Mirror to Gitea') { stage('Mirror to Gitea') {
steps { steps {
withCredentials([usernamePassword( sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
credentialsId: 'Jenkins-gitea', withCredentials([usernamePassword(
usernameVariable: 'GITEA_USER', credentialsId: 'Jenkins-gitea',
passwordVariable: 'GITEA_TOKEN')]) { usernameVariable: 'GITEA_USER',
passwordVariable: 'GITEA_TOKEN')]) {
script { script {
// Checkout from GitLab (already done implicitly) // Checkout from GitLab (already done implicitly)
sh ''' sh '''
git checkout master git checkout master
git pull origin master git pull origin master
git branch -D development git branch -D development
git branch -D jenkins-build-$BUILD_NUMBER git branch -D jenkins-build-$BUILD_NUMBER
git rm -f Jenkinsfile git rm -f Jenkinsfile
git rm -r --cached .vscode || echo "No .vscode to remove from git" git rm -r --cached .vscode || echo "No .vscode to remove from git"
git commit --amend --no-edit --allow-empty git commit --amend --no-edit --allow-empty
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_prometheus.git git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_prometheus.git
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \ git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
push master --mirror push master --mirror
''' '''
}
} }
} }
} }