Skip to content

Commit

Permalink
Merge pull request #1758 from edx/katebygrace/fix-refresh-job
Browse files Browse the repository at this point in the history
chore: fix refresh job
  • Loading branch information
katebygrace authored May 17, 2024
2 parents 83d7195 + 8c2d2fe commit 94f9613
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion dataeng/jobs/analytics/SnowflakeRefreshSnowpipe.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class SnowflakeRefreshSnowpipe {
}
publishers common_publishers(allVars)
steps {
shell(dslFactory.readFileFromWorkspace('dataeng/resources/secrets-manager-setup.sh'))
shell(dslFactory.readFileFromWorkspace('dataeng/resources/snowflake-refresh-snowpipe.sh'))
}
}
Expand Down
2 changes: 1 addition & 1 deletion dataeng/resources/secrets-manager.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ else
exit 1
fi
fetch_specific_key "$1" "$2"
fi
fi
22 changes: 12 additions & 10 deletions dataeng/resources/snowflake-refresh-snowpipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ source "${PYTHON_VENV}/bin/activate"
cd $WORKSPACE/analytics-tools/snowflake
make requirements

# Source the secrets-manager.sh script to make the function available
source $WORKSPACE/secrets-manager.sh
# Fetch the secrets from AWS
set +x


secrets-manager.sh -w analytics-secure/job-configs/SNOWFLAKE_REFRESH_SNOWPIPE_JOB_EXTRA_VARS snowflake/rsa_key_snowpipe_user.p8
secrets-manager.sh -w analytics-secure/job-configs/SNOWFLAKE_REFRESH_SNOWPIPE_JOB_EXTRA_VARS snowflake/rsa_key_passphrase_snowpipe_user
python3 secrets-manager.py -w -n analytics-secure/snowflake/rsa_key_snowpipe_user.p8 -v rsa_key_snowpipe_user
python3 secrets-manager.py -w -n analytics-secure/snowflake/rsa_key_passphrase_snowpipe_user -v rsa_key_passphrase_snowpipe_user
#set -x

set -x
unset KEY_PATH
unset PASSPHRASE_PATH

python refresh_snowpipe.py \
--user 'SNOWPIPE' \
Expand All @@ -28,6 +26,10 @@ python refresh_snowpipe.py \
--pipe_name $PIPE_NAME \
--table_name $TABLE_NAME \
--delay $DELAY \
--limit $LIMIT
--key_file $KEY_PATH \
--passphrase_file $PASSPHRASE_PATH
--limit $LIMIT \
--key_file "$(cat "rsa_key_snowpipe_user")" \
--passphrase_file "$(cat "rsa_key_passphrase_snowpipe_user")"

rm rsa_key_snowpipe_user
rm rsa_key_passphrase_snowpipe_user

0 comments on commit 94f9613

Please sign in to comment.