Skip to content

Commit 8e5f8c2

Browse files
James E. Blairdhellmann
authored andcommitted
Add the project under test to LIBS_FROM_GIT
This automatically always adds the project under test to LIBS_FROM_GIT which effectively makes the normal "tempest full" job the same as the "forward testing" job when it is applied to a library repo. Change-Id: Ibbdd8a86e0ff55f67bef73e08e693b34a61b24df
1 parent 9fd9799 commit 8e5f8c2

4 files changed

Lines changed: 32 additions & 16 deletions

File tree

roles/write-devstack-local-conf/README.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ Write the local.conf file for use by devstack
2222

2323
As a special case, the variable ``LIBS_FROM_GIT`` will be
2424
constructed automatically from the projects which appear in the
25-
``required-projects`` list defined by the job. To instruct
26-
devstack to install a library from source rather than pypi, simply
27-
add that library to the job's ``required-projects`` list. To
28-
override the automatically-generated value, set ``LIBS_FROM_GIT``
29-
in ``devstack_localrc`` to the desired value.
25+
``required-projects`` list defined by the job plus the project of
26+
the change under test. To instruct devstack to install a library
27+
from source rather than pypi, simply add that library to the job's
28+
``required-projects`` list. To override the
29+
automatically-generated value, set ``LIBS_FROM_GIT`` in
30+
``devstack_localrc`` to the desired value.
3031

3132
.. zuul:rolevar:: devstack_local_conf
3233
:type: dict

roles/write-devstack-local-conf/library/devstack_local_conf.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,13 @@ def getPlugins(self):
207207
class LocalConf(object):
208208

209209
def __init__(self, localrc, localconf, base_services, services, plugins,
210-
base_dir, projects):
210+
base_dir, projects, project):
211211
self.localrc = []
212212
self.meta_sections = {}
213213
self.plugin_deps = {}
214214
self.base_dir = base_dir
215215
self.projects = projects
216+
self.project = project
216217
if plugins:
217218
self.handle_plugins(plugins)
218219
if services or base_services:
@@ -249,11 +250,15 @@ def handle_localrc(self, localrc):
249250
if k == 'LIBS_FROM_GIT':
250251
lfg = True
251252

252-
if not lfg and self.projects:
253+
if not lfg and (self.projects or self.project):
253254
required_projects = []
254-
for project_name, project_info in self.projects.items():
255-
if project_info.get('required'):
256-
required_projects.append(project_info['short_name'])
255+
if self.projects:
256+
for project_name, project_info in self.projects.items():
257+
if project_info.get('required'):
258+
required_projects.append(project_info['short_name'])
259+
if self.project:
260+
if self.project['short_name'] not in required_projects:
261+
required_projects.append(self.project['short_name'])
257262
if required_projects:
258263
self.localrc.append('LIBS_FROM_GIT={}'.format(
259264
','.join(required_projects)))
@@ -291,6 +296,7 @@ def main():
291296
base_dir=dict(type='path'),
292297
path=dict(type='str'),
293298
projects=dict(type='dict'),
299+
project=dict(type='dict'),
294300
)
295301
)
296302

@@ -301,7 +307,8 @@ def main():
301307
p.get('services'),
302308
p.get('plugins'),
303309
p.get('base_dir'),
304-
p.get('projects'))
310+
p.get('projects'),
311+
p.get('project'))
305312
lc.write(p['path'])
306313

307314
module.exit_json()

roles/write-devstack-local-conf/library/test.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def test_plugins(self):
5757
p.get('services'),
5858
p.get('plugins'),
5959
p.get('base_dir'),
60-
p.get('projects'))
60+
p.get('projects'),
61+
p.get('project'))
6162
lc.write(p['path'])
6263

6364
plugins = []
@@ -120,25 +121,30 @@ def test_libs_from_git(self):
120121
'short_name': 'devstack-plugin',
121122
},
122123
}
124+
project = {
125+
'short_name': 'glance',
126+
}
123127
p = dict(base_services=[],
124128
base_dir='./test',
125129
path=os.path.join(self.tmpdir, 'test.local.conf'),
126-
projects=projects)
130+
projects=projects,
131+
project=project)
127132
lc = LocalConf(p.get('localrc'),
128133
p.get('local_conf'),
129134
p.get('base_services'),
130135
p.get('services'),
131136
p.get('plugins'),
132137
p.get('base_dir'),
133-
p.get('projects'))
138+
p.get('projects'),
139+
p.get('project'))
134140
lc.write(p['path'])
135141

136142
lfg = None
137143
with open(p['path']) as f:
138144
for line in f:
139145
if line.startswith('LIBS_FROM_GIT'):
140146
lfg = line.strip().split('=')[1]
141-
self.assertEqual('nova,oslo.messaging', lfg)
147+
self.assertEqual('nova,oslo.messaging,glance', lfg)
142148

143149
def test_overridelibs_from_git(self):
144150
"Test that LIBS_FROM_GIT can be overridden"
@@ -168,7 +174,8 @@ def test_overridelibs_from_git(self):
168174
p.get('services'),
169175
p.get('plugins'),
170176
p.get('base_dir'),
171-
p.get('projects'))
177+
p.get('projects'),
178+
p.get('project'))
172179
lc.write(p['path'])
173180

174181
lfg = None

roles/write-devstack-local-conf/tasks/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
local_conf: "{{ devstack_local_conf|default(omit) }}"
1111
base_dir: "{{ devstack_base_dir|default(omit) }}"
1212
projects: "{{ zuul.projects }}"
13+
project: "{{ zuul.project }}"

0 commit comments

Comments
 (0)