diff --git a/Jenkinsfile b/Jenkinsfile index 5503ae2..46abb66 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ import org.yaml.snakeyaml.Yaml // set the build options according to the Type of build -def (options, maven_local_repo_path, maven_settings_file, maven_parent_file) = ['', '', '', ''] +def (options, maven_local_repo_path, maven_settings_file, maven_activation_property) = ['', '', '', ''] def agent_root_folder = '/var/lib/jenkins/.m2' def verbose = true def resume = params.resume_from @@ -10,39 +10,39 @@ if (params.Type == 'SNAPSHOT-DRY-RUN') { echo "Configure Maven for SNAPSHOT-DRY-RUN artifacts" options = '' maven_local_repo_path = "local-snapshots" - maven_settings_file = "jenkins-snapshots-dry-run-settings.xml" - maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" + maven_settings_file = "gcube-settings.xml" + maven_activation_property="-Pdry-run"; } if (params.Type == 'SNAPSHOT') { echo "Configure Maven for SNAPSHOT artifacts" options = '' maven_local_repo_path = "local-snapshots" - maven_settings_file = "jenkins-snapshots-settings.xml" - maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" + maven_settings_file = "gcube-settings.xml" + maven_activation_property=''; } if (params.Type == 'RELEASE-DRY-RUN') { echo "Configure Maven for RELEASE-DRY-RUN artifacts" options = '' maven_local_repo_path = "local-releases" - maven_settings_file = "jenkins-releases-dry-run-settings.xml" - maven_parent_file = "jenkins-releases-dry-run-settings.xml" + maven_settings_file = "jenkins-releases-settings.xml" + maven_activation_property="-Pdry-run -Djenkins-releases -DRelease"; } if (params.Type == 'STAGING') { echo "Configure Maven for STAGING artifacts" options = '' maven_local_repo_path = "local-staging" maven_settings_file = "jenkins-staging-settings.xml" - maven_parent_file = "jenkins-staging-dry-run-settings.xml" + maven_activation_property="-Djenkins-staging -DRelease"; } if (params.Type == 'RELEASE') { echo "Configure Maven for RELEASE artifacts" options = '' maven_local_repo_path = "local-releases" maven_settings_file = "jenkins-releases-settings.xml" - maven_parent_file = "jenkins-releases-dry-run-settings.xml" + maven_activation_property="-Djenkins-releases -DRelease"; } -echo "Use settings file at ${maven_settings_file}" +echo "Use settings file at ${maven_settings_file} with the following activation property: ${maven_activation_property}" echo "Use local repo at ${maven_local_repo_path}" echo "Release number: ${params.gCube_release_version}" echo "Clean up gcube local artifacts? ${params.cleanup_gcube_artifacts}" @@ -90,7 +90,7 @@ pipeline { MAVEN_OPTS = "${params.build_options}" AGENT_ROOT_FOLDER = "${agent_root_folder}" MAVEN_SETTINGS_FILE = "${maven_settings_file}" - MAVEN_PARENT_FILE = "${maven_parent_file}" + MAVEN_ACTIVATION_PROPERTY = "${maven_activation_property}" MAVEN_LOCAL_REPO = "${agent_root_folder}/${maven_local_repo_path}" CLEANUP_GCUBE_REPO = "${params.cleanup_gcube_artifacts}" REMOVE_LOCAL_REPO = "${params.cleanup_local_repo}" @@ -200,7 +200,7 @@ pipeline { sh "echo -e maven-parent,SUCCESS >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" } else { def gjob = build(job: 'maven-parent', wait: true, propagate: true, - parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_parent_file}"], + parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_settings_file} -Pdry-run"], [$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], [$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']] ]) @@ -217,7 +217,7 @@ pipeline { jsonConfig.gCube_release.Components.each { group_name, component_list -> stage("build ${group_name} components") { buildComponents items: component_list?.collect { "${it.name}" }, - "${maven_settings_file}", "${maven_local_repo_path}", jobs + "${maven_settings_file}", "${maven_activation_property}", "${maven_local_repo_path}", jobs echo "Done with ${group_name} components" } } @@ -280,7 +280,7 @@ pipeline { } } -def buildComponents(args, maven_settings_file, maven_local_repo_path, jobs) { +def buildComponents(args, maven_settings_file, maven_activation_property, maven_local_repo_path, jobs) { if (args.items) { parallel args.items?.collectEntries { name -> ["${name}": { @@ -291,7 +291,7 @@ def buildComponents(args, maven_settings_file, maven_local_repo_path, jobs) { sh "echo -e ${name},SUCCESS >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" } else { def gjob = build(job: name, wait: true, propagate: true, - parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_settings_file}"], + parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_settings_file} ${maven_activation_property}"], [$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], [$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']] ]) @@ -317,4 +317,4 @@ def parseJobs(content) { } } jobs; -} \ No newline at end of file +}