- // grab the build name/number
- build_num = ci_helper.get_env_value('build.env','BUILD_NUMBER')
-
- // grab the archives from the stage_2 builds (ie. this will be the artifacts stored based on a merge)
- ci_helper.get_archive(params.ARTIFACTORY_SERVER,component,GERRIT_BRANCH, "${component}${upstream_main_job} :: ${GERRIT_BRANCH}", build_num)
-
- // cleanup any prevously defined dists
- sh "rm -rf dists"
- }
-
- // check if an upstream artifact based on specific build number has been requested
- // This is the case of a merge build and the upstream merge build is not yet complete (it is not deemed
- // a successful build yet). The upstream job is calling this downstream job (with the its build artifiact)
- if ( params.UPSTREAM_JOB_NAME ) {
- step ([$class: 'CopyArtifact',
- projectName: "${params.UPSTREAM_JOB_NAME}",
- selector: [$class: 'SpecificBuildSelector', buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]
- ])
-
- build_num = ci_helper.get_env_value('build.env','BUILD_NUMBER')
- component = ci_helper.get_mdg_from_project(ci_helper.get_env_value('build.env','GERRIT_PROJECT'))
-
- // the upstream job name contains suffix with the project. Need this stripped off
- def project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0]
-
- // Remove the previous artifact for this component. Use the new upstream artifact
- sh "rm -rf pool/${component}"
+ try {
+ builtModules = [:]
+///////////////////////////////////////////////////////////////////////////////////////
+// Fetch stage 2 .deb artifacts
+///////////////////////////////////////////////////////////////////////////////////////
+ stage('Copy Artifacts') {
+ // cleanup any previous repo
+ sh 'rm -rf repo'
+ dir('repo') {
+ packageList = []
+ dir("${RELEASE}") {
+ RELEASE_DIR = sh(returnStdout:true, script: 'pwd').trim()
+
+ // check if an upstream artifact based on specific build number has been requested
+ // This is the case of a merge build and the upstream merge build is not yet complete
+ // (it is not deemed a successful build yet). The upstream job is calling this downstream
+ // job (with the its build artifact)
+ def upstreamComponent = ''
+ if (params.UPSTREAM_JOB_NAME) {
+ println("Fetching upstream job artifact from ${params.UPSTREAM_JOB_NAME}")
+ lock('Artifactory') {
+ step ([$class: 'CopyArtifact',
+ projectName: "${params.UPSTREAM_JOB_NAME}",
+ selector: [$class: 'SpecificBuildSelector',
+ buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]
+ ])
+
+ upstreamComponent = ci_helper.get_mdg_from_project(
+ ci_helper.get_env_value('build.env','GERRIT_PROJECT'))
+ def buildNumber = ci_helper.get_env_value('build.env','BUILD_NUMBER')
+ dir("$upstreamComponent") {
+ // the upstream job name contains suffix with the project. Need this stripped off
+ project_without_branch = params.UPSTREAM_JOB_NAME.split('/')[0]
+ packages = ci_helper.get_archive(params.ARTIFACTORY_SERVER,
+ upstreamComponent,
+ GERRIT_BRANCH,
+ "${project_without_branch} :: ${GERRIT_BRANCH}",
+ buildNumber)
+
+ packageList.addAll(packages)
+ println("Fetched pre-merge ${params.UPSTREAM_JOB_NAME}: ${packages}")
+ }
+ } // lock artifactory
+ }