Commit 86c7757d by Will Daly

Added version of JSCover

Added more Jenkins plugins (CopyArtifact and dependencies)
Standardized task names to include role
Small style fix for github_pr_auth.py
parent e640217a
...@@ -9,7 +9,8 @@ jenkins_plugins: ...@@ -9,7 +9,8 @@ jenkins_plugins:
- { name: "build-pipeline-plugin", version: "1.4" } - { name: "build-pipeline-plugin", version: "1.4" }
- { name: "build-timeout", version: "1.11" } - { name: "build-timeout", version: "1.11" }
- { name: "cobertura", version: "1.9.2" } - { name: "cobertura", version: "1.9.2" }
- { name: "credentials", version: "1.4" } - { name: "copyartifact", version: "1.28" }
- { name: "credentials", version: "1.8.3" }
- { name: "dashboard-view", version: "2.9.1" } - { name: "dashboard-view", version: "2.9.1" }
- { name: "ec2", version: "1.18" } - { name: "ec2", version: "1.18" }
- { name: "git", version: "1.5.0" } - { name: "git", version: "1.5.0" }
...@@ -17,6 +18,7 @@ jenkins_plugins: ...@@ -17,6 +18,7 @@ jenkins_plugins:
- { name: "github-api", version: "1.44" } - { name: "github-api", version: "1.44" }
- { name: "github-oauth", version: "0.14" } - { name: "github-oauth", version: "0.14" }
- { name: "htmlpublisher", version: "1.2" } - { name: "htmlpublisher", version: "1.2" }
- { name: "javadoc", version: "1.1" }
- { name: "jobConfigHistory", version: "2.4" } - { name: "jobConfigHistory", version: "2.4" }
- { name: "jquery", version: "1.7.2-1" } - { name: "jquery", version: "1.7.2-1" }
- { name: "nested-view", version: "1.10" } - { name: "nested-view", version: "1.10" }
......
--- ---
- name: jenkins | install jenkins specific system packages - name: jenkins_master | install jenkins specific system packages
apt: apt:
pkg={{','.join(jenkins_debian_pkgs)}} pkg={{','.join(jenkins_debian_pkgs)}}
state=present update_cache=yes state=present update_cache=yes
tags: tags:
- jenkins - jenkins
- name: common | Create jenkins group - name: jenkins_master | Create jenkins group
group: name={{ jenkins_group }} state=present group: name={{ jenkins_group }} state=present
- name: jenkins | Add the jenkins user to the group - name: jenkins_master | Add the jenkins user to the group
user: name={{ jenkins_user }} append=yes groups={{ jenkins_group }} user: name={{ jenkins_user }} append=yes groups={{ jenkins_group }}
- name: jenkins | Install Jenkins apt key - name: jenkins_master | Install Jenkins apt key
apt_key: url=http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key state=present apt_key: url=http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key state=present
- name: jenkins | Add apt repository - name: jenkins_master | Add apt repository
apt_repository: repo='deb http://pkg.jenkins-ci.org/debian binary/' state=present apt_repository: repo='deb http://pkg.jenkins-ci.org/debian binary/' state=present
- name: jenkins | Install jenkins package - name: jenkins_master | Install jenkins package
apt: pkg=jenkins state=present update_cache=yes apt: pkg=jenkins state=present update_cache=yes
- name: jenkins | Make plugins directory - name: jenkins_master | Make plugins directory
sudo_user: jenkins sudo_user: jenkins
shell: mkdir -p {{ jenkins_home }}/plugins shell: mkdir -p {{ jenkins_home }}/plugins
- name: jenkins | Install Jenkins plugins - name: jenkins_master | Install Jenkins plugins
sudo_user: jenkins sudo_user: jenkins
get_url: url=http://updates.jenkins-ci.org/download/plugins/${item.name}/${item.version}/${item.name}.hpi get_url: url=http://updates.jenkins-ci.org/download/plugins/${item.name}/${item.version}/${item.name}.hpi
dest={{ jenkins_home }}/plugins/${item.name}.hpi dest={{ jenkins_home }}/plugins/${item.name}.hpi
...@@ -39,32 +39,32 @@ ...@@ -39,32 +39,32 @@
# merged into the main repo and released, # merged into the main repo and released,
# we can use the regular plugin install process. # we can use the regular plugin install process.
# Until then, we need to compile and install it ourselves. # Until then, we need to compile and install it ourselves.
- name: jenkins | Checkout custom git-client plugin repo - name: jenkins_master | Checkout custom git-client plugin repo
git: repo=https://github.com/edx/git-client-plugin.git git: repo=https://github.com/edx/git-client-plugin.git
dest=/tmp/git-client-plugin dest=/tmp/git-client-plugin
- name: jenkins | Compile custom git-client plugin - name: jenkins_master | Compile custom git-client plugin
command: mvn install chdir=/tmp/git-client-plugin command: mvn install chdir=/tmp/git-client-plugin
creates=/tmp/git-client-plugin/target/git-client.hpi creates=/tmp/git-client-plugin/target/git-client.hpi
- name: jenkins | Install custom git-client - name: jenkins_master | Install custom git-client
command: mv /tmp/git-client-plugin/target/git-client.hpi command: mv /tmp/git-client-plugin/target/git-client.hpi
{{ jenkins_home }}/plugins/git-client.hpi {{ jenkins_home }}/plugins/git-client.hpi
creates={{ jenkins_home }}/plugins/git-client.hpi creates={{ jenkins_home }}/plugins/git-client.hpi
notify: notify:
- restart Jenkins - restart Jenkins
- name: jenkins | Set git-client plugin permissions - name: jenkins_master | Set git-client plugin permissions
file: path={{ jenkins_home }}/plugins/git-client.hpi file: path={{ jenkins_home }}/plugins/git-client.hpi
owner={{ jenkins_user }} group={{ jenkins_group }} owner={{ jenkins_user }} group={{ jenkins_group }}
mode=700 mode=700
- name: jenkins | Setup nginix vhost - name: jenkins_master | Setup nginix vhost
template: template:
src=etc/nginx/sites-available/jenkins.j2 src=etc/nginx/sites-available/jenkins.j2
dest=/etc/nginx/sites-available/jenkins dest=/etc/nginx/sites-available/jenkins
- name: jenkins | enable jenkins vhost - name: jenkins_master | enable jenkins vhost
file: file:
src=/etc/nginx/sites-available/jenkins src=/etc/nginx/sites-available/jenkins
dest=/etc/nginx/sites-enabled/jenkins dest=/etc/nginx/sites-enabled/jenkins
......
...@@ -33,10 +33,13 @@ jenkins_debian_pkgs: ...@@ -33,10 +33,13 @@ jenkins_debian_pkgs:
# Ruby Specific Vars # Ruby Specific Vars
rbenv_root: "{{ jenkins_user_home }}/.rbenv" rbenv_root: "{{ jenkins_user_home }}/.rbenv"
rbenv_repo: "https://github.com/sstephenson/rbenv.git"
ruby_build_repo: "https://github.com/sstephenson/ruby-build.git"
ruby_version: "1.9.3-p374" ruby_version: "1.9.3-p374"
# JSCover direct download URL # JSCover direct download URL
jscover_url: "http://superb-dca2.dl.sourceforge.net/project/jscover/JSCover-1.0.2.zip" jscover_url: "http://superb-dca2.dl.sourceforge.net/project/jscover/JSCover-1.0.2.zip"
jscover_version: "1.0.2"
# Mongo config # Mongo config
mongo_dir: "/mnt/mongodb" mongo_dir: "/mnt/mongodb"
......
--- ---
- name: browsers | Install Firefox - name: jenkins_worker | Install Firefox
apt: pkg=firefox apt: pkg=firefox
- name: browsers | Install dbus-x11 (FF requirement) - name: jenkins_worker | Install dbus-x11 (FF requirement)
apt: pkg=dbus-x11 apt: pkg=dbus-x11
- name: browsers | Download PhantomJS - name: jenkins_worker | Download PhantomJS
get_url: url={{ jenkins_phantomjs_url }} get_url: url={{ jenkins_phantomjs_url }}
dest=/var/tmp/{{ jenkins_phantomjs_archive }} dest=/var/tmp/{{ jenkins_phantomjs_archive }}
- name: browsers | Untar PhantomJS - name: jenkins_worker | Untar PhantomJS
command: tar -xjf /var/tmp/{{ jenkins_phantomjs_archive }} -C /var/tmp/ command: tar -xjf /var/tmp/{{ jenkins_phantomjs_archive }} -C /var/tmp/
creates=/var/tmp/{{ jenkins_phantomjs_folder }} creates=/var/tmp/{{ jenkins_phantomjs_folder }}
- name: browsers | Install PhantomJS - name: jenkins_worker | Install PhantomJS
command: mv /var/tmp/{{ jenkins_phantomjs_folder }} /usr/local/bin/phantomjs command: mv /var/tmp/{{ jenkins_phantomjs_folder }} /usr/local/bin/phantomjs
creates=/usr/local/bin/phantomjs creates=/usr/local/bin/phantomjs
- name: browsers | Set PhantomJS permissions - name: jenkins_worker | Set PhantomJS permissions
file: path=/usr/local/bin/phantomjs mode=0755 state=directory file: path=/usr/local/bin/phantomjs mode=0755 state=directory
- name: browsers | Install Chrome dependencies - name: jenkins_worker | Install Chrome dependencies
apt: pkg=libgconf2-4,libxss1,libnss3-1d,libcurl3,xdg-utils apt: pkg=libgconf2-4,libxss1,libnss3-1d,libcurl3,xdg-utils
- name: browsers | Install Google Chrome - name: jenkins_worker | Install Google Chrome
get_url: url=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb dest=/var/tmp/google-chrome-stable_current_amd64.deb get_url: url=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb dest=/var/tmp/google-chrome-stable_current_amd64.deb
- name: browsers | Install Google Chrome 2 - name: jenkins_worker | Install Google Chrome 2
command: dpkg -i google-chrome-stable_current_amd64.deb command: dpkg -i google-chrome-stable_current_amd64.deb
chdir=/var/tmp chdir=/var/tmp
ignore_errors: True ignore_errors: True
- name: browsers | Install ChromeDriver - name: jenkins_worker | Install ChromeDriver
get_url: url=https://chromedriver.googlecode.com/files/chromedriver_linux64_2.1.zip dest=/var/tmp/chromedriver_linux64_2.1.zip get_url: url=https://chromedriver.googlecode.com/files/chromedriver_linux64_2.1.zip dest=/var/tmp/chromedriver_linux64_2.1.zip
- name: browsers | Install ChromeDriver 2 - name: jenkins_worker | Install ChromeDriver 2
shell: unzip /var/tmp/chromedriver_linux64_2.1.zip shell: unzip /var/tmp/chromedriver_linux64_2.1.zip
chdir=/var/tmp chdir=/var/tmp
- name: browsers | Install ChromeDriver 3 - name: jenkins_worker | Install ChromeDriver 3
shell: mv /var/tmp/chromedriver /usr/local/bin/chromedriver shell: mv /var/tmp/chromedriver /usr/local/bin/chromedriver
- name: browsers | Install Chromedriver 4 - name: jenkins_worker | Install Chromedriver 4
file: path=/usr/local/bin/chromedriver mode=0755 file: path=/usr/local/bin/chromedriver mode=0755
--- ---
- name: JSCover | Install Java - name: jenkins_worker | Install Java
apt: pkg=openjdk-7-jre-headless state=present apt: pkg=openjdk-7-jre-headless state=present
- name: JSCover | Download JSCover - name: jenkins_worker | Download JSCover
get_url: url={{ jscover_url }} dest=/var/tmp/jscover.zip get_url: url={{ jscover_url }} dest=/var/tmp/jscover.zip
- name: JSCover | Unzip JSCover - name: jenkins_worker | Unzip JSCover
shell: unzip /var/tmp/jscover.zip -d /var/tmp/jscover shell: unzip /var/tmp/jscover.zip -d /var/tmp/jscover
creates=/var/tmp/jscover creates=/var/tmp/jscover
- name: JSCover | Install JSCover JAR - name: jenkins_worker | Install JSCover JAR
command: cp /var/tmp/jscover/target/dist/JSCover-all.jar /usr/local/bin/JSCover-all.jar command: cp /var/tmp/jscover/target/dist/JSCover-all.jar /usr/local/bin/JSCover-all-{{ jscover_version }}.jar
creates=/usr/local/bin/JSCover-all.jar creates=/usr/local/bin/JSCover-all-{{ jscover_version }}.jar
- name: JSCover | Set JSCover permissions - name: jenkins_worker | Set JSCover permissions
file: path="/usr/local/bin/JSCover-all.jar" state=file file: path="/usr/local/bin/JSCover-all-{{ jscover_version }}.jar" state=file
owner=root group=root mode=0755 owner=root group=root mode=0755
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
# Configure Mongo to use /mnt so we don't # Configure Mongo to use /mnt so we don't
# run out of disk space # run out of disk space
- name: jenkins | Stop mongo service - name: jenkins_worker | Stop mongo service
service: name=mongodb state=stopped service: name=mongodb state=stopped
- name: jenkins | Configure Mongo - name: jenkins_worker | Configure Mongo
template: src=mongodb_conf.j2 template: src=mongodb_conf.j2
dest=/etc/mongodb.conf dest=/etc/mongodb.conf
owner=root owner=root
group=root group=root
- name: jenkins | Configure Mongo upstart script - name: jenkins_worker | Configure Mongo upstart script
template: src=mongodb_upstart.j2 template: src=mongodb_upstart.j2
dest=/etc/init/mongodb.conf dest=/etc/init/mongodb.conf
owner=root owner=root
group=root group=root
- name: jenkins | Start the mongo service - name: jenkins_worker | Start the mongo service
service: name=mongodb state=stopped service: name=mongodb state=stopped
--- ---
- name: jenkins | Install virtualenv - name: jenkins_worker | Install virtualenv
pip: name=virtualenv state=present pip: name=virtualenv state=present
- name: jenkins | Install virtualenv wrapper - name: jenkins_worker | Install virtualenv wrapper
pip: name=virtualenvwrapper state=present pip: name=virtualenvwrapper state=present
- name: jenkins | Install requests - name: jenkins_worker | Install requests
pip: name=requests state=present pip: name=requests state=present
# Install bash scripts # Install bash scripts
- name: jenkins | Install Python packages scripts - name: jenkins_worker | Install Python packages scripts
copy: src="${item}" dest="/usr/local/bin/${item}" copy: src="${item}" dest="/usr/local/bin/${item}"
force=yes force=yes
owner=root group=root owner=root group=root
...@@ -20,19 +20,19 @@ ...@@ -20,19 +20,19 @@
- install_python_pkgs.sh - install_python_pkgs.sh
# Install scripts requiring a GitHub OAuth token # Install scripts requiring a GitHub OAuth token
- fail: GitHub OAuth token not defined - fail: jenkins_worker | OAuth token not defined
when: github_oauth_token is not defined when: github_oauth_token is not defined
- name: jenkins | Install Python GitHub PR auth script - name: jenkins_worker | Install Python GitHub PR auth script
template: src="github_pr_auth.py.j2" dest="/usr/local/bin/github_pr_auth.py" template: src="github_pr_auth.py.j2" dest="/usr/local/bin/github_pr_auth.py"
owner=root group=root owner=root group=root
mode=755 mode=755
- name: jenkins | Install Python GitHub post status script - name: jenkins_worker | Install Python GitHub post status script
template: src="github_post_status.py.j2" dest="/usr/local/bin/github_post_status.py" template: src="github_post_status.py.j2" dest="/usr/local/bin/github_post_status.py"
owner=root group=root owner=root group=root
mode=755 mode=755
# Install upstart script to download Python packages from S3 # Install upstart script to download Python packages from S3
- name: jenkins | Install Python packages upstart script - name: jenkins_worker | Install Python packages upstart script
template: src="python_pkgs.conf.j2" dest="/etc/init/python_pkgs.conf" template: src="python_pkgs.conf.j2" dest="/etc/init/python_pkgs.conf"
--- ---
- name: jenkins | Install rbenv - name: jenkins_worker | Install rbenv
git: repo=https://github.com/sstephenson/rbenv.git git: repo={{ rbenv_repo }} dest={{ rbenv_root }}
dest={{ rbenv_root }}
sudo_user: "{{ jenkins_user }}" sudo_user: "{{ jenkins_user }}"
- name: jenkins | Install ruby-build - name: jenkins_worker | Install ruby-build
git: repo=https://github.com/sstephenson/ruby-build.git git: repo={{ ruby_build_repo }} dest={{ rbenv_root }}/plugins/ruby-build
dest={{ rbenv_root }}/plugins/ruby-build
sudo_user: "{{ jenkins_user }}" sudo_user: "{{ jenkins_user }}"
- name: jenkins | Install ruby - name: jenkins_worker | Install ruby
command: "{{ rbenv_root }}/bin/rbenv install {{ ruby_version }} command: "{{ rbenv_root }}/bin/rbenv install {{ ruby_version }}
creates={{ rbenv_root }}/versions/{{ ruby_version }}" creates={{ rbenv_root }}/versions/{{ ruby_version }}"
sudo_user: "{{ jenkins_user }}" sudo_user: "{{ jenkins_user }}"
- name: jenkins | Set global ruby - name: jenkins_worker | Set global ruby
command: "{{ rbenv_root }}/bin/rbenv global {{ ruby_version }}" command: "{{ rbenv_root }}/bin/rbenv global {{ ruby_version }}"
sudo_user: "{{ jenkins_user }}" sudo_user: "{{ jenkins_user }}"
- name: jenkins | Install bundler - name: jenkins_worker | Install bundler
command: "{{ rbenv_root }}/shims/gem install bundler" command: "{{ rbenv_root }}/shims/gem install bundler"
sudo_user: "{{ jenkins_user }}" sudo_user: "{{ jenkins_user }}"
- name: jenkins | Rbenv rehash - name: jenkins_worker | Rbenv rehash
command: "{{ rbenv_root }}/bin/rbenv rehash" command: "{{ rbenv_root }}/bin/rbenv rehash"
sudo_user: "{{ jenkins_user }}" sudo_user: "{{ jenkins_user }}"
--- ---
- name: jenkins | Create jenkins group - name: jenkins_worker | Create jenkins group
group: name={{ jenkins_group }} state=present group: name={{ jenkins_group }} state=present
- name: jenkins | Add the jenkins user to the group - name: jenkins_worker | Add the jenkins user to the group
user: name={{ jenkins_user }} append=yes group={{ jenkins_group }} user: name={{ jenkins_user }} append=yes group={{ jenkins_group }}
# We need the upstart script to create the build directory # We need the upstart script to create the build directory
# so that (a) it will be run when a new instance is created # so that (a) it will be run when a new instance is created
# on the current EBS, and (b) it will be run as root. # on the current EBS, and (b) it will be run as root.
- name: jenkins | Install upstart script to create build dir - name: jenkins_worker | Install upstart script to create build dir
template: src=jenkins_workspace.conf.j2 template: src=jenkins_workspace.conf.j2
dest=/etc/init/jenkins_workspace.conf dest=/etc/init/jenkins_workspace.conf
owner=root group=root owner=root group=root
...@@ -19,22 +19,22 @@ ...@@ -19,22 +19,22 @@
# we need to use a key generated by Amazon (not imported) # we need to use a key generated by Amazon (not imported)
# To satisfy this, we allow users to log in as Jenkins # To satisfy this, we allow users to log in as Jenkins
# using the same keypair the instance was started with. # using the same keypair the instance was started with.
- name: jenkins | Create .ssh directory - name: jenkins_worker | Create .ssh directory
file: path={{ jenkins_user_home }}/.ssh state=directory file: path={{ jenkins_user_home }}/.ssh state=directory
owner={{ jenkins_user }} group={{ jenkins_group }} owner={{ jenkins_user }} group={{ jenkins_group }}
- name: jenkins | Copy ssh keys for jenkins - name: jenkins_worker | Copy ssh keys for jenkins
command: cp /home/ubuntu/.ssh/authorized_keys /home/{{ jenkins_user }}/.ssh/authorized_keys command: cp /home/ubuntu/.ssh/authorized_keys /home/{{ jenkins_user }}/.ssh/authorized_keys
- name: jenkins | Set key permissions - name: jenkins_worker | Set key permissions
file: path={{ jenkins_user_home }}/.ssh/authorized_keys file: path={{ jenkins_user_home }}/.ssh/authorized_keys
owner={{ jenkins_user }} group={{ jenkins_group }} owner={{ jenkins_user }} group={{ jenkins_group }}
mode=400 mode=400
- name: jenkins | Install system packages - name: jenkins_worker | Install system packages
apt: pkg={{','.join(jenkins_debian_pkgs)}} apt: pkg={{','.join(jenkins_debian_pkgs)}}
state=present update_cache=yes state=present update_cache=yes
- name: jenkins | Add script to set up environment variables - name: jenkins_worker | Add script to set up environment variables
template: src=jenkins_env.sh.j2 dest=/usr/local/bin/jenkins_env.sh template: src=jenkins_env.sh.j2 dest=/usr/local/bin/jenkins_env.sh
owner=root group=root mode=0555 owner=root group=root mode=0555
--- ---
- name: xvfb | install xvfb - name: jenkins_worker | install xvfb
apt: pkg=xvfb state=present apt: pkg=xvfb state=present
- name: xvfb | create xvfb upstart script - name: jenkins_worker | create xvfb upstart script
template: src=xvfb.conf.j2 dest=/etc/init/xvfb.conf owner=root group=root template: src=xvfb.conf.j2 dest=/etc/init/xvfb.conf owner=root group=root
- name: xvfb | start xvfb - name: jenkins_worker | start xvfb
shell: start xvfb shell: start xvfb
ignore_errors: yes ignore_errors: yes
...@@ -107,7 +107,7 @@ def main(): ...@@ -107,7 +107,7 @@ def main():
# Check that the owner is whitelisted # Check that the owner is whitelisted
whitelist_owners = os.environ.get('GITHUB_OWNER_WHITELIST', '').split(',') whitelist_owners = os.environ.get('GITHUB_OWNER_WHITELIST', '').split(',')
if not owner in whitelist_owners: if owner not in whitelist_owners:
print dedent(""" print dedent("""
Owner '{0}' is not in the whitelist. Owner '{0}' is not in the whitelist.
You can update the whitelist by setting the environment variable You can update the whitelist by setting the environment variable
......
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