diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-14 16:48:53 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-14 18:04:00 +0200 |
commit | 01b8623c482a3c89bd738c933834c669a2c82d21 (patch) | |
tree | 1d3002832d0eed6477797953e15676edadf8aacb /Jenkinsfile | |
parent | c636fc4747fba85600e6801ebb492b60fb993c47 (diff) | |
download | vyos-build-01b8623c482a3c89bd738c933834c669a2c82d21.tar.gz vyos-build-01b8623c482a3c89bd738c933834c669a2c82d21.zip |
Jenkins: deploy ISO to dev.packages.vyos.net
Diffstat (limited to 'Jenkinsfile')
-rw-r--r-- | Jenkinsfile | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index a5bbd89c..71b538c2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,5 @@ #!/usr/bin/env groovy - -// Copyright (C) 2018 VyOS maintainers and contributors +// Copyright (C) 2019 VyOS maintainers and contributors // // This program is free software; you can redistribute it and/or modify // in order to easy exprort images built to "external" world @@ -18,7 +17,8 @@ @NonCPS def getGitBranchName() { - return scm.branches[0].name + def branch = scm.branches[0].name + return branch.split('/')[-1] } def getGitRepoURL() { @@ -98,7 +98,32 @@ pipeline { } post { success { - archiveArtifacts artifacts: 'build/live-image-*.iso', fingerprint: true + // publish build result, using SSH-dev.packages.vyos.net Jenkins Credentials + sshagent(['SSH-dev.packages.vyos.net']) { + script { + // build up some fancy groovy variables so we do not need to write/copy + // every option over and over again! + def ARCH = sh(returnStdout: true, script: "dpkg --print-architecture").trim() + def SSH_DIR = '/home/sentrium/web/downloads.vyos.io/public_html/rolling/' + getGitBranchName() + '/' + ARCH + def SSH_OPTS = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + def SSH_REMOTE = 'khagen@10.217.48.113' + + // No need to explicitly check the return code. The pipeline + // will fail if sh returns a non 0 exit code + sh """ + ssh ${SSH_OPTS} ${SSH_REMOTE} -t "bash --login -c 'mkdir -p ${SSH_DIR}'" + """ + sh """ + ssh ${SSH_OPTS} ${SSH_REMOTE} -t "bash --login -c 'mkdir -p ${SSH_DIR}'" + """ + sh """ + ssh ${SSH_OPTS} ${SSH_REMOTE} -t "bash --login -c 'find ${SSH_DIR} -type f -mtime +14 -exec rm -f {} \\;'" + """ + sh """ + scp ${SSH_OPTS} build/vyos*.iso ${SSH_REMOTE}:${SSH_DIR}/ + """ + } + } } cleanup { echo 'One way or another, I have finished' |