diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-15 11:00:02 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-15 11:00:02 +0200 |
commit | 47b95b15b3168a9fc7183961e40fd20601a74066 (patch) | |
tree | 65f813dadd60f71753010912b6697756b6827ab8 | |
parent | 1e53198432b8723b6c4f06c224c9373300edc51d (diff) | |
download | vyos-build-47b95b15b3168a9fc7183961e40fd20601a74066.tar.gz vyos-build-47b95b15b3168a9fc7183961e40fd20601a74066.zip |
Jenkins: only deploy ISO if build from official repository
-rw-r--r-- | Jenkinsfile | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index ee5b7528..bcf1bdb1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -103,27 +103,30 @@ pipeline { // 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' + // only deploy ISO if build from official repository + if (! isCustomBuild()) { + // 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}/ - """ + // 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}/ + """ + } } } } |