From ed19a11152dce4c15422581199308cbce95d954c Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 26 Mar 2021 19:29:59 +0100 Subject: Jenkins: add build option for AWS S3 snapshot bucket upload (cherry picked from commit 222a7d7f478bc61b2b6f56f77273fa23b31d8c82) --- Jenkinsfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Jenkinsfile') diff --git a/Jenkinsfile b/Jenkinsfile index dc07c0a2..967bf424 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -109,6 +109,7 @@ pipeline { string(name: 'BUILD_VERSION', defaultValue: '1.3-rolling-' + env.TIMESTAMP, description: 'Version number (release builds only)') booleanParam(name: 'BUILD_PUBLISH', defaultValue: true, description: 'Publish this build to downloads.vyos.io and AWS S3') booleanParam(name: 'BUILD_SMOKETESTS', defaultValue: true, description: 'Include Smoketests in ISO image') + booleanParam(name: 'BUILD_SNAPSHOT', defaultValue: false, description: 'Upload image to AWS S3 snapshot bucket') } triggers { cron('H 4 * * *') @@ -199,12 +200,11 @@ pipeline { // only deploy ISO if build from official repository if (isCustomBuild()) return - if (! params.BUILD_PUBLISH) - return files = findFiles(glob: 'build/vyos*.iso') - if (files) { - // publish build result, using SSH-dev.packages.vyos.net Jenkins Credentials + // Publish ISO image to daily builds bucket + if (files && params.BUILD_PUBLISH) { + // Publish build result, using SSH-dev.packages.vyos.net Jenkins Credentials sshagent(['SSH-dev.packages.vyos.net']) { dir('build') { // build up some fancy groovy variables so we do not need to write/copy @@ -233,6 +233,14 @@ pipeline { toBucket: 's3-us.vyos.io', toPath: getGitBranchName() + '/vyos-rolling-latest.iso') } } + + // Publish ISO image to snapshot bucket + if (files && params.BUILD_SNAPSHOT) { + withAWS(region: 'us-east-1', credentials: 's3-vyos-downloads-rolling-rw') { + s3Upload(bucket: 's3-us.vyos.io', path: 'snapshot/', + workingDir: 'build', includePathPattern: 'vyos*.iso') + } + } } } failure { -- cgit v1.2.3