20 lines
894 B
Groovy
20 lines
894 B
Groovy
def publish(
|
|
String packagesDir = './packages',
|
|
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')
|
|
]) {
|
|
sh """
|
|
SSH_ARGS='-i ${VULCAIN_SSH_KEY} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
|
ssh \$SSH_ARGS ${VULCAIN_SSH_USER}@${vulcainHost} mkdir -p '/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}'
|
|
scp \$SSH_ARGS -r ${packagesDir}/*.deb '${VULCAIN_SSH_USER}@${vulcainHost}:/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}/'
|
|
"""
|
|
}
|
|
} |