From 444732460e4ea157d6dfce209da93bbaeb0d7612 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 5 Jul 2024 13:05:06 +0200 Subject: [PATCH] ci: refs #7643 Reprepro SSH credentials fix --- Jenkinsfile | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f69d1031..a321d0a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -56,27 +56,28 @@ pipeline { debFile = sh(script: 'ls output/*.deb', returnStdout: true).trim() } - withCredentials([sshUserPrivateKey( - credentialsId: 'jenkins-agent', - usernameVariable: 'user', - keyFileVariable: 'identityFile' - )]) { - script { + script { + withCredentials([sshUserPrivateKey( + credentialsId: 'jenkins-agent', + usernameVariable: 'user', + keyFileVariable: 'identityFile' + )]) { remote.user = user remote.identityFile = identityFile remote.name = 'reprepro' remote.host = 'reprepro.reprepro' remote.allowAnyHosts = true + + sshPut([ + remote: remote, + from: "$debFile", + into: '/tmp' + ]) + sshcommand([ + remote: remote, + command: "sudo -u www-data reprepro -b /reprepro --gnupghome /reprepro/.gnupg includedeb bookworm /tmp/$debFile" + ]) } - sshPut([ - remote: remote, - from: "$debFile", - into: '/tmp' - ]) - sshcommand([ - remote: remote, - command: "sudo -u www-data reprepro -b /reprepro --gnupghome /reprepro/.gnupg includedeb bookworm /tmp/$debFile" - ]) } } }