Commit 2430f1fd by John Jarvis

Merge pull request #1516 from edx/jarv/add-testcourses-role

Jarv/add testcourses role
parents 944e697a deae411b
......@@ -24,8 +24,7 @@
- mongo
- { role: 'edxapp', celery_worker: True }
- edxapp
- role: demo
tags: demo
- testcourses
- { role: 'rabbitmq', rabbitmq_ip: '127.0.0.1' }
- oraclejdk
- elasticsearch
......
- name: Create courses for testing
hosts: all
sudo: True
gather_facts: True
roles:
- testcourses
- role: datadog
when: COMMON_ENABLE_DATADOG
- role: splunkforwarder
when: COMMON_ENABLE_SPLUNKFORWARDER
- role: newrelic
when: COMMON_ENABLE_NEWRELIC
......@@ -11,6 +11,8 @@
# Defaults for role demo
#
DEMO_CREATE_STAFF_USER: true
demo_app_dir: "{{ COMMON_APP_DIR }}/demo"
demo_code_dir: "{{ demo_app_dir }}/edx-demo-course"
demo_repo: "https://{{ COMMON_GIT_MIRROR }}/edx/edx-demo-course.git"
......
......@@ -27,7 +27,9 @@
{{ demo_edxapp_venv_bin }}/python ./manage.py lms --settings=aws --service-variant lms create_user -e staff@example.com -p edx -s -c {{ demo_course_id }}
chdir={{ demo_edxapp_code_dir }}
sudo_user: "{{ common_web_user }}"
when: demo_checkout.changed
when:
- demo_checkout.changed
- DEMO_CREATE_STAFF_USER
- name: add test users to the certificate whitelist
shell: >
......
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Defaults for role testcourses
#
TESTCOURSES_EXPORTS: []
---
- name: create temporary directories
file: >
path=/var/tmp/{{ item.path|basename }}
state=directory
with_items: TESTCOURSES_EXPORTS
sudo_user: "{{ common_web_user }}"
- name: Get the test courses
s3: >
bucket={{ item.bucket }} object={{ item.path }} dest=/var/tmp/{{ item.path|basename }}/{{ item.path|basename }} mode=get
with_items: TESTCOURSES_EXPORTS
sudo_user: "{{ common_web_user }}"
- name: Untar the test courses
command: >
tar zxf {{ item.path|basename }}
chdir=/var/tmp/{{ item.path|basename }}
with_items: TESTCOURSES_EXPORTS
sudo_user: "{{ common_web_user }}"
- name: import the test courses
shell: >
{{ demo_edxapp_venv_bin }}/python ./manage.py cms --settings=aws import {{ demo_edxapp_course_data_dir }} /var/tmp/{{ item.path|basename }}/{{ item.course_id.split('/')[2] }}
chdir={{ demo_edxapp_code_dir }}
sudo_user: "{{ common_web_user }}"
with_items: TESTCOURSES_EXPORTS
- shell: >
chdir={{ demo_edxapp_code_dir }}
echo "from student.models import CourseEnrollment; from django.contrib.auth.models import User; from opaque_keys.edx.locations import SlashSeparatedCourseKey; course = SlashSeparatedCourseKey.from_deprecated_string('{{ item[0].course_id }}'); user = User.objects.get(email='{{ item[1].email }}'); CourseEnrollment.enroll(user, course, mode='{{ item[1].mode }}');" | {{ demo_edxapp_venv_bin }}/python ./manage.py lms shell --settings=aws
sudo_user: "{{ common_web_user }}"
with_nested:
- TESTCOURSES_EXPORTS
- demo_test_users
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role testcourses
#
# Overview:
#
# Imports the testcourses course into studio
# https://github.com/edx/edx-testcourses-course
#
# Once imported this role will only re-import the course
# if the edx-testcourses-course repo has been updated
#
# Dependencies:
# - common
# - edxapp
#
# Example play:
#
# roles:
# - common
# - edxapp
# - testcourses
- include: deploy.yml tags=deploy
......@@ -17,6 +17,7 @@
# - dns_name
# - environment
# - name_tag
set -x
env
export PYTHONUNBUFFERED=1
export BOTO_CONFIG=/var/lib/jenkins/${aws_account}.boto
......@@ -85,7 +86,7 @@ fi
if [[ -z $ami ]]; then
if [[ $server_type == "full_edx_installation" ]]; then
ami="ami-c01dc6a8"
ami="ami-8214cfea"
elif [[ $server_type == "ubuntu_12.04" || $server_type == "full_edx_installation_from_scratch" ]]; then
ami="ami-8eb061e6"
elif [[ $server_type == "ubuntu_14.04(experimental)" ]]; then
......@@ -216,7 +217,7 @@ EOF
fi
declare -A deploy
roles="edxapp forum xqueue xserver ora discern certs demo"
roles="edxapp forum xqueue xserver ora discern certs demo testcourses"
for role in $roles; do
deploy[$role]=${!role}
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment