Skip to content

Commit

Permalink
Merge pull request #72 from paulissoft/development
Browse files Browse the repository at this point in the history
Update process.groovy
  • Loading branch information
gpaulissen authored Sep 30, 2022
2 parents 7986326 + 58f0356 commit af2c390
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions jenkins/libraries/maven/steps/process.groovy
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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')]) {
Expand Down

0 comments on commit af2c390

Please sign in to comment.