Merge lp:~ricardokirkner/locolander/explicit-dependencies into lp:locolander

Proposed by Ricardo Kirkner
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 28
Merged at revision: 27
Proposed branch: lp:~ricardokirkner/locolander/explicit-dependencies
Merge into: lp:locolander
Diff against target: 246 lines (+76/-26)
3 files modified
.locolander.yml (+53/-1)
ns2df.py (+7/-9)
tests/test_ns2df.py (+16/-16)
To merge this branch: bzr merge lp:~ricardokirkner/locolander/explicit-dependencies
Reviewer Review Type Date Requested Status
Facundo Batista Approve
Review via email: mp+177235@code.launchpad.net

Commit message

use explicit dependencies in locolander.yml file to improve build speed

streamline Dockerfile builder to cache as much as possible

To post a comment you must log in.
Revision history for this message
Facundo Batista (facundo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.locolander.yml'
--- .locolander.yml 2013-07-13 17:02:33 +0000
+++ .locolander.yml 2013-07-27 00:07:31 +0000
@@ -1,5 +1,57 @@
1precise:1precise:
2 pip: -r requirements.txt2 apt:
3 python-dev:
4 libpq-dev:
5 libxml2-dev:
6 libxslt1-dev:
7 pip:
8 Django: 1.5.1
9 PyYAML: 3.10.0
10 South: 0.8.1
11 amqp: 1.0.12
12 anyjson: 0.3.3
13 argparse: 1.2.1
14 billiard: 2.7.3.31
15 bzr: 2.6b2
16 celery: 3.0.21
17 cssselect: 0.8
18 distribute: 0.6.34
19 django-allauth: 0.12.0
20 django-celery: 3.0.17
21 flower: 0.5.2
22 github3.py: 0.7.0
23 gunicorn: 17.5
24 httplib2: 0.8
25 keyring: 1.5
26 kombu: 2.5.12
27 launchpadlib: 1.10.2
28 lazr.authentication: 0.1.2
29 lazr.restfulclient: 0.13.3
30 lazr.uri: 1.0.3
31 lxml: 3.2.1
32 meld3: 0.6.10
33 mock: 1.0.1
34 oauth: 1.0.1
35 oauthlib: 0.5.0
36 pep8: 1.4.6
37 psycopg2: 2.5.1
38 pyflakes: 0.7.3
39 pyquery: 1.2.4
40 python-dateutil: 2.1
41 python-openid: 2.2.5
42 pytz: 2013b
43 redis: 2.7.6
44 requests: 1.2.3
45 requests-oauthlib: 0.3.2
46 simplejson: 3.3.0
47 six: 1.3.0
48 supervisor: 3.0b2
49 testresources: 0.2.7
50 tornado: 3.1
51 wadllib: 1.3.2
52 wsgi-intercept: 0.5.1
53 wsgiref: 0.1.2
54 zope.interface: 4.0.5
355
4metadata:56metadata:
5 test_script: ./run_tests.sh57 test_script: ./run_tests.sh
658
=== modified file 'ns2df.py'
--- ns2df.py 2013-07-09 18:41:19 +0000
+++ ns2df.py 2013-07-27 00:07:31 +0000
@@ -15,13 +15,13 @@
15will be converted to15will be converted to
1616
17 from locolander:precise17 from locolander:precise
18 run apt-get -q -y install apache2=3.3-418 run apt-get -q -y install apache2=3.3-4 bzr
19 run apt-get -q -y install bzr
20 run pip install --download=/tmp/pipcache --no-install foobar19 run pip install --download=/tmp/pipcache --no-install foobar
21 run ip link set dev eth0 down20 run ip link set dev eth0 down
22 run pip install --find-links=file:///tmp/pipcache --no-index foobar21 run pip install --find-links=file:///tmp/pipcache --no-index foobar
22 cmd cd /srv/locolander/project && timeout 300 ./test
2323
24and also the system will use "./test" as script24(provided the project name used is 'project')
25"""25"""
2626
27import os.path27import os.path
@@ -59,9 +59,7 @@
5959
60def _get_code(config, **params):60def _get_code(config, **params):
61 return ['run mkdir -p {target_path}'.format(**params),61 return ['run mkdir -p {target_path}'.format(**params),
62 'add . {target_path}'.format(**params),62 'add . {target_path}'.format(**params)]
63 'run chown -R locolander.locolander {target_path}'.format(
64 **params)]
6563
6664
67def _get_depends_prev(config, **params):65def _get_depends_prev(config, **params):
@@ -89,7 +87,7 @@
89 packages = _get_pip_packages(items)87 packages = _get_pip_packages(items)
90 pip_cache_dir = params['pip_cache_dir']88 pip_cache_dir = params['pip_cache_dir']
91 dependencies.append(89 dependencies.append(
92 'run cd {target_path} && pip install --download={pip_cache_dir} '90 'run pip install --download={pip_cache_dir} '
93 '--no-install {packages}'.format(91 '--no-install {packages}'.format(
94 pip_cache_dir=pip_cache_dir, packages=packages,92 pip_cache_dir=pip_cache_dir, packages=packages,
95 target_path=params['target_path']))93 target_path=params['target_path']))
@@ -112,7 +110,7 @@
112 packages = _get_pip_packages(items)110 packages = _get_pip_packages(items)
113 pip_cache_dir = params['pip_cache_dir']111 pip_cache_dir = params['pip_cache_dir']
114 dependencies.append(112 dependencies.append(
115 'run cd {target_path} && pip install '113 'run pip install '
116 '--find-links=file://{pip_cache_dir} --no-index '114 '--find-links=file://{pip_cache_dir} --no-index '
117 '{packages}'.format(pip_cache_dir=pip_cache_dir,115 '{packages}'.format(pip_cache_dir=pip_cache_dir,
118 packages=packages,116 packages=packages,
@@ -140,10 +138,10 @@
140 # the order for calling these functions is VERY important138 # the order for calling these functions is VERY important
141 functions = [139 functions = [
142 _get_base,140 _get_base,
143 _get_code,
144 _get_depends_prev,141 _get_depends_prev,
145 _get_secure,142 _get_secure,
146 _get_depends_post,143 _get_depends_post,
144 _get_code,
147 _get_rest,145 _get_rest,
148 ]146 ]
149 data = []147 data = []
150148
=== modified file 'tests/test_ns2df.py'
--- tests/test_ns2df.py 2013-07-09 18:41:19 +0000
+++ tests/test_ns2df.py 2013-07-27 00:07:31 +0000
@@ -52,7 +52,7 @@
52 })52 })
53 res = ns2df._get_depends_prev(config, **self.params)53 res = ns2df._get_depends_prev(config, **self.params)
54 self.assertEqual(res, [54 self.assertEqual(res, [
55 "run cd /srv/locolander/project && pip install --download=/tmp/pipcache --no-install foo",55 "run pip install --download=/tmp/pipcache --no-install foo",
56 ])56 ])
5757
58 def test_pip_prev_several(self):58 def test_pip_prev_several(self):
@@ -61,7 +61,7 @@
61 })61 })
62 res = ns2df._get_depends_prev(config, **self.params)62 res = ns2df._get_depends_prev(config, **self.params)
63 self.assertEqual(res, [63 self.assertEqual(res, [
64 "run cd /srv/locolander/project && pip install --download=/tmp/pipcache --no-install bar foo",64 "run pip install --download=/tmp/pipcache --no-install bar foo",
65 ])65 ])
6666
67 def test_pip_prev_versions(self):67 def test_pip_prev_versions(self):
@@ -70,7 +70,7 @@
70 })70 })
71 res = ns2df._get_depends_prev(config, **self.params)71 res = ns2df._get_depends_prev(config, **self.params)
72 self.assertEqual(res, [72 self.assertEqual(res, [
73 ("run cd /srv/locolander/project && pip install --download=/tmp/pipcache --no-install "73 ("run pip install --download=/tmp/pipcache --no-install "
74 "bar==2.1 foo"),74 "bar==2.1 foo"),
75 ])75 ])
7676
@@ -80,7 +80,7 @@
80 })80 })
81 res = ns2df._get_depends_prev(config, **self.params)81 res = ns2df._get_depends_prev(config, **self.params)
82 self.assertEqual(res, [82 self.assertEqual(res, [
83 ("run cd /srv/locolander/project && pip install --download=/tmp/pipcache --no-install "83 ("run pip install --download=/tmp/pipcache --no-install "
84 "-r requirements.txt"),84 "-r requirements.txt"),
85 ])85 ])
8686
@@ -90,7 +90,7 @@
90 })90 })
91 res = ns2df._get_depends_post(config, **self.params)91 res = ns2df._get_depends_post(config, **self.params)
92 self.assertEqual(res, [92 self.assertEqual(res, [
93 "run cd /srv/locolander/project && pip install --find-links=file:///tmp/pipcache --no-index foo"93 "run pip install --find-links=file:///tmp/pipcache --no-index foo"
94 ])94 ])
9595
96 def test_pip_post_several(self):96 def test_pip_post_several(self):
@@ -99,7 +99,7 @@
99 })99 })
100 res = ns2df._get_depends_post(config, **self.params)100 res = ns2df._get_depends_post(config, **self.params)
101 self.assertEqual(res, [101 self.assertEqual(res, [
102 ("run cd /srv/locolander/project && pip install --find-links=file:///tmp/pipcache --no-index "102 ("run pip install --find-links=file:///tmp/pipcache --no-index "
103 "bar foo"),103 "bar foo"),
104 ])104 ])
105105
@@ -109,7 +109,7 @@
109 })109 })
110 res = ns2df._get_depends_post(config, **self.params)110 res = ns2df._get_depends_post(config, **self.params)
111 self.assertEqual(res, [111 self.assertEqual(res, [
112 ("run cd /srv/locolander/project && pip install --find-links=file:///tmp/pipcache --no-index "112 ("run pip install --find-links=file:///tmp/pipcache --no-index "
113 "bar==2.1 foo"),113 "bar==2.1 foo"),
114 ])114 ])
115115
@@ -119,7 +119,7 @@
119 })119 })
120 res = ns2df._get_depends_post(config, **self.params)120 res = ns2df._get_depends_post(config, **self.params)
121 self.assertEqual(res, [121 self.assertEqual(res, [
122 ("run cd /srv/locolander/project && pip install --find-links=file:///tmp/pipcache --no-index "122 ("run pip install --find-links=file:///tmp/pipcache --no-index "
123 "-r requirements.txt"),123 "-r requirements.txt"),
124 ])124 ])
125125
@@ -131,7 +131,7 @@
131 res = ns2df._get_depends_prev(config, **self.params)131 res = ns2df._get_depends_prev(config, **self.params)
132 self.assertEqual(res, [132 self.assertEqual(res, [
133 "run apt-get -q -y install apache2=3.3-4 bzr",133 "run apt-get -q -y install apache2=3.3-4 bzr",
134 "run cd /srv/locolander/project && pip install --download=/tmp/pipcache --no-install bar foo",134 "run pip install --download=/tmp/pipcache --no-install bar foo",
135 ])135 ])
136136
137 def test_mixed_post(self):137 def test_mixed_post(self):
@@ -141,7 +141,7 @@
141 })141 })
142 res = ns2df._get_depends_post(config, **self.params)142 res = ns2df._get_depends_post(config, **self.params)
143 self.assertEqual(res, [143 self.assertEqual(res, [
144 ("run cd /srv/locolander/project && pip install --find-links=file:///tmp/pipcache --no-index "144 ("run pip install --find-links=file:///tmp/pipcache --no-index "
145 "bar foo"),145 "bar foo"),
146 ])146 ])
147147
@@ -166,7 +166,8 @@
166 res = ns2df._get_rest({},166 res = ns2df._get_rest({},
167 target_path='/srv/locolander',167 target_path='/srv/locolander',
168 test_cmd='./run_tests.sh')168 test_cmd='./run_tests.sh')
169 self.assertEqual(res, ["cmd cd /srv/locolander && timeout 300 ./run_tests.sh"])169 self.assertEqual(
170 res, ["cmd cd /srv/locolander && timeout 300 ./run_tests.sh"])
170171
171 def test_all_mixed(self):172 def test_all_mixed(self):
172 config_text = """173 config_text = """
@@ -182,13 +183,12 @@
182 docker = ns2df.parse(config_text, "/tmp/pipcache", 'project')183 docker = ns2df.parse(config_text, "/tmp/pipcache", 'project')
183 self.assertEqual(docker,184 self.assertEqual(docker,
184 "from locolander:precise\n"185 "from locolander:precise\n"
185 "run mkdir -p /srv/locolander/project\n"
186 "add . /srv/locolander/project\n"
187 "run chown -R locolander.locolander /srv/locolander/project\n"
188 "run apt-get -q -y install apache2=3.3-4 bzr\n"186 "run apt-get -q -y install apache2=3.3-4 bzr\n"
189 "run cd /srv/locolander/project && pip install --download=/tmp/pipcache --no-install foobar\n"187 "run pip install --download=/tmp/pipcache --no-install foobar\n"
190 "run ip link set dev eth0 down\n"188 "run ip link set dev eth0 down\n"
191 "run cd /srv/locolander/project && pip install --find-links=file:///tmp/pipcache "189 "run pip install --find-links=file:///tmp/pipcache "
192 "--no-index foobar\n"190 "--no-index foobar\n"
191 "run mkdir -p /srv/locolander/project\n"
192 "add . /srv/locolander/project\n"
193 "cmd cd /srv/locolander/project && timeout 300 foo"193 "cmd cd /srv/locolander/project && timeout 300 foo"
194 )194 )

Subscribers

People subscribed via source and target branches

to all changes: