diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-08-03 15:50:55 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-08-03 15:50:58 +0200 |
commit | 259763415038b57648d0cedab60e851f2deffa7f (patch) | |
tree | eb6f0dc951da519bfbe3181e1880933ba8ea91ee /Jenkinsfile | |
parent | f0f368e80d57f9a848f3690e7c793db9dae6da33 (diff) | |
download | vyos-build-259763415038b57648d0cedab60e851f2deffa7f.tar.gz vyos-build-259763415038b57648d0cedab60e851f2deffa7f.zip |
Jenkins: fix post { success { }} script when there is no ISO build
Diffstat (limited to 'Jenkinsfile')
-rw-r--r-- | Jenkinsfile | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index ceaae5da..9b447af5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -167,37 +167,33 @@ pipeline { if (isCustomBuild()) return - def ARCH = sh(returnStdout: true, script: "dpkg --print-architecture").trim() - - // publish build result, using SSH-dev.packages.vyos.net Jenkins Credentials - sshagent(['SSH-dev.packages.vyos.net']) { - // build up some fancy groovy variables so we do not need to write/copy - // every option over and over again! - 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}'" - ssh ${SSH_OPTS} ${SSH_REMOTE} -t "bash --login -c 'find ${SSH_DIR} -type f -mtime +14 -exec rm -f {} \\;'" - scp ${SSH_OPTS} build/vyos*.iso ${SSH_REMOTE}:${SSH_DIR}/ - ssh ${SSH_OPTS} ${SSH_REMOTE} -t "bash --login -c '/usr/bin/make-latest-rolling-symlink.sh'" - """ - } - //upload to S3 files = findFiles(glob: 'build/vyos*.iso') if (files) { + // publish build result, using SSH-dev.packages.vyos.net Jenkins Credentials + sshagent(['SSH-dev.packages.vyos.net']) { + // 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}'" + ssh ${SSH_OPTS} ${SSH_REMOTE} -t "bash --login -c 'find ${SSH_DIR} -type f -mtime +14 -exec rm -f {} \\;'" + scp ${SSH_OPTS} build/vyos*.iso ${SSH_REMOTE}:${SSH_DIR}/ + ssh ${SSH_OPTS} ${SSH_REMOTE} -t "bash --login -c '/usr/bin/make-latest-rolling-symlink.sh'" + """ + } + + // Upload to Amazon S3 storage withAWS(region: 'us-east-1', credentials: 's3-vyos-downloads-rolling-rw') { - s3Upload(bucket: 's3-us.vyos.io', - path: 'rolling/', - workingDir: 'build', - includePathPattern: 'vyos*.iso') - s3Copy(fromBucket: 's3-us.vyos.io', - fromPath: 'rolling/' + files[0].name, - toBucket: 's3-us.vyos.io', - toPath: 'rolling/vyos-rolling-latest.iso') + s3Upload(bucket: 's3-us.vyos.io', path: 'rolling/', + workingDir: 'build', includePathPattern: 'vyos*.iso') + s3Copy(fromBucket: 's3-us.vyos.io', fromPath: 'rolling/' + files[0].name, + toBucket: 's3-us.vyos.io', toPath: 'rolling/vyos-rolling-latest.iso') } } } |