2019-01-24 17:39:18 +01:00
|
|
|
def publish(
|
2019-02-20 15:30:20 +01:00
|
|
|
List packages = [],
|
2019-01-24 17:39:18 +01:00
|
|
|
String packagesEnv = 'dev',
|
|
|
|
String packagesBranch = '',
|
|
|
|
String sshCredentialsId = 'vulcain-packages-ssh-keypair',
|
|
|
|
String vulcainHost = 'vulcain.cadoles.com'
|
|
|
|
) {
|
|
|
|
if (!packagesBranch) {
|
|
|
|
packagesBranch = env.BRANCH_NAME
|
|
|
|
}
|
|
|
|
withCredentials([
|
|
|
|
sshUserPrivateKey(credentialsId: sshCredentialsId, keyFileVariable: 'VULCAIN_SSH_KEY', usernameVariable: 'VULCAIN_SSH_USER')
|
|
|
|
]) {
|
2019-02-05 12:02:57 +01:00
|
|
|
echo "Publishing packages to '${packagesEnv}/${packagesBranch}'"
|
2019-02-20 15:30:20 +01:00
|
|
|
sh "ssh -i '${VULCAIN_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${VULCAIN_SSH_USER}@${vulcainHost}' mkdir -p '/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}'"
|
|
|
|
packages.each {
|
2019-02-26 11:08:21 +01:00
|
|
|
sh "scp -C -i '${VULCAIN_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${it}' '${VULCAIN_SSH_USER}@${vulcainHost}:/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}/'"
|
2019-02-20 15:30:20 +01:00
|
|
|
}
|
2019-01-24 17:39:18 +01:00
|
|
|
}
|
|
|
|
}
|