From dd73a028863dfca2701e1882cd77514f6f72f418 Mon Sep 17 00:00:00 2001 From: katebygrace Date: Mon, 20 May 2024 13:57:41 -0400 Subject: [PATCH] chore: analytics exporter JIRA:CLOUDSEC-12 --- dataeng/jobs/analytics/AnalyticsExporter.groovy | 12 ++++-------- dataeng/resources/setup-exporter.sh | 8 ++++++-- .../org/edx/jenkins/dsl/AnalyticsConstants.groovy | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/dataeng/jobs/analytics/AnalyticsExporter.groovy b/dataeng/jobs/analytics/AnalyticsExporter.groovy index ba7138271..561462a6c 100644 --- a/dataeng/jobs/analytics/AnalyticsExporter.groovy +++ b/dataeng/jobs/analytics/AnalyticsExporter.groovy @@ -1,7 +1,6 @@ package analytics import static org.edx.jenkins.dsl.AnalyticsConstants.common_publishers -import static org.edx.jenkins.dsl.AnalyticsConstants.secure_scm -import static org.edx.jenkins.dsl.AnalyticsConstants.secure_scm_parameters +import static org.edx.jenkins.dsl.AnalyticsConstants.config_scm import static org.edx.jenkins.dsl.AnalyticsConstants.opsgenie_heartbeat_publisher class AnalyticsExporter { @@ -19,7 +18,6 @@ class AnalyticsExporter { stringParam('TASKS', '', 'Space separated list of tasks to process. Leave this blank to use the task list specified in the config file. Specify here only if you are running tests of a specific task.') stringParam('PYTHON_VENV_VERSION', 'python3.7', 'Python virtual environment version to used.') } - parameters secure_scm_parameters(allVars) environmentVariables { env('REMOTE_CONFIG_PROD_EDX_ROLE_ARN', allVars.get('REMOTE_CONFIG_PROD_EDX_ROLE_ARN')) @@ -32,7 +30,7 @@ class AnalyticsExporter { env('REMOTE_CONFIG_DECRYPTION_KEYS_VAULT_KV_VERSION', allVars.get('REMOTE_CONFIG_DECRYPTION_KEYS_VAULT_KV_VERSION')) } - multiscm secure_scm(allVars) << { + multiscm config_scm(allVars) << { git { remote { url('git@github.com:openedx/edx-platform.git') @@ -89,7 +87,6 @@ class AnalyticsExporter { stringParam('EXTRA_OPTIONS') stringParam('PYTHON_VENV_VERSION', 'python3.7', 'Python version to use for creating virtualenv.') } - parameters secure_scm_parameters(allVars) environmentVariables { env('REMOTE_CONFIG_PROD_EDX_ROLE_ARN', allVars.get('REMOTE_CONFIG_PROD_EDX_ROLE_ARN')) @@ -113,7 +110,7 @@ class AnalyticsExporter { concurrentBuild() - multiscm secure_scm(allVars) + multiscm config_scm(allVars) wrappers { timestamps() @@ -154,14 +151,13 @@ class AnalyticsExporter { stringParam('DATA_CZAR_KEYS_BRANCH', 'master', 'Branch to use for the data-czar-keys repository.') stringParam('PRIORITY_ORGS', allVars.get('PRIORITY_ORGS'), 'Space separated list of organizations to process first.') } - parameters secure_scm_parameters(allVars) environmentVariables { env('OPSGENIE_HEARTBEAT_NAME', allVars.get('OPSGENIE_HEARTBEAT_NAME')) env('OPSGENIE_HEARTBEAT_DURATION_NUM', allVars.get('OPSGENIE_HEARTBEAT_DURATION_NUM')) env('OPSGENIE_HEARTBEAT_DURATION_UNIT', allVars.get('OPSGENIE_HEARTBEAT_DURATION_UNIT')) } - multiscm secure_scm(allVars) << { + multiscm config_scm(allVars) << { git { remote { url('git@github.com:openedx/edx-platform.git') diff --git a/dataeng/resources/setup-exporter.sh b/dataeng/resources/setup-exporter.sh index b5813e5e7..26f973b80 100644 --- a/dataeng/resources/setup-exporter.sh +++ b/dataeng/resources/setup-exporter.sh @@ -16,8 +16,12 @@ pip install -r github_requirements.txt pip install mysql-connector-python -e . popd -# Configuration paths in analytics-secure -SECURE_ROOT=${WORKSPACE}/analytics-secure/analytics-exporter +cd analytics-config/analytics-exporter +python3 secrets-manager.py -w -n analytics-secure/analytics-exporter/task-auth.json -v task-auth.json +cd ../../ + +# Configuration paths in analytics-config +SECURE_ROOT=${WORKSPACE}/analytics-config/analytics-exporter CONFIG_PATH=${SECURE_ROOT}/${EXPORTER_CONFIG_FILENAME} GPG_KEYS_PATH=${WORKSPACE}/data-czar-keys diff --git a/src/main/groovy/org/edx/jenkins/dsl/AnalyticsConstants.groovy b/src/main/groovy/org/edx/jenkins/dsl/AnalyticsConstants.groovy index d3042d9b2..e6576c48f 100644 --- a/src/main/groovy/org/edx/jenkins/dsl/AnalyticsConstants.groovy +++ b/src/main/groovy/org/edx/jenkins/dsl/AnalyticsConstants.groovy @@ -60,6 +60,21 @@ class AnalyticsConstants { } } + public static def config_scm = { allVars -> + return { + git { + remote { + url('git@github.com:edx/analytics-config.git') + branch('master') + credentials('1') + } + extensions { + pruneBranches() + relativeTargetDirectory('analytics-config') + } + } + } + } public static def data_czar_keys_scm = { allVars -> return { git {