Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
eebcaaac
Unverified
Commit
eebcaaac
authored
8 years ago
by
arbabnazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite the tasks using YAML syntax
parent
8cd7d0c5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
55 deletions
+103
-55
playbooks/roles/jenkins_worker/tasks/packer.yml
+5
-2
playbooks/roles/jenkins_worker/tasks/python.yml
+3
-2
playbooks/roles/jenkins_worker/tasks/python_platform_worker.yml
+26
-24
playbooks/roles/jenkins_worker/tasks/system.yml
+55
-22
playbooks/roles/jenkins_worker/tasks/test_platform_worker.yml
+14
-5
No files found.
playbooks/roles/jenkins_worker/tasks/packer.yml
View file @
eebcaaac
...
...
@@ -2,7 +2,10 @@
-
name
:
Download packer
shell
:
"
curl
-L
{{
packer_url
}}
-o
/var/tmp/packer.zip"
args
:
creates
:
/var/tmp/packer.zip
creates
:
/var/tmp/packer.zip
-
name
:
Unzip packer
unarchive
:
src=/var/tmp/packer.zip dest=/usr/local/bin copy=no
unarchive
:
src
:
/var/tmp/packer.zip
dest
:
/usr/local/bin
copy
:
no
This diff is collapsed.
Click to expand it.
playbooks/roles/jenkins_worker/tasks/python.yml
View file @
eebcaaac
---
# Requests library is required for both the github status
# script, as well as the sitespeed cookie script.
-
name
:
Install requests Python library
pip
:
name=requests state=present
pip
:
name
:
requests
state
:
present
This diff is collapsed.
Click to expand it.
playbooks/roles/jenkins_worker/tasks/python_platform_worker.yml
View file @
eebcaaac
...
...
@@ -6,11 +6,11 @@
# refers to the --depth-setting of git clone. A value of 1
# will truncate all history prior to the last revision.
-
name
:
Create shallow clone of edx-platform
git_2_0_1
:
>
repo
=https://github.com/edx/edx-platform.git
dest
={{ jenkins_home }}/shallow-clone
version
={{ jenkins_edx_platform_version }}
depth
=
1
git_2_0_1
:
repo
:
"
https://github.com/edx/edx-platform.git"
dest
:
"
{{
jenkins_home
}}/shallow-clone"
version
:
"
{{
jenkins_edx_platform_version
}}"
depth
:
1
become_user
:
"
{{
jenkins_user
}}"
# pip-accel skipped due to conflicting versions of pip required
...
...
@@ -31,12 +31,12 @@
# (0.22.4) is only compatible with pip >= 1.4, < 1.5 and the current
# version of pip in edx-platform is 6.0.8.
-
name
:
Install edx-platform requirements using pip
pip
:
>
requirements
={{ jenkins_home }}/shallow-clone/requirements/edx/{{ item }}
extra_args
=
"--exists-action=w"
virtualenv
={{ jenkins_home }}/edx-venv
virtualenv_command
=
virtualenv
executable
=
pip
pip
:
requirements
:
"
{{
jenkins_home
}}/shallow-clone/requirements/edx/{{
item
}}"
extra_args
:
"
--exists-action=w"
virtualenv
:
"
{{
jenkins_home
}}/edx-venv"
virtualenv_command
:
virtualenv
executable
:
pip
with_items
:
-
pre.txt
-
github.txt
...
...
@@ -44,21 +44,21 @@
-
paver.txt
become_user
:
"
{{
jenkins_user
}}"
# These and the pip install below it can be removed some time after
# https://github.com/edx/edx-platform/pull/7465 has merged.
# This will keep us from breaking after that gets merged.
-
stat
:
path="{{ jenkins_home }}/shallow-clone/requirements/edx/post.txt"
-
stat
:
path
:
"
{{
jenkins_home
}}/shallow-clone/requirements/edx/post.txt"
register
:
post_requirements
become_user
:
"
{{
jenkins_user
}}"
-
name
:
Install edx-platform post requirements using pip
pip
:
>
requirements
={{ jenkins_home }}/shallow-clone/requirements/edx/{{ item }}
extra_args
=
"--exists-action=w"
virtualenv
={{ jenkins_home }}/edx-venv
virtualenv_command
=
virtualenv
executable
=
pip
pip
:
requirements
:
"
{{
jenkins_home
}}/shallow-clone/requirements/edx/{{
item
}}"
extra_args
:
"
--exists-action=w"
virtualenv
:
"
{{
jenkins_home
}}/edx-venv"
virtualenv_command
:
virtualenv
executable
:
pip
with_items
:
-
post.txt
become_user
:
"
{{
jenkins_user
}}"
...
...
@@ -69,15 +69,17 @@
# The edx-venv directory is deleted and then recreated
# cleanly from the archive by the jenkins build scripts.
-
name
:
Create a clean virtualenv archive
command
:
>
tar -cpzf edx-venv_clean.tar.gz edx-venv
chdir
={{ jenkins_home }}
command
:
"
tar
-cpzf
edx-venv_clean.tar.gz
edx-venv"
args
:
chdir
:
"
{{
jenkins_home
}}"
become_user
:
"
{{
jenkins_user
}}"
# Remove the shallow-clone directory now that we are
# done with it
-
name
:
Remove shallow-clone
file
:
path={{ jenkins_home }}/shallow-clone state=absent
file
:
path
:
"
{{
jenkins_home
}}/shallow-clone"
state
:
absent
# Although firefox is installed through the browsers role, install
# a newer copy under the jenkins home directory. This will allow
...
...
@@ -88,7 +90,7 @@
url
:
"
{{
custom_firefox_url
}}"
dest
:
"
{{
jenkins_home
}}/firefox-{{
custom_firefox_version
}}.tar.bz2"
-
name
:
u
npack custom firefox version
-
name
:
U
npack custom firefox version
unarchive
:
src
:
"
{{
jenkins_home
}}/firefox-{{
custom_firefox_version
}}.tar.bz2"
dest
:
"
{{
jenkins_home
}}"
...
...
This diff is collapsed.
Click to expand it.
playbooks/roles/jenkins_worker/tasks/system.yml
View file @
eebcaaac
---
-
name
:
Create jenkins group
group
:
name={{ jenkins_group }} state=present
group
:
name
:
"
{{
jenkins_group
}}"
state
:
present
# The Jenkins account needs a login shell because Jenkins uses scp
-
name
:
Add the jenkins user to the group and configure shell
user
:
name={{ jenkins_user }} append=yes group={{ jenkins_group }} shell=/bin/bash
user
:
name
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
append
:
yes
shell
:
/bin/bash
# Because of a bug in the latest release of the EC2 plugin
# we need to use a key generated by Amazon (not imported)
...
...
@@ -12,43 +18,59 @@
# using the same keypair the instance was started with.
-
name
:
Create .ssh directory
file
:
path={{ jenkins_home }}/.ssh state=directory
owner={{ jenkins_user }} group={{ jenkins_group }}
path
:
"
{{
jenkins_home
}}/.ssh"
state
:
directory
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
ignore_errors
:
yes
-
name
:
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"
ignore_errors
:
yes
-
name
:
Set key permissions
file
:
path={{ jenkins_home }}/.ssh/authorized_keys
owner={{ jenkins_user }} group={{ jenkins_group }} mode=400
path
:
"
{{
jenkins_home
}}/.ssh/authorized_keys"
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
mode
:
"
0400"
ignore_errors
:
yes
# adding chris-lea nodejs repo
-
name
:
add ppas for current versions of nodejs
apt_repository
:
repo="{{ jenkins_chrislea_ppa }}"
-
name
:
Add ppas for current versions of nodejs
apt_repository
:
repo
:
"
{{
jenkins_chrislea_ppa
}}"
state
:
present
-
name
:
Install system packages
apt
:
pkg={{','.join(jenkins_debian_pkgs)}}
state=present update_cache=yes
apt
:
name
:
"
{{
item
}}"
state
:
present
update_cache
:
yes
with_items
:
"
{{
jenkins_debian_pkgs
}}"
-
name
:
Add script to set up environment variables
template
:
src=jenkins_env.j2 dest={{ jenkins_home }}/jenkins_env
owner={{ jenkins_user }} group={{ jenkins_group }} mode=0500
src
:
jenkins_env.j2
dest
:
"
{{
jenkins_home
}}/jenkins_env"
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
mode
:
"
0500"
when
:
platform_worker is defined
# Need to add Github to known_hosts to avoid
# being prompted when using git through ssh
-
name
:
Add github.com to known_hosts if it does not exist
shell
:
>
ssh-keygen -f {{ jenkins_home }}/.ssh/known_hosts -H -F github.com | grep -q found || ssh-keyscan -H github.com > {{ jenkins_home }}/.ssh/known_hosts
"ssh-keygen -f {{ jenkins_home }}/.ssh/known_hosts -H -F github.com | grep -q found || ssh-keyscan -H github.com > {{ jenkins_home }}/.ssh/known_hosts"
# Edit the /etc/hosts file so that the Preview button will work in Studio
-
name
:
add preview.localhost to /etc/hosts
shell
:
sed -i -r 's/^127.0.0.1\s+.*$/127.0.0.1 localhost preview.localhost/' /etc/hosts
-
name
:
Add preview.localhost to /etc/hosts
lineinfile
:
dest
:
/etc/hosts
regexp
:
"
^127.0.0.1"
line
:
"
127.0.0.1
localhost
preview.localhost"
state
:
present
become
:
yes
# Npm registry must be pre-loaded or else setting it
...
...
@@ -56,17 +78,28 @@
# See https://github.com/npm/npm/issues/3565
-
name
:
Set npm registry
template
:
src=.npmrc.j2 dest={{ jenkins_home }}/.npmrc
owner={{ jenkins_user }} group={{ jenkins_group }} mode=0664
src
:
"
.npmrc.j2"
dest
:
"
{{
jenkins_home
}}/.npmrc"
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
mode
:
"
0664"
# Set up configuration for pip-accel for caching python requirements
-
name
:
Create directory for pip-accel config file
file
:
path={{ jenkins_home }}/.pip-accel state=directory
owner={{ jenkins_user }} group={{ jenkins_group }} mode=0777 recurse=yes
file
:
path
:
"
{{
jenkins_home
}}/.pip-accel"
state
:
directory
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
mode
:
"
0777"
recurse
:
yes
when
:
platform_worker is defined
-
name
:
Create pip-accel config file
template
:
src=pip-accel.conf.j2 dest={{ jenkins_home }}/.pip-accel/pip-accel.conf
owner={{ jenkins_user }} group={{ jenkins_group }} mode=0664
src
:
"
pip-accel.conf.j2"
dest
:
"
{{
jenkins_home
}}/.pip-accel/pip-accel.conf"
owner
:
"
{{
jenkins_user
}}"
group
:
"
{{
jenkins_group
}}"
mode
:
"
0664"
when
:
platform_worker is defined
This diff is collapsed.
Click to expand it.
playbooks/roles/jenkins_worker/tasks/test_platform_worker.yml
View file @
eebcaaac
...
...
@@ -7,9 +7,13 @@
# To get a baseline comparison for timestamp comparisons
# create a testfile and register its stat info
-
name
:
Create test file
file
:
path=testfile state=touch
file
:
path
:
testfile
state
:
touch
-
name
:
Stat test file
stat
:
path=testfile
stat
:
path
:
testfile
register
:
testfile
...
...
@@ -27,7 +31,8 @@
# Verify the virtualenv tar is newly-built
-
name
:
Get info on virtualenv tar
stat
:
path={{ jenkins_home }}/edx-venv_clean.tar.gz
stat
:
path
:
"
{{
jenkins_home
}}/edx-venv_clean.tar.gz"
register
:
edxvenv
-
assert
:
that
:
...
...
@@ -35,9 +40,13 @@
-
"
{{
testfile.stat.mtime
}}
-
{{
edxvenv.stat.mtime
}}
<
3600"
# Verify that postfix (mail server) is listening
-
wait_for
:
host={{ inventory_hostname }} port=25
-
wait_for
:
host
:
"
{{
inventory_hostname
}}"
port
:
25
delegate_to
:
localhost
# Tear Down #
-
name
:
Remove test file
file
:
path=testfile state=absent
file
:
path
:
testfile
state
:
absent
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment