Skip to content

Commit

Permalink
fix: update user retirement scripts owned by SRE
Browse files Browse the repository at this point in the history
  • Loading branch information
ohnickmoy committed Feb 29, 2024
1 parent 4c38541 commit 99a13c6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions devops/jobs/MongoPruner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Variables consumed for this job:
* NOTIFY_ON_FAILURE: [email protected]
* FOLER_NAME: folder
* TUBULAR_REPO: repo where the mongo pruner script is located (required)
* TUBULAR_BRANCH: default is master
* EDX_PLATFORM_REPO: repo where the mongo pruner script is located (required)
* EDX_PLATFORM_BRANCH: default is master
* DEPLOYMENTS: (required)
environments:
environment (required)
Expand Down Expand Up @@ -43,25 +43,25 @@ class MongoPruner {
}
}

assert extraVars.containsKey('TUBULAR_REPO') : "Please define a tubular repo where the mongo pruner script is located"
assert extraVars.containsKey('EDX_PLATFORM_REPO') : "Please define a edx-platform repo where the mongo pruner script is located"

parameters{
stringParam('TUBULAR_REPO', extraVars.get('TUBULAR_REPO'),
stringParam('EDX_PLATFORM_REPO', extraVars.get('EDX_PLATFORM_REPO'),
'Git repo which contains the mongo pruner script.')
stringParam('TUBULAR_BRANCH', extraVars.get('TUBULAR_BRANCH', 'master'),
stringParam('EDX_PLATFORM_BRANCH', extraVars.get('EDX_PLATFORM_BRANCH', 'master'),
'e.g. tagname or origin/branchname')
}

multiscm{
git {
remote {
url('$TUBULAR_REPO')
branch('$TUBULAR_BRANCH')
url('$EDX_PLATFORM_REPO')
branch('$EDX_PLATFORM_BRANCH')
}
extensions {
cleanAfterCheckout()
pruneBranches()
relativeTargetDirectory('tubular')
relativeTargetDirectory('edx-platform')
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions devops/jobs/ReplaceUsernames.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ReplaceUsernames {
extraVars.get('ENVIRONMENTS').each { environment ->
dslFactory.job("Enterprise/" + "${environment}-replace-usernames") {
parameters {
stringParam('TUBULAR_BRANCH', 'master', 'Repo branch for the tubular scripts.')
stringParam('EDX_PLATFORM_BRANCH', 'master', 'Repo branch for the edx-platform scripts.')
fileParam(
'username_replacements.csv',
'A CSV of [current_username,desired_username] for username replacement'
Expand All @@ -41,11 +41,11 @@ class ReplaceUsernames {
multiscm {
git {
remote {
url('https://github.com/edx/tubular.git')
url('https://github.com/openedx/edx-platform.git')
}
branch('$TUBULAR_BRANCH')
branch('$EDX_PLATFORM_BRANCH')
extensions {
relativeTargetDirectory('tubular')
relativeTargetDirectory('edx-platform')
cloneOptions {
shallow()
timeout(10)
Expand All @@ -69,7 +69,7 @@ class ReplaceUsernames {
publishers {
/* Save CSV from python script as artifact to be downloaded/viewed */
archiveArtifacts {
pattern('tubular/username_replacement_results.csv')
pattern('edx-platfor/username_replacement_results.csv')
allowEmpty()
defaultExcludes()
}
Expand Down
6 changes: 3 additions & 3 deletions devops/resources/mongo-pruner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ create_virtualenv --python=python3.8 --clear
. "$venvpath/bin/activate"
set -u

cd $WORKSPACE/tubular
pip install -r requirements.txt
cd $WORKSPACE/edx-platform
pip install -r scripts/user_retirement/requirements/base.txt
pip install awscli

set +x
Expand All @@ -36,7 +36,7 @@ IP_ADDRESSES=`aws ec2 describe-instances\

MONGO_IPS=`echo $IP_ADDRESSES | sed 's/ /,/g'`

python scripts/structures.py\
python scripts/user_retirement/structures.py\
--database-name ${DATABASE_NAME}\
--connection "mongodb://${MONGO_USER}:${MONGO_PASSWORD}@${MONGO_IPS}/${DATABASE_NAME}" make_plan --retain 10 plan.json

Expand Down
6 changes: 3 additions & 3 deletions devops/resources/replace-usernames.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export PYTHONIOENCODING=UTF-8
export LC_CTYPE=en_US.UTF-8

# prepare tubular
cd $WORKSPACE/tubular
pip install -r requirements.txt
cd $WORKSPACE/edx-platform
pip install -r scripts/user_retirement/requirements/base.txt

# Call the script to replace the usernames for all users in the CSV file.
python scripts/replace_usernames.py \
python scripts/user_retirement/replace_usernames.py \
--config_file=$USERNAME_REPLACEMENT_CONFIG_FILE \
--username_replacement_csv=$WORKSPACE/username_replacements.csv
2 changes: 1 addition & 1 deletion devops/resources/user-retirement-archiver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set -x

assume-role ${ROLE_ARN}

# prepare tubular
# prepare edx-platform
cd $WORKSPACE/edx-platform
pip install -r scripts/user_retirement/requirements/base.txt

Expand Down

0 comments on commit 99a13c6

Please sign in to comment.