From 5cf6ef5b1c5e62f84ff0294f5222eebe8ac4198d Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 5 Jul 2024 13:01:49 +0200 Subject: [PATCH] ci: refs #7643 Reprepro SSH credentials fix --- Jenkinsfile | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ca9f473c..e6d7215f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,33 +52,31 @@ pipeline { } steps { unstash 'debuildOutput' - script { debFile = sh(script: 'ls output/*.deb', returnStdout: true).trim() + } + 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 - withCredentials([sshUserPrivateKey( - credentialsId: 'jenkins-agent', - usernameVariable: 'user', - keyFileVariable: 'identityFile' - )]) { - remote.user = user - remote.identityFile = identityFile - } + 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" - ]) } } stage('Container') {