pipeline { agent any environment { SSH_CREDENTIALS_ID = 'SSH' GIT_CREDENTIALS_ID = 'Gitea-user' } stages { stage('Checkout') { steps { // Hace un checkout del repositorio Git utilizando las credenciales de Git withCredentials([usernamePassword(credentialsId: 'SSH', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD')]) { git credentialsId: 'SSH', url: 'ssh://git@gitssh.mainserverprivate.org:8222/vgallegoiz/Status.git' } } } stage('Pull') { steps { // Ejecuta un Git Pull en el servidor remoto script { sshagent(credentials: ['${SSH_CREDENTIALS_ID}']) { sh 'ssh usuario@192.168.1.39 "cd /home/userpi/Status && git pull"' } } } } } }