Set a dry-run profile for the first stage (maven-parent).

This commit is contained in:
Manuele Simi 2019-11-22 21:53:24 -05:00
parent 13a3d407d9
commit a5030995f6
1 changed files with 8 additions and 4 deletions

12
Jenkinsfile vendored
View File

@ -2,8 +2,7 @@
import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.Yaml
// set the build options according to the Type of build // set the build options according to the Type of build
def (options, maven_local_repo_path, maven_settings_file) = ['', '', ''] def (options, maven_local_repo_path, maven_settings_file, maven_parent_file) = ['', '', '', '']
def maven_jdk = 'OpenJDK 8'
def agent_root_folder = '/var/lib/jenkins/.m2' def agent_root_folder = '/var/lib/jenkins/.m2'
if (params.Type == 'SNAPSHOT-DRY-RUN') { if (params.Type == 'SNAPSHOT-DRY-RUN') {
@ -11,30 +10,35 @@ if (params.Type == 'SNAPSHOT-DRY-RUN') {
options = '' options = ''
maven_local_repo_path = "local-snapshots" maven_local_repo_path = "local-snapshots"
maven_settings_file = "jenkins-snapshots-dry-run-settings.xml" maven_settings_file = "jenkins-snapshots-dry-run-settings.xml"
maven_parent_file = "jenkins-snapshots-dry-run-settings.xml"
} }
if (params.Type == 'SNAPSHOT') { if (params.Type == 'SNAPSHOT') {
echo "Configure Maven for SNAPSHOT artifacts" echo "Configure Maven for SNAPSHOT artifacts"
options = '' options = ''
maven_local_repo_path = "local-snapshots" maven_local_repo_path = "local-snapshots"
maven_settings_file = "jenkins-snapshots-settings.xml" maven_settings_file = "jenkins-snapshots-settings.xml"
maven_parent_file = "jenkins-snapshots-dry-run-settings.xml"
} }
if (params.Type == 'RELEASE-DRY-RUN') { if (params.Type == 'RELEASE-DRY-RUN') {
echo "Configure Maven for RELEASE-DRY-RUN artifacts" echo "Configure Maven for RELEASE-DRY-RUN artifacts"
options = '' options = ''
maven_local_repo_path = "local-releases" maven_local_repo_path = "local-releases"
maven_settings_file = "jenkins-releases-dry-run-settings.xml" maven_settings_file = "jenkins-releases-dry-run-settings.xml"
maven_parent_file = "jenkins-releases-dry-run-settings.xml"
} }
if (params.Type == 'STAGING') { if (params.Type == 'STAGING') {
echo "Configure Maven for STAGING artifacts" echo "Configure Maven for STAGING artifacts"
options = '' options = ''
maven_local_repo_path = "local-staging" maven_local_repo_path = "local-staging"
maven_settings_file = "jenkins-staging-settings.xml" maven_settings_file = "jenkins-staging-settings.xml"
maven_parent_file = "jenkins-staging-dry-run-settings.xml"
} }
if (params.Type == 'RELEASE') { if (params.Type == 'RELEASE') {
echo "Configure Maven for RELEASE artifacts" echo "Configure Maven for RELEASE artifacts"
options = '' options = ''
maven_local_repo_path = "local-releases" maven_local_repo_path = "local-releases"
maven_settings_file = "jenkins-releases-settings.xml" maven_settings_file = "jenkins-releases-settings.xml"
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}"
@ -69,12 +73,12 @@ pipeline {
// see https://jenkins.io/doc/book/pipeline/syntax/#environment // see https://jenkins.io/doc/book/pipeline/syntax/#environment
environment { environment {
JOB_OPTIONS = "${options}"
//make the JVM start a bit faster with basic just-in-time compilation of the code only (-XX:*) //make the JVM start a bit faster with basic just-in-time compilation of the code only (-XX:*)
//make maven running in a multi-thread fashion (16 threads, 2 threads on each Core) //make maven running in a multi-thread fashion (16 threads, 2 threads on each Core)
MAVEN_OPTS="-Dmaven.artifact.threads=16 -T 2C -XX:+TieredCompilation -XX:TieredStopAtLevel=1 " MAVEN_OPTS="-Dmaven.artifact.threads=16 -T 2C -XX:+TieredCompilation -XX:TieredStopAtLevel=1 "
AGENT_ROOT_FOLDER = "${agent_root_folder}" AGENT_ROOT_FOLDER = "${agent_root_folder}"
MAVEN_SETTINGS_FILE = "${maven_settings_file}" MAVEN_SETTINGS_FILE = "${maven_settings_file}"
MAVEN_PARENT_FILE = "${maven_parent_file}"
MAVEN_LOCAL_REPO = "${agent_root_folder}/${maven_local_repo_path}" MAVEN_LOCAL_REPO = "${agent_root_folder}/${maven_local_repo_path}"
CLEANUP_GCUBE_REPO = "${params.cleanup_gcube_artifacts}" CLEANUP_GCUBE_REPO = "${params.cleanup_gcube_artifacts}"
REMOVE_LOCAL_REPO = "${params.cleanup_local_repo}" REMOVE_LOCAL_REPO = "${params.cleanup_local_repo}"
@ -133,7 +137,7 @@ pipeline {
stage('build maven-parent') { stage('build maven-parent') {
steps { steps {
echo build(job: 'maven-parent', wait: true, echo build(job: 'maven-parent', wait: true,
parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_settings_file}"], parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_parent_file}"],
[$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"], [$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", nodeEligibility: [$class: 'AllNodeEligibility']]
]).result ]).result