From 58f03566855ccf5a14771194a88327bdf1686f63 Mon Sep 17 00:00:00 2001 From: Gert-Jan Paulissen Date: Fri, 30 Sep 2022 09:30:00 +0200 Subject: [PATCH] Update process.groovy --- jenkins/libraries/maven/steps/process.groovy | 44 +++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/jenkins/libraries/maven/steps/process.groovy b/jenkins/libraries/maven/steps/process.groovy index d8e74476..89ac7632 100644 --- a/jenkins/libraries/maven/steps/process.groovy +++ b/jenkins/libraries/maven/steps/process.groovy @@ -1,23 +1,20 @@ // -*- mode: groovy; coding: utf-8 -*- void call(app_env){ script { - assert pipelineConfig.scm_url_oracle_tools != null - assert pipelineConfig.scm_branch_oracle_tools != null - assert pipelineConfig.scm_url != null - assert pipelineConfig.scm_credentials != null - assert pipelineConfig.scm_username != null - assert pipelineConfig.scm_email != null - assert pipelineConfig.conf_dir != null - assert pipelineConfig.db_dir != null - assert pipelineConfig.apex_dir != null + assert pipelineConfig.scm_url_oracle_tools != null : "The pipeline configuration must contain a global value for 'scm_url_oracle_tools'" + + assert pipelineConfig.scm_branch_oracle_tools != null : "The pipeline configuration must contain a global value for 'scm_branch_oracle_tools'" env.SCM_BRANCH = app_env.scm_branch - assert env.SCM_BRANCH != null + assert env.SCM_BRANCH != null : "The pipeline configuration must contain a value for 'scm_branch' in application environment ${app_env.long_name}" + env.SCM_BRANCH_PREV = ( app_env.scm_branch_prev != null ? app_env.scm_branch_prev : ( app_env.previous != null ? app_env.previous.scm_branch : '' ) ) + env.SCM_CREDENTIALS = ( app_env.scm_credentials != null ? app_env.scm_credentials : pipelineConfig.scm_credentials ) - assert env.SCM_CREDENTIALS != null + assert env.SCM_CREDENTIALS != null : "The pipeline configuration must contain a global value for 'scm_credentials' or a value in application environment ${app_env.long_name}" + env.SCM_URL = ( app_env.scm_url != null ? app_env.scm_url : pipelineConfig.scm_url ) - assert env.SCM_URL != null + assert env.SCM_URL != null : "The pipeline configuration must contain a global value for 'scm_url' or a value in application environment ${app_env.long_name}" // It must be possible to specify the SCM username and email as environment variables in Jenkins configuration. // https://github.com/paulissoft/oracle-tools/issues/70 @@ -26,27 +23,34 @@ void call(app_env){ } else if ( pipelineConfig.scm_username != null ) { env.SCM_USERNAME = pipelineConfig.scm_username } + assert env.SCM_USERNAME != null : "The pipeline configuration must contain a global value for 'scm_username' or a value in application environment ${app_env.long_name} or it must be defined as an environment variable SCM_USERNAME" if ( app_env.scm_email != null ) { env.SCM_EMAIL = app_env.scm_email } else if ( pipelineConfig.scm_email != null ) { env.SCM_EMAIL = pipelineConfig.scm_email } - + assert env.SCM_EMAIL != null : "The pipeline configuration must contain a global value for 'scm_email' or a value in application environment ${app_env.long_name} or it must be defined as an environment variable SCM_EMAIL" + env.CONF_DIR = ( app_env.conf_dir != null ? app_env.conf_dir : pipelineConfig.conf_dir ) - assert env.CONF_DIR != null + assert env.CONF_DIR != null : "The pipeline configuration must contain a global value for 'conf_dir' or a value in application environment ${app_env.long_name}" env.DB = app_env.db - assert env.DB != null + assert env.DB != null : "The pipeline configuration must contain a value for 'db' in application environment ${app_env.long_name}" + env.DB_CREDENTIALS = app_env.db_credentials - assert env.DB_CREDENTIALS != null + assert env.DB_CREDENTIALS != null : "The pipeline configuration must contain a value for 'db_credentials' in application environment ${app_env.long_name}" + env.DB_DIR = ( app_env.db_dir != null ? app_env.db_dir : pipelineConfig.db_dir ) - assert env.DB_DIR != null + assert env.DB_DIR != null : "The pipeline configuration must contain a global value for 'db_dir' or a value in application environment ${app_env.long_name}" + env.DB_ACTIONS = app_env.db_actions - assert env.DB_ACTIONS != null + assert env.DB_ACTIONS != null : "The pipeline configuration must contain a global value for 'db_actions' or a value in application environment ${app_env.long_name}" + env.APEX_DIR = ( app_env.apex_dir != null ? app_env.apex_dir : pipelineConfig.apex_dir ) - assert env.APEX_DIR != null + assert env.APEX_DIR != null : "The pipeline configuration must contain a global value for 'apex_dir' or a value in application environment ${app_env.long_name}" + env.APEX_ACTIONS = app_env.apex_actions - assert env.APEX_ACTIONS != null + assert env.APEX_ACTIONS != null : "The pipeline configuration must contain a value for 'apex_actions' in application environment ${app_env.long_name}" } withCredentials([usernamePassword(credentialsId: env.DB_CREDENTIALS, passwordVariable: 'DB_PASSWORD', usernameVariable: 'DB_USERNAME')]) {