Commit dadf64d7 by Ben Patterson

Merge pull request #1414 from edx/benp/packerify-jenkins-worker

Ability to create Jenkins worker AMIs via packer.
parents 5a6e8563 cb09e639
...@@ -29,3 +29,6 @@ jenkins_ruby_version: "1.9.3-p374" ...@@ -29,3 +29,6 @@ jenkins_ruby_version: "1.9.3-p374"
# JSCover direct download URL # JSCover direct download URL
jscover_url: "http://files.edx.org/testeng/JSCover-1.0.2.zip" jscover_url: "http://files.edx.org/testeng/JSCover-1.0.2.zip"
jscover_version: "1.0.2" jscover_version: "1.0.2"
# packer direct download URL
packer_url: "https://dl.bintray.com/mitchellh/packer/0.6.1_linux_amd64.zip"
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# `jenkins_home`: /var/lib/jenkins # `jenkins_home`: /var/lib/jenkins
# `jenkins_user_home`: /home/jenkins # `jenkins_user_home`: /home/jenkins
- include: packer.yml
- include: system.yml - include: system.yml
- include: python.yml - include: python.yml
- include: ruby.yml - include: ruby.yml
......
---
- name: Download packer
get_url: url={{ packer_url }} dest=/var/tmp/packer.zip
- name: Unzip packer
unarchive: src=/var/tmp/packer.zip dest=/usr/local/bin copy=no
...@@ -20,14 +20,14 @@ cd edx-platform-clone ...@@ -20,14 +20,14 @@ cd edx-platform-clone
# tests because TEST_SUITE isn't defined. # tests because TEST_SUITE isn't defined.
source scripts/all-tests.sh source scripts/all-tests.sh
# Now we can run a subset of the tests via paver. # Now we can run a subset of the tests via paver.
# Run some of the common/lib unit tests # Run some of the common/lib unit tests
paver test_lib -t common/lib/xmodule/xmodule/tests/test_stringify.py paver test_lib -t common/lib/xmodule/xmodule/tests/test_stringify.py
# Generate some coverage reports # Generate some coverage reports
paver coverage paver coverage
# Run some of the djangoapp unit tests # Run some of the djangoapp unit tests
paver test_system -t lms/djangoapps/courseware/tests/tests.py paver test_system -t lms/djangoapps/courseware/tests/tests.py
paver test_system -t cms/djangoapps/course_creators/tests/test_views.py paver test_system -t cms/djangoapps/course_creators/tests/test_views.py
...@@ -38,8 +38,8 @@ paver test_js_run -s xmodule ...@@ -38,8 +38,8 @@ paver test_js_run -s xmodule
paver test_bokchoy -t test_lms.py:RegistrationTest paver test_bokchoy -t test_lms.py:RegistrationTest
# Run some of the lettuce acceptance tests # Run some of the lettuce acceptance tests
paver test_acceptance -s lms --extra_args="lms/djangoapps/courseware/features/problems.feature" # paver test_acceptance -s lms --extra_args="lms/djangoapps/courseware/features/problems.feature"
paver test_acceptance -s cms --extra_args="cms/djangoapps/contentstore/features/html-editor.feature" # paver test_acceptance -s cms --extra_args="cms/djangoapps/contentstore/features/html-editor.feature"
# Generate quality reports # Generate quality reports
paver run_quality paver run_quality
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"github_oauth_token": "{{env `GITHUB_TOKEN`}}",
"playbook_remote_dir": "/tmp/packer-edx-playbooks",
"ami": "{{env `JENKINS_WORKER_AMI`}}"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami": "{{user `ami`}}",
"instance_type": "m3.large",
"ssh_username": "ubuntu",
"ami_name": "jenkins_worker-{{isotime | clean_ami_name}}"
}],
"provisioners": [{
"type": "shell",
"inline": ["rm -rf {{user `playbook_remote_dir`}}"]
}, {
"type": "file",
"source": "../../../configuration/playbooks",
"destination": "{{user `playbook_remote_dir`}}"
}, {
"type": "file",
"source": "../../../configuration/requirements.txt",
"destination": "{{user `playbook_remote_dir`}}/requirements.txt"
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
"virtualenv packer-venv",
". packer-venv/bin/activate",
"pip install -q -r requirements.txt",
"echo '[jenkins_worker]' > inventory.ini",
"echo 'localhost' >> inventory.ini",
"ansible-playbook edx-east/jenkins_worker.yml -i inventory.ini -c local -e 'github_oauth_token={{user `github_oauth_token` }}' -vvvv"]
}, {
"type": "shell",
"inline": ["cd {{user `playbook_remote_dir`}}",
". packer-venv/bin/activate",
"ansible-playbook run_role.yml -i inventory.ini -c local -e role=test_build_server -vvvv"]
}]
}
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