<commit_before>#!/bin/bash -xe

set +u
. /edx/var/jenkins/jobvenvs/virtualenv_tools.sh
# creates a venv with its location stored in variable "venvpath"
create_virtualenv --python=python3.8 --clear
. "$venvpath/bin/activate"
set -u

cd configuration
pip install -r pre-requirements.txt
pip install -r requirements.txt

env
. util/jenkins/assume-role.sh

assume-role ${ROLE_ARN}
cd $WORKSPACE/configuration/playbooks

if [[ "$JOB_TYPE" =~ ^groups-(.+)$ ]]; then
	service="${BASH_REMATCH[1]}"
	configfile=${WORKSPACE}/app-permissions/groups/${service}.yml
elif [[ "$JOB_TYPE" = 'active-users' ]] || [[ "$JOB_TYPE" = 'inactive-users' ]]; then
	configfile=${WORKSPACE}/app-permissions/users/${ENVIRONMENT}-${DEPLOYMENT}.yml
else
	echo "Bad job type: ${JOB_TYPE}."
	echo "Expected active-users, inactive-users, or groups-<service>."
	exit 1
fi

INVENTORY=$(./active_instances_in_asg.py --asg ${ENVIRONMENT}-${DEPLOYMENT}-worker)
if [[ -n ${INVENTORY} ]]; then
    ansible-playbook -i ${INVENTORY} manage_edxapp_users_and_groups.yml \
                     -e@${configfile} -e 'group_environment=${ENVIRONMENT}-${DEPLOYMENT}' \
                     --user ${USER} --tags manage-${JOB_TYPE}
else
    echo "Skipping ${ENVIRONMENT} ${DEPLOYMENT}, no worker cluster available, get it next time"
fi<commit_msg>fix: env interpolation in run-app-permissions.sh (#1386)<commit_after>#!/bin/bash -xe

set +u
. /edx/var/jenkins/jobvenvs/virtualenv_tools.sh
# creates a venv with its location stored in variable "venvpath"
create_virtualenv --python=python3.8 --clear
. "$venvpath/bin/activate"
set -u

cd configuration
pip install -r pre-requirements.txt
pip install -r requirements.txt

env
. util/jenkins/assume-role.sh

assume-role ${ROLE_ARN}
cd $WORKSPACE/configuration/playbooks

if [[ "$JOB_TYPE" =~ ^groups-(.+)$ ]]; then
	service="${BASH_REMATCH[1]}"
	configfile=${WORKSPACE}/app-permissions/groups/${service}.yml
elif [[ "$JOB_TYPE" = 'active-users' ]] || [[ "$JOB_TYPE" = 'inactive-users' ]]; then
	configfile=${WORKSPACE}/app-permissions/users/${ENVIRONMENT}-${DEPLOYMENT}.yml
else
	echo "Bad job type: ${JOB_TYPE}."
	echo "Expected active-users, inactive-users, or groups-<service>."
	exit 1
fi

INVENTORY=$(./active_instances_in_asg.py --asg ${ENVIRONMENT}-${DEPLOYMENT}-worker)
if [[ -n ${INVENTORY} ]]; then
    ansible-playbook -i ${INVENTORY} manage_edxapp_users_and_groups.yml \
                     -e@${configfile} -e "group_environment=${ENVIRONMENT}-${DEPLOYMENT}" \
                     --user ${USER} --tags manage-${JOB_TYPE}
else
    echo "Skipping ${ENVIRONMENT} ${DEPLOYMENT}, no worker cluster available, get it next time"
fi
{'fraction_non_alphanumeric': 0.16571861964353432, 'fraction_numerical': 0.004550625711035267, 'mean_word_length': 4.203155818540434, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2219552', 'n_tokens_mistral': 977, 'n_tokens_neox': 941, 'n_words': 198}