From 49d307d1b3d44eb878b0eff887a900e465568c7d Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 21 Feb 2022 10:28:46 +0100 Subject: [PATCH 01/15] add new variable maven_activation_property. The new var will be passed to the build command --- Jenkinsfile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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']] ]) From 7a0ef754a170f7820770e80d4840f8149a72e3e2 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 21 Feb 2022 12:13:06 +0100 Subject: [PATCH 02/15] edit maven-activation-property value --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b40ff65..8a010a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +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_activation_property="-Pgcube-developer,dry-run"; maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } if (params.Type == 'SNAPSHOT') { @@ -27,7 +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_activation_property="-Pdry-run -Djenkins-releases=true -DRelease"; maven_parent_file = "jenkins-releases-dry-run-settings.xml" } if (params.Type == 'STAGING') { @@ -35,7 +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_activation_property="-Djenkins-staging=true -DRelease"; maven_parent_file = "jenkins-staging-dry-run-settings.xml" } if (params.Type == 'RELEASE') { @@ -43,7 +43,7 @@ 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_activation_property="-Djenkins-releases=true -DRelease"; maven_parent_file = "jenkins-releases-dry-run-settings.xml" } From d3243c1ffe632a244180ae807f8a36aa096ad7d2 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 21 Feb 2022 14:10:17 +0100 Subject: [PATCH 03/15] add value to "maven_activation_property" cases --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a010a0..42d8f78 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,8 +10,8 @@ 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_activation_property="-Pgcube-developer,dry-run"; + maven_settings_file = "jenkins-snapshots-dry-run-settings.xml" + maven_activation_property="-Pdry-run"; maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } if (params.Type == 'SNAPSHOT') { @@ -27,7 +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="-Pdry-run -Djenkins-releases=true -DRelease"; + maven_activation_property="-Pdry-run -Djenkins-releases -DRelease"; maven_parent_file = "jenkins-releases-dry-run-settings.xml" } if (params.Type == 'STAGING') { @@ -35,7 +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 -DRelease"; + maven_activation_property="-Djenkins-staging -DRelease"; maven_parent_file = "jenkins-staging-dry-run-settings.xml" } if (params.Type == 'RELEASE') { @@ -43,7 +43,7 @@ if (params.Type == 'RELEASE') { options = '' maven_local_repo_path = "local-releases" maven_settings_file = "jenkins-releases-settings.xml" - maven_activation_property="-Djenkins-releases=true -DRelease"; + maven_activation_property="-Djenkins-releases -DRelease"; maven_parent_file = "jenkins-releases-dry-run-settings.xml" } From e737501db651569bc1e686b9c735823aba164ff0 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 21 Feb 2022 15:03:22 +0100 Subject: [PATCH 04/15] defined maven_activation_property. Change maven_activation_property empty value from "" to '' --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 42d8f78..716eb20 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, maven_parent_file) = ['', '', '', '', ''] def agent_root_folder = '/var/lib/jenkins/.m2' def verbose = true def resume = params.resume_from @@ -19,7 +19,7 @@ if (params.Type == 'SNAPSHOT') { options = '' maven_local_repo_path = "local-snapshots" maven_settings_file = "jenkins-snapshots-settings.xml" - maven_activation_property=""; + maven_activation_property=''; maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } if (params.Type == 'RELEASE-DRY-RUN') { From 4161e23dd1d3aee1b878c46e61650ce00db66ed3 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 21 Feb 2022 15:23:20 +0100 Subject: [PATCH 05/15] removing maven-parent stage for testing purpose --- Jenkinsfile | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 716eb20..78d3efa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -199,26 +199,26 @@ pipeline { } // the maven-parent needs to be built (once) at each execution - stage('build maven-parent') { - steps { - script { - if (jobs['maven-parent'] == 'SUCCESS') { - echo "Skipping maven-parent" - // propagate success - 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}"], - [$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], - [$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']] - ]) - sh "echo -e maven-parent,${gjob.getResult()} >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" - echo "Done with maven-parent" - } - - } - } - } +// stage('build maven-parent') { +// steps { +// script { +// if (jobs['maven-parent'] == 'SUCCESS') { +// echo "Skipping maven-parent" +// // propagate success +// 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}"], +// [$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], +// [$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']] +// ]) +// sh "echo -e maven-parent,${gjob.getResult()} >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" +// echo "Done with maven-parent" +// } +// +// } +// } +// } stage('build components') { steps { script { From 1715ddce7b8d2f920423823505e6459883a798b6 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 21 Feb 2022 15:28:00 +0100 Subject: [PATCH 06/15] forcing build execution on agent CD-test ( for testing purpose) --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 78d3efa..b2504d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -301,7 +301,7 @@ def buildComponents(args, maven_settings_file, maven_activation_property, maven_ def gjob = build(job: name, wait: true, propagate: true, 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']] + [$class: 'LabelParameterValue', name: 'exec_label', label: "CD-test", nodeEligibility: [$class: 'AllNodeEligibility']] ]) sh "echo -e ${name},${gjob.getResult()} >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" } From 768b96909cd94b716f320e8086f8714ea9ad6a17 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 21 Feb 2022 15:35:00 +0100 Subject: [PATCH 07/15] maven-parent stage restored --- Jenkinsfile | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b2504d2..89ef6df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -199,26 +199,26 @@ pipeline { } // the maven-parent needs to be built (once) at each execution -// stage('build maven-parent') { -// steps { -// script { -// if (jobs['maven-parent'] == 'SUCCESS') { -// echo "Skipping maven-parent" -// // propagate success -// 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}"], -// [$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], -// [$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']] -// ]) -// sh "echo -e maven-parent,${gjob.getResult()} >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" -// echo "Done with maven-parent" -// } -// -// } -// } -// } + stage('build maven-parent') { + steps { + script { + if (jobs['maven-parent'] == 'SUCCESS') { + echo "Skipping maven-parent" + // propagate success + 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}"], + [$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], + [$class: 'LabelParameterValue', name: 'exec_label', label: "CD-test", nodeEligibility: [$class: 'AllNodeEligibility']] + ]) + sh "echo -e maven-parent,${gjob.getResult()} >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" + echo "Done with maven-parent" + } + + } + } + } stage('build components') { steps { script { From 81b583a2f11b8a3daa284473cb82cb793a2c9c40 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 22 Feb 2022 11:20:34 +0100 Subject: [PATCH 08/15] maven-parent job changed in maven-parent_branch. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 89ef6df..509dc85 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -207,7 +207,7 @@ pipeline { // propagate success 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, + def gjob = build(job: 'maven-parent_branch', wait: true, propagate: true, parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_parent_file}"], [$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], [$class: 'LabelParameterValue', name: 'exec_label', label: "CD-test", nodeEligibility: [$class: 'AllNodeEligibility']] From ccb2183ff836b8c219cda8bb2e71d54817817c39 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Tue, 1 Mar 2022 17:04:17 +0100 Subject: [PATCH 09/15] remove var maven_parent_file, set new settings files --- Jenkinsfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 89ef6df..b983053 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,25 +10,25 @@ 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_settings_file = "gcube-settings.xml" maven_activation_property="-Pdry-run"; - maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" + // maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } 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_settings_file = "gcube-settings.xml" maven_activation_property=''; - maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" + // maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } 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_settings_file = "jenkins-releases-settings.xml" maven_activation_property="-Pdry-run -Djenkins-releases -DRelease"; - maven_parent_file = "jenkins-releases-dry-run-settings.xml" + // maven_parent_file = "jenkins-releases-dry-run-settings.xml" } if (params.Type == 'STAGING') { echo "Configure Maven for STAGING artifacts" @@ -36,7 +36,7 @@ if (params.Type == 'STAGING') { maven_local_repo_path = "local-staging" maven_settings_file = "jenkins-staging-settings.xml" maven_activation_property="-Djenkins-staging -DRelease"; - maven_parent_file = "jenkins-staging-dry-run-settings.xml" + // maven_parent_file = "jenkins-staging-dry-run-settings.xml" } if (params.Type == 'RELEASE') { echo "Configure Maven for RELEASE artifacts" @@ -44,7 +44,7 @@ if (params.Type == 'RELEASE') { maven_local_repo_path = "local-releases" maven_settings_file = "jenkins-releases-settings.xml" maven_activation_property="-Djenkins-releases -DRelease"; - maven_parent_file = "jenkins-releases-dry-run-settings.xml" + // maven_parent_file = "jenkins-releases-dry-run-settings.xml" } echo "Use settings file at ${maven_settings_file} with the following activation property: ${maven_activation_property}" @@ -208,7 +208,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-test", nodeEligibility: [$class: 'AllNodeEligibility']] ]) From 459450afad21c551c6d2fa2884219e5f62d47c4b Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 4 Mar 2022 11:30:36 +0100 Subject: [PATCH 10/15] assign to maven_parent_file maven_settings_file value --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index b411aa2..a95eed5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,6 +46,7 @@ if (params.Type == 'RELEASE') { maven_activation_property="-Djenkins-releases -DRelease"; // maven_parent_file = "jenkins-releases-dry-run-settings.xml" } +maven_parent_file=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}" From e9714e41066fd93aca4bd768e2cd8a4ee99453c2 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 4 Mar 2022 12:27:44 +0100 Subject: [PATCH 11/15] set maven-parent job to the maven-parent_branch jenkinsjob --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a95eed5..733fe08 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -203,12 +203,12 @@ pipeline { stage('build maven-parent') { steps { script { - if (jobs['maven-parent'] == 'SUCCESS') { + if (jobs['maven-parent_branch'] == 'SUCCESS') { echo "Skipping maven-parent" // propagate success 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, + def gjob = build(job: 'maven-parent_branch', wait: true, propagate: true, 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-test", nodeEligibility: [$class: 'AllNodeEligibility']] From 2aea8a50487e4841bb230480d00b3b4b35237591 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Fri, 4 Mar 2022 14:46:13 +0100 Subject: [PATCH 12/15] remove maven_parent_file declaration. it is not needed anymore --- Jenkinsfile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 733fe08..85525a0 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_activation_property, 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 @@ -12,7 +12,6 @@ if (params.Type == 'SNAPSHOT-DRY-RUN') { maven_local_repo_path = "local-snapshots" maven_settings_file = "gcube-settings.xml" maven_activation_property="-Pdry-run"; - // maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } if (params.Type == 'SNAPSHOT') { echo "Configure Maven for SNAPSHOT artifacts" @@ -20,7 +19,6 @@ if (params.Type == 'SNAPSHOT') { maven_local_repo_path = "local-snapshots" maven_settings_file = "gcube-settings.xml" maven_activation_property=''; - // maven_parent_file = "jenkins-snapshots-dry-run-settings.xml" } if (params.Type == 'RELEASE-DRY-RUN') { echo "Configure Maven for RELEASE-DRY-RUN artifacts" @@ -28,7 +26,6 @@ if (params.Type == 'RELEASE-DRY-RUN') { maven_local_repo_path = "local-releases" maven_settings_file = "jenkins-releases-settings.xml" maven_activation_property="-Pdry-run -Djenkins-releases -DRelease"; - // maven_parent_file = "jenkins-releases-dry-run-settings.xml" } if (params.Type == 'STAGING') { echo "Configure Maven for STAGING artifacts" @@ -36,7 +33,6 @@ if (params.Type == 'STAGING') { maven_local_repo_path = "local-staging" maven_settings_file = "jenkins-staging-settings.xml" maven_activation_property="-Djenkins-staging -DRelease"; - // maven_parent_file = "jenkins-staging-dry-run-settings.xml" } if (params.Type == 'RELEASE') { echo "Configure Maven for RELEASE artifacts" @@ -44,9 +40,7 @@ if (params.Type == 'RELEASE') { maven_local_repo_path = "local-releases" maven_settings_file = "jenkins-releases-settings.xml" maven_activation_property="-Djenkins-releases -DRelease"; - // maven_parent_file = "jenkins-releases-dry-run-settings.xml" } -maven_parent_file=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}" @@ -99,7 +93,6 @@ pipeline { 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}" REMOVE_LOCAL_REPO = "${params.cleanup_local_repo}" From 841a5489ff2ca2645597cb4cf5a5558e2e873642 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 7 Mar 2022 12:18:04 +0100 Subject: [PATCH 13/15] change settings filename used by SNAPSHOT* build --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 85525a0..8291774 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,14 +10,14 @@ if (params.Type == 'SNAPSHOT-DRY-RUN') { echo "Configure Maven for SNAPSHOT-DRY-RUN artifacts" options = '' maven_local_repo_path = "local-snapshots" - maven_settings_file = "gcube-settings.xml" + maven_settings_file = "gcube-official.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 = "gcube-settings.xml" + maven_settings_file = "gcube-official.xml" maven_activation_property=''; } if (params.Type == 'RELEASE-DRY-RUN') { From 1ec74a8d79884ff7878b986f59e9f4d474e35f8a Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 7 Mar 2022 12:24:31 +0100 Subject: [PATCH 14/15] restore gcube-settings file ( gcube-official was my bad) --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8291774..85525a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,14 +10,14 @@ if (params.Type == 'SNAPSHOT-DRY-RUN') { echo "Configure Maven for SNAPSHOT-DRY-RUN artifacts" options = '' maven_local_repo_path = "local-snapshots" - maven_settings_file = "gcube-official.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 = "gcube-official.xml" + maven_settings_file = "gcube-settings.xml" maven_activation_property=''; } if (params.Type == 'RELEASE-DRY-RUN') { From 2d0ff0d2024a0c6900c3fa1ff74f61d077833aa0 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Mon, 7 Mar 2022 16:26:22 +0100 Subject: [PATCH 15/15] replace testing agent CD-test with CD --- Jenkinsfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 85525a0..46abb66 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,9 +80,7 @@ pipeline { // see https://jenkins.io/doc/book/pipeline/syntax/#agent agent { -// label 'CD' -// just for test I'm going to use the following label - label 'CD-test' + label 'CD' } // see https://jenkins.io/doc/book/pipeline/syntax/#environment @@ -196,15 +194,15 @@ pipeline { stage('build maven-parent') { steps { script { - if (jobs['maven-parent_branch'] == 'SUCCESS') { + if (jobs['maven-parent'] == 'SUCCESS') { echo "Skipping maven-parent" // propagate success sh "echo -e maven-parent,SUCCESS >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" } else { - def gjob = build(job: 'maven-parent_branch', wait: true, propagate: true, + def gjob = build(job: 'maven-parent', wait: true, propagate: true, 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-test", nodeEligibility: [$class: 'AllNodeEligibility']] + [$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']] ]) sh "echo -e maven-parent,${gjob.getResult()} >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" echo "Done with maven-parent" @@ -295,7 +293,7 @@ def buildComponents(args, maven_settings_file, maven_activation_property, maven_ def gjob = build(job: name, wait: true, propagate: true, 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-test", nodeEligibility: [$class: 'AllNodeEligibility']] + [$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']] ]) sh "echo -e ${name},${gjob.getResult()} >> ${agent_root_folder}/build_jobs.${env.BUILD_NUMBER}.csv" }