diff --git a/Jenkinsfile b/Jenkinsfile index afebe04c..ca8b37fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -219,26 +219,29 @@ pipeline { steps { withCredentials([ usernamePassword(credentialsId: 'harbor-credentials', usernameVariable: 'HARBOR_USERNAME', passwordVariable: 'HARBOR_PASSWORD'), - string(credentialsId: 'dev-server-user', variable: 'DEV_SERVER_USER'), string(credentialsId: 'dev-server-host', variable: 'DEV_SERVER_HOST'), - sshUserPrivateKey(credentialsId: 'dev-server-ssh', keyFileVariable: 'DEV_SERVER_KEY') + sshUserPrivateKey( + credentialsId: 'dev-server-ssh', + keyFileVariable: 'DEV_SERVER_KEY', + usernameVariable: 'DEV_SERVER_SSH_USER' + ) ]) { script { def remote = [ name: 'dev-server', host: env.DEV_SERVER_HOST, - user: env.DEV_SERVER_USER, + user: env.DEV_SERVER_SSH_USER, identityFile: env.DEV_SERVER_KEY, allowAnyHosts: true ] - sshCommand remote: remote, command: """ + sshCommand remote: remote, command: ''' set -euo pipefail cd ~/projects/anexo76 - echo '${env.HARBOR_PASSWORD}' | docker login '${env.REGISTRY}' -u '${env.HARBOR_USERNAME}' --password-stdin + # Asume docker login ya configurado en el host destino para evitar exponer secretos por interpolación. docker compose -f docker-compose.prod.yml pull docker compose -f docker-compose.prod.yml up -d docker image prune -f - """ + ''' } } }