Skip to content

Commit

Permalink
chore: stitch lag monitor secretsmanager
Browse files Browse the repository at this point in the history
JIRA:CLOUDSEC-12
  • Loading branch information
katebygrace committed May 22, 2024
1 parent 9489814 commit f155a36
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
5 changes: 1 addition & 4 deletions dataeng/jobs/analytics/StitchSnowflakeLagMonitor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ 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.secure_scm



class StitchSnowflakeLagMonitor {
public static def job = { dslFactory, allVars ->
dslFactory.job("stitch-snowflake-lag-monitor") {
logRotator common_log_rotator(allVars)
parameters secure_scm_parameters(allVars)
parameters {
stringParam('ANALYTICS_TOOLS_URL', allVars.get('ANALYTICS_TOOLS_URL'), 'URL for the analytics tools repo.')
stringParam('ANALYTICS_TOOLS_BRANCH', allVars.get('ANALYTICS_TOOLS_BRANCH'), 'Branch of analtyics tools repo to use.')
Expand All @@ -29,7 +26,7 @@ class StitchSnowflakeLagMonitor {
env('ACCOUNT', allVars.get('ACCOUNT'))
}
logRotator common_log_rotator(allVars)
multiscm secure_scm(allVars) << {
multiscm {
git {
remote {
url('$ANALYTICS_TOOLS_URL')
Expand Down
25 changes: 17 additions & 8 deletions dataeng/resources/stitch-snowflake-lag-monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ source "${PYTHON_VENV}/bin/activate"
cd $WORKSPACE/analytics-tools/snowflake
make requirements

source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS KEY_PATH
source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS PASSPHRASE_PATH
source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS USER
source secrets-manager.sh analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS ACCOUNT
#analytics-secure/job-configs/STITCH_SNOWFLAKE_LAG_MONITOR_JOB_EXTRA_VARS
# "KEY_PATH": "snowflake/rsa_key_stitch_loader.p8",
# "PASSPHRASE_PATH": "snowflake/rsa_key_passphrase_stitch_loader",
# "USER": "STITCH_LOADER",
# "ACCOUNT": "edx.us-east-1",
# "JOB_FREQUENCY": "*/15 * * * *"

python3 secrets-manager.py -w -n analytics-secure/snowflake/rsa_key_stitch_loader.p8 -v rsa_key_stitch_loader
python3 secrets-manager.py -w -n analytics-secure/snowflake/rsa_key_passphrase_stitch_loader -v rsa_key_passphrase_stitch_loader


python stitch-snowflake-monitoring.py \
--key_path $WORKSPACE/analytics-secure/$KEY_PATH \
--passphrase_path $WORKSPACE/analytics-secure/$PASSPHRASE_PATH \
--user $USER \
--account $ACCOUNT
--user "STITCH_LOADER" \
--account "edx.us-east-1" \
--key_file "$(cat "rsa_key_stitch_loader")" \
--passphrase_file "$(cat "rsa_key_passphrase_stitch_loader")""
rm rsa_key_stitch_loader
rm rsa_key_passphrase_stitch_loader

0 comments on commit f155a36

Please sign in to comment.