From b0ad38d6d5aa94be5152f27ddabb531987ca57bb Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Thu, 12 Oct 2023 19:05:35 +0500 Subject: [PATCH] test: test jenkins job changes --- dataeng/jobs/analytics/ModelTransfers.groovy | 1 - .../ModelTransfersJenkinsTest.groovy | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 dataeng/jobs/analytics/ModelTransfersJenkinsTest.groovy diff --git a/dataeng/jobs/analytics/ModelTransfers.groovy b/dataeng/jobs/analytics/ModelTransfers.groovy index bef9063d7..69f199c99 100644 --- a/dataeng/jobs/analytics/ModelTransfers.groovy +++ b/dataeng/jobs/analytics/ModelTransfers.groovy @@ -45,7 +45,6 @@ class ModelTransfers{ publishers common_publishers(allVars) steps { shell(dslFactory.readFileFromWorkspace('dataeng/resources/model-transfers.sh')) - shell(dslFactory.readFileFromWorkspace('dataeng/resources/trigger-prefect-flow.sh')) } } } diff --git a/dataeng/jobs/analytics/ModelTransfersJenkinsTest.groovy b/dataeng/jobs/analytics/ModelTransfersJenkinsTest.groovy new file mode 100644 index 000000000..bef9063d7 --- /dev/null +++ b/dataeng/jobs/analytics/ModelTransfersJenkinsTest.groovy @@ -0,0 +1,54 @@ +package analytics +import static org.edx.jenkins.dsl.AnalyticsConstants.secure_scm +import static org.edx.jenkins.dsl.AnalyticsConstants.common_log_rotator +import static org.edx.jenkins.dsl.AnalyticsConstants.common_wrappers +import static org.edx.jenkins.dsl.AnalyticsConstants.common_publishers +import static org.edx.jenkins.dsl.AnalyticsConstants.common_triggers +import static org.edx.jenkins.dsl.AnalyticsConstants.secure_scm_parameters +import static org.edx.jenkins.dsl.AnalyticsConstants.common_authorization + +class ModelTransfers{ + public static def job = { dslFactory, allVars -> + allVars.get('ENVIRONMENTS').each { environment, env_config -> + dslFactory.job("transfer-dbt-models-$environment"){ + authorization common_authorization(env_config) + logRotator common_log_rotator(allVars) + parameters secure_scm_parameters(allVars) + parameters { + stringParam('WAREHOUSE_TRANSFORMS_URL', allVars.get('WAREHOUSE_TRANSFORMS_URL'), 'URL for the Warehouse Transforms Repo.') + stringParam('WAREHOUSE_TRANSFORMS_BRANCH', allVars.get('WAREHOUSE_TRANSFORMS_BRANCH'), 'Branch of Warehouse Transforms to use.') + stringParam('DBT_PROJECT', env_config.get('DBT_PROJECT', allVars.get('DBT_PROJECT')), 'dbt project in warehouse-transforms to work on.') + stringParam('DBT_PROFILE', env_config.get('DBT_PROFILE', allVars.get('DBT_PROFILE')), 'dbt profile from analytics-secure to work on.') + stringParam('DBT_TARGET', env_config.get('DBT_TARGET', allVars.get('DBT_TARGET')), 'dbt target from analytics-secure to work on.') + stringParam('MODELS_TO_TRANSFER', env_config.get('MODELS_TO_TRANSFER'), 'Name of DBT models which should be transferred to S3 via a Snowflake stage.') + stringParam('NOTIFY', env_config.get('NOTIFY', allVars.get('NOTIFY','$PAGER_NOTIFY')), 'Space separated list of emails to send notifications to.') + } + multiscm secure_scm(allVars) << { + git { + remote { + url('$WAREHOUSE_TRANSFORMS_URL') + branch('$WAREHOUSE_TRANSFORMS_BRANCH') + credentials('1') + } + extensions { + relativeTargetDirectory('warehouse-transforms') + pruneBranches() + cleanAfterCheckout() + } + } + } + triggers common_triggers(allVars, env_config) + wrappers common_wrappers(allVars) + wrappers { + colorizeOutput('xterm') + } + publishers common_publishers(allVars) + steps { + shell(dslFactory.readFileFromWorkspace('dataeng/resources/model-transfers.sh')) + shell(dslFactory.readFileFromWorkspace('dataeng/resources/trigger-prefect-flow.sh')) + } + } + } + } +} +