From 4ffe5fe87638d92398252d6f23ab93ac0d1ec6fd Mon Sep 17 00:00:00 2001 From: Mike Marchetti Date: Tue, 21 Nov 2017 15:07:59 -0500 Subject: [PATCH] use -staging for artifacts for patchset builds Signed-off-by: Mike Marchetti --- jenkins/ci-pipelines/ci_helper.groovy | 24 +++++++++++++++++------- jenkins/ci-pipelines/ci_stage_2.groovy | 2 +- jenkins/ci-pipelines/ci_stage_3.groovy | 4 ++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/jenkins/ci-pipelines/ci_helper.groovy b/jenkins/ci-pipelines/ci_helper.groovy index d058099c..9708b1c8 100644 --- a/jenkins/ci-pipelines/ci_helper.groovy +++ b/jenkins/ci-pipelines/ci_helper.groovy @@ -20,19 +20,23 @@ def get_archive(artifactory_server, mdg, branch, build_name, build_number, patte println("retrieve archive for ${mdg}/${branch}/${build_name}/${build_number}/${pattern}") + // if the build name does not contain merge, then this is a patchset/staging job + if (!build_name.contains('merge')) { + branch += '-staging' + } def repo_prefix = 'osm-' def downloadSpec = """{ "files": [ { "target": "./", - "pattern": "${repo_prefix}${mdg}/${branch}/${pattern}", + "pattern": "${repo_prefix}${mdg}/${branch}/${build_number}/${pattern}", "build": "${build_name}/${build_number}" } ] }""" server.download(downloadSpec) - // workaround. flatten and repo the specific build num from the directory + // workaround. flatten repo to remove specific build num from the directory sh "cp -R ${branch}/${build_num}/* ." sh "rm -rf ${branch}/${build_num}" } @@ -87,30 +91,36 @@ def get_ip_from_container( container_name ) { def archive(artifactory_server,mdg,branch,status) { server = Artifactory.server artifactory_server - def properties = "branch=${branch};status=${status}" + def properties = "" + //def properties = "branch=${branch};status=${status}" def repo_prefix = 'osm-' + + // if the build name does not contain merge, then this is a patchset/staging job + if ( !JOB_NAME.contains('merge') ) { + branch += '-staging' + } def uploadSpec = """{ "files": [ { - "pattern": "changelog/*", + "pattern": "dists/*.gz", "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/", "props": "${properties}", "flat": false }, { - "pattern": "dists/*.gz", + "pattern": "dists/*Packages", "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/", "props": "${properties}", "flat": false }, { - "pattern": "dists/*Packages", + "pattern": "pool/*/*.deb", "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/", "props": "${properties}", "flat": false }, { - "pattern": "pool/*/*.deb", + "pattern": "changelog/*", "target": "${repo_prefix}${mdg}/${branch}/${BUILD_NUMBER}/", "props": "${properties}", "flat": false diff --git a/jenkins/ci-pipelines/ci_stage_2.groovy b/jenkins/ci-pipelines/ci_stage_2.groovy index aa4a9f4b..52e2f1d3 100644 --- a/jenkins/ci-pipelines/ci_stage_2.groovy +++ b/jenkins/ci-pipelines/ci_stage_2.groovy @@ -62,7 +62,7 @@ def ci_pipeline(mdg,url_prefix,project,branch,refspec,revision,do_stage_3,artifa } stage('Archive') { - sh "mkdir changelog" + sh "mkdir -p changelog" sh "devops/tools/generatechangelog-pipeline.sh > changelog/changelog-${mdg}.html" sh(returnStdout:true, script: 'devops-stages/stage-archive.sh').trim() ci_helper.archive(artifactory_server,mdg,branch,'untested') diff --git a/jenkins/ci-pipelines/ci_stage_3.groovy b/jenkins/ci-pipelines/ci_stage_3.groovy index d8751bb7..f9ca4792 100644 --- a/jenkins/ci-pipelines/ci_stage_3.groovy +++ b/jenkins/ci-pipelines/ci_stage_3.groovy @@ -132,8 +132,8 @@ node("${params.NODE}") { // merge the change logs sh """ - rm -f changelog/osm-changelog.html - [ ! -d changelog ] || for mdgchange in \$(ls changelog); do cat changelog/\$mdgchange >> changelog/osm-changelog.html; done + rm -f changelog/changelog-osm.html + [ ! -d changelog ] || for mdgchange in \$(ls changelog); do cat changelog/\$mdgchange >> changelog/changelog-osm.html; done """ } // start an apache server to serve up the images -- 2.25.1