diff --git a/Jenkinsfile b/Jenkinsfile index 5503ae2..b40ff65 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,6 +11,7 @@ if (params.Type == 'SNAPSHOT-DRY-RUN') { options = '' maven_local_repo_path = "local-snapshots" maven_settings_file = "jenkins-snapshots-dry-run-settings.xml" + maven_activation_property=""; maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } if (params.Type == 'SNAPSHOT') { @@ -18,6 +19,7 @@ if (params.Type == 'SNAPSHOT') { options = '' maven_local_repo_path = "local-snapshots" maven_settings_file = "jenkins-snapshots-settings.xml" + maven_activation_property=""; maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } if (params.Type == 'RELEASE-DRY-RUN') { @@ -25,6 +27,7 @@ if (params.Type == 'RELEASE-DRY-RUN') { options = '' maven_local_repo_path = "local-releases" maven_settings_file = "jenkins-releases-dry-run-settings.xml" + maven_activation_property="-Djenkins-releases=true"; maven_parent_file = "jenkins-releases-dry-run-settings.xml" } if (params.Type == 'STAGING') { @@ -32,6 +35,7 @@ if (params.Type == 'STAGING') { options = '' maven_local_repo_path = "local-staging" maven_settings_file = "jenkins-staging-settings.xml" + maven_activation_property="-Djenkins-staging=true"; maven_parent_file = "jenkins-staging-dry-run-settings.xml" } if (params.Type == 'RELEASE') { @@ -39,10 +43,11 @@ if (params.Type == 'RELEASE') { options = '' maven_local_repo_path = "local-releases" maven_settings_file = "jenkins-releases-settings.xml" + maven_activation_property="-Djenkins-releases=true"; maven_parent_file = "jenkins-releases-dry-run-settings.xml" } -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}" @@ -80,7 +85,9 @@ pipeline { // see https://jenkins.io/doc/book/pipeline/syntax/#agent agent { - label 'CD' +// label 'CD' +// just for test I'm going to use the following label + label 'CD-test' } // see https://jenkins.io/doc/book/pipeline/syntax/#environment @@ -90,6 +97,7 @@ pipeline { MAVEN_OPTS = "${params.build_options}" AGENT_ROOT_FOLDER = "${agent_root_folder}" MAVEN_SETTINGS_FILE = "${maven_settings_file}" + MAVEN_ACTIVATION_PROPERTY = "${maven_activation_property}" MAVEN_PARENT_FILE = "${maven_parent_file}" MAVEN_LOCAL_REPO = "${agent_root_folder}/${maven_local_repo_path}" CLEANUP_GCUBE_REPO = "${params.cleanup_gcube_artifacts}" @@ -217,7 +225,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 +288,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 +299,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']] ])