Merge lp:~psivaa/utah/upgrade-setup-jobs into lp:~utah/utah/jenkins-upgradetest-setup

Proposed by Para Siva
Status: Merged
Merged at revision: 32
Proposed branch: lp:~psivaa/utah/upgrade-setup-jobs
Merge into: lp:~utah/utah/jenkins-upgradetest-setup
Diff against target: 466 lines (+280/-66)
4 files modified
jenkins/config.xml.jinja2 (+22/-2)
jenkins/production.py (+182/-0)
jenkins/setup_jenkins.py (+75/-63)
upgrade/release_upgrade/tc_control (+1/-1)
To merge this branch: bzr merge lp:~psivaa/utah/upgrade-setup-jobs
Reviewer Review Type Date Requested Status
Paul Larson Approve
Para Siva (community) Needs Resubmitting
Review via email: mp+193617@code.launchpad.net

Description of the change

This is to give *some flexibility to create upgrade jobs from any base release to the dev release. This cycle being lts, we need jobs from precise. Tried locally and was able to create jobs without issues.

This also includes the timeout change to 3 hrs. So this could supersede, https://code.launchpad.net/~psivaa/utah/upgrade-timeout/+merge/193572

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

There's nothing wrong with this:

105 + epilog=("For example:\n"
106 + "\t%(prog)s -b /path/to/branch"
107 + " -u user -p pass -j http://jenkins:8080"
108 + " -B saucy"
109 + " -D trusty\n"),

However, python has textwrap.dedent which would make this look a little nicer like:

  epilog=('''For example:\n
          t%(prog)s -b /path/to/branch
            -u user -p pass -j http://jenkins:8080
            -B saucy
            -D trusty'''),

Revision history for this message
Andy Doan (doanac) wrote :

I'm not a huge fan of how permutations was changed. Seems like it makes it easier to screw something up with a typo. We moved away from a similar approach in lp:ubuntu-test-cases/touch.

I have no objections if you like this way more though.

Revision history for this message
Paul Larson (pwlars) wrote :

What's up with main and universe? I know they take some additional hand-holding to get up and running, but I don't like commenting them out from the setup script. Default should be that they are ON, and if we need to work around them temporarily, that's fine. But I'm afraid if they are just commented out in the setup script, then they could be too easily forgotten in the future.

lp:~psivaa/utah/upgrade-setup-jobs updated
31. By Para Siva

Review comment fixes including using matrices

32. By Para Siva

Keeping local host as the default jenkins

Revision history for this message
Para Siva (psivaa) wrote :

Thanks for the comments, I've tried fixing the concerns in them. I have included to use explicit matrices for each type of upgrade jobs and that includes main and universe as well. Making the main and universe work still needs to be done in terms of creating the base install properly. That will be time consuming but that's on the list.

Note: I have not included a README, but that i'll do after doing some higher priority tasks.

Could you please look at the changes again. Thanks.

review: Needs Resubmitting
Revision history for this message
Paul Larson (pwlars) wrote :

Looks good, assuming you've tried it and jenkins doesn't complain.

review: Approve
Revision history for this message
Para Siva (psivaa) wrote :

Thanks Paul. Yes I was able to create jobs in jiufeng.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jenkins/config.xml.jinja2'
2--- jenkins/config.xml.jinja2 2013-05-30 19:48:23 +0000
3+++ jenkins/config.xml.jinja2 2013-11-04 10:17:11 +0000
4@@ -19,7 +19,6 @@
5 <throttleEnabled>false</throttleEnabled>
6 <throttleOption>project</throttleOption>
7 </hudson.plugins.throttleconcurrents.ThrottleJobProperty>
8- <hudson.plugins.build__publisher.ExternalProjectProperty/>
9 </properties>
10 <scm class="hudson.scm.NullSCM"/>
11 <assignedNode>{{node}}</assignedNode>
12@@ -27,7 +26,9 @@
13 <disabled>false</disabled>
14 <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
15 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
16- <triggers class="vector"/>
17+ <triggers class="vector">
18+{% block triggers %}{% endblock %}
19+ </triggers>
20 <concurrentBuild>false</concurrentBuild>
21 <builders>
22 <hudson.tasks.Shell>
23@@ -45,21 +46,40 @@
24 export PROVISION_RUNLIST=`pwd`/${BZRDIR}/{{provision_runlist}}
25 export RUNLIST=`pwd`/${BZRDIR}/{{runlist}}
26
27+PARAMS='-d --name upgrade-{{image_base}}-{{image_arch}}-{{install_type}} --skip-provisioning -n'
28+
29 rm -rf *
30 bzr branch ${BRANCH} ${BZRDIR}
31 ${BZRDIR}/jenkins/jenkins.sh
32 </command>
33 </hudson.tasks.Shell>
34+{% block builders %}{% endblock %}
35 </builders>
36 <publishers>
37 <hudson.tasks.ArtifactArchiver>
38 <artifacts>**/*</artifacts>
39 <latestOnly>false</latestOnly>
40 </hudson.tasks.ArtifactArchiver>
41+{% if publish %}
42 <hudson.plugins.build__publisher.BuildPublisher>
43 <publishUnstableBuilds>true</publishUnstableBuilds>
44 <publishFailedBuilds>true</publishFailedBuilds>
45 <postActions class="vector"/>
46 </hudson.plugins.build__publisher.BuildPublisher>
47+{% endif %}
48+{% block artifacts %}
49+ <hudson.tasks.ArtifactArchiver>
50+ <artifacts>**/*</artifacts>
51+ <latestOnly>false</latestOnly>
52+ </hudson.tasks.ArtifactArchiver>
53+{% endblock %}
54+{% block publishers %}{% endblock %}
55 </publishers>
56+ <buildWrappers>
57+ <EnvInjectBuildWrapper>
58+ <info>
59+ <loadFilesFromMaster>false</loadFilesFromMaster>
60+ </info>
61+ </EnvInjectBuildWrapper>
62+ </buildWrappers>
63 </project>
64
65=== added file 'jenkins/production.py'
66--- jenkins/production.py 1970-01-01 00:00:00 +0000
67+++ jenkins/production.py 2013-11-04 10:17:11 +0000
68@@ -0,0 +1,182 @@
69+# The configuration matrix of our production device testing
70+
71+LTS_DESKTOP_MATRIX = [
72+ {
73+ 'image_base': 'precise',
74+ 'image_dest': 'trusty',
75+ 'image_arch': 'i386',
76+ 'image_type': 'desktop',
77+ 'install_type': 'desktop',
78+ 'runlist': 'upgrade.run',
79+ 'provision_runlist': 'nothing.run',
80+ },
81+ {
82+ 'image_base': 'precise',
83+ 'image_dest': 'trusty',
84+ 'image_arch': 'amd64',
85+ 'image_type': 'desktop',
86+ 'install_type': 'desktop',
87+ 'runlist': 'upgrade.run',
88+ 'provision_runlist': 'nothing.run',
89+ },
90+]
91+
92+LTS_SERVER_MATRIX = [
93+ {
94+ 'image_base': 'precise',
95+ 'image_dest': 'trusty',
96+ 'image_arch': 'i386',
97+ 'image_type': 'server',
98+ 'install_type': 'server',
99+ 'runlist': 'upgrade.run',
100+ 'provision_runlist': 'nothing.run',
101+ },
102+ {
103+ 'image_base': 'precise',
104+ 'image_dest': 'trusty',
105+ 'image_arch': 'amd64',
106+ 'image_type': 'server',
107+ 'install_type': 'server',
108+ 'runlist': 'upgrade.run',
109+ 'provision_runlist': 'nothing.run',
110+
111+ },
112+]
113+
114+LTS_MAIN_MATRIX = [
115+ {
116+ 'image_base': 'precise',
117+ 'image_dest': 'trusty',
118+ 'image_arch': 'i386',
119+ 'image_type': 'server',
120+ 'install_type': 'main',
121+ 'runlist': 'upgrade.run',
122+ 'provision_runlist': 'main.run',
123+ },
124+ {
125+ 'image_base': 'precise',
126+ 'image_dest': 'trusty',
127+ 'image_arch': 'amd64',
128+ 'image_type': 'mini',
129+ 'install_type': 'main',
130+ 'runlist': 'upgrade.run',
131+ 'provision_runlist': 'main.run',
132+ },
133+]
134+
135+LTS_UNIVERSE_MATRIX = [
136+ {
137+ 'image_base': 'precise',
138+ 'image_dest': 'trusty',
139+ 'image_arch': 'i386',
140+ 'image_type': 'mini',
141+ 'install_type': 'universe',
142+ 'runlist': 'upgrade.run',
143+ 'provision_runlist': 'universe.run',
144+ },
145+ {
146+ 'image_base': 'precise',
147+ 'image_dest': 'trusty',
148+ 'image_arch': 'amd64',
149+ 'image_type': 'mini',
150+ 'install_type': 'universe',
151+ 'runlist': 'upgrade.run',
152+ 'provision_runlist': 'universe.run',
153+ },
154+]
155+
156+NON_LTS_DESKTOP_MATRIX = [
157+ {
158+ 'image_base': 'saucy',
159+ 'image_dest': 'trusty',
160+ 'image_arch': 'i386',
161+ 'image_type': 'desktop',
162+ 'install_type': 'desktop',
163+ 'runlist': 'upgrade.run',
164+ 'provision_runlist': 'nothing.run',
165+ },
166+ {
167+ 'image_base': 'saucy',
168+ 'image_dest': 'trusty',
169+ 'image_arch': 'amd64',
170+ 'image_type': 'desktop',
171+ 'install_type': 'desktop',
172+ 'runlist': 'upgrade.run',
173+ 'provision_runlist': 'nothing.run',
174+ },
175+]
176+
177+NON_LTS_SERVER_MATRIX = [
178+ {
179+ 'image_base': 'saucy',
180+ 'image_dest': 'trusty',
181+ 'image_arch': 'i386',
182+ 'image_type': 'server',
183+ 'install_type': 'server',
184+ 'runlist': 'upgrade.run',
185+ 'provision_runlist': 'nothing.run',
186+ },
187+ {
188+ 'image_base': 'saucy',
189+ 'image_dest': 'trusty',
190+ 'image_arch': 'amd64',
191+ 'image_type': 'server',
192+ 'install_type': 'server',
193+ 'runlist': 'upgrade.run',
194+ 'provision_runlist': 'nothing.run',
195+ },
196+]
197+
198+NON_LTS_MAIN_MATRIX = [
199+ {
200+ 'image_base': 'saucy',
201+ 'image_dest': 'trusty',
202+ 'image_arch': 'i386',
203+ 'image_type': 'mini',
204+ 'install_type': 'main',
205+ 'runlist': 'upgrade.run',
206+ 'provision_runlist': 'main.run',
207+ },
208+ {
209+ 'image_base': 'saucy',
210+ 'image_dest': 'trusty',
211+ 'image_arch': 'amd64',
212+ 'image_type': 'mini',
213+ 'install_type': 'main',
214+ 'runlist': 'upgrade.run',
215+ 'provision_runlist': 'main.run',
216+ },
217+]
218+
219+NON_LTS_UNIVERSE_MATRIX = [
220+ {
221+ 'image_base': 'saucy',
222+ 'image_dest': 'trusty',
223+ 'image_arch': 'i386',
224+ 'image_type': 'mini',
225+ 'install_type': 'universe',
226+ 'runlist': 'upgrade.run',
227+ 'provision_runlist': 'universe.run',
228+ },
229+ {
230+ 'image_base': 'saucy',
231+ 'image_dest': 'trusty',
232+ 'image_arch': 'amd64',
233+ 'image_type': 'mini',
234+ 'install_type': 'universe',
235+ 'runlist': 'upgrade.run',
236+ 'provision_runlist': 'universe.run',
237+ },
238+]
239+
240+
241+MATRIX = {
242+ 'lts_desktop': LTS_DESKTOP_MATRIX,
243+ 'non_lts_desktop': NON_LTS_DESKTOP_MATRIX,
244+ 'lts_server': LTS_SERVER_MATRIX,
245+ 'non_lts_server': NON_LTS_SERVER_MATRIX,
246+ 'lts_main': LTS_MAIN_MATRIX,
247+ 'non_lts_main': NON_LTS_MAIN_MATRIX,
248+ 'lts_universe': LTS_UNIVERSE_MATRIX,
249+ 'non_lts_universe': NON_LTS_UNIVERSE_MATRIX,
250+}
251
252=== modified file 'jenkins/setup_jenkins.py'
253--- jenkins/setup_jenkins.py 2013-05-30 19:48:23 +0000
254+++ jenkins/setup_jenkins.py 2013-11-04 10:17:11 +0000
255@@ -20,51 +20,26 @@
256 import jinja2
257 import logging
258 import os
259+import imp
260+import sys
261
262+from distro_info import UbuntuDistroInfo
263 from bzrlib.branch import Branch
264
265
266-DESKTOP = 'desktop'
267-SERVER = 'server'
268-MAIN = 'main'
269-UNIVERSE = 'universe'
270-
271-DEF_RUNLIST = 'upgrade.run'
272-PROVISION_RUNLISTS = {
273- DESKTOP: 'nothing.run',
274- SERVER: 'nothing.run',
275- MAIN: 'main.run',
276- UNIVERSE: 'universe.run',
277-}
278-
279-
280-def _job(image_base, image_dest, image_type, image_arch, runlist=DEF_RUNLIST):
281- job = {
282- 'image_base': image_base,
283- 'image_dest': image_dest,
284- 'image_type': image_type,
285- 'image_arch': image_arch,
286- 'install_type': image_type,
287- 'runlist': runlist,
288- 'provision_runlist': PROVISION_RUNLISTS[image_type]
289- }
290-
291- if image_type in (MAIN, UNIVERSE):
292- job['install_type'] = 'mini'
293- return job
294-
295-
296-# this defines all the upgrade permutations we intend to support
297-PERMUTATIONS = [
298- _job('raring', 'saucy', DESKTOP, 'amd64'),
299- _job('raring', 'saucy', SERVER, 'amd64'),
300- _job('raring', 'saucy', MAIN, 'amd64'),
301- _job('raring', 'saucy', UNIVERSE, 'amd64'),
302- _job('raring', 'saucy', DESKTOP, 'i386'),
303- _job('raring', 'saucy', SERVER, 'i386'),
304- _job('raring', 'saucy', MAIN, 'i386'),
305- _job('raring', 'saucy', UNIVERSE, 'i386'),
306-]
307+DEV_SERIES = UbuntuDistroInfo().devel()
308+
309+LTS_UPGRADE = ['lts_desktop',
310+ 'lts_server',
311+ 'lts_main',
312+ 'lts_universe']
313+
314+NON_LTS_UPGRADE = ['non_lts_desktop',
315+ 'non_lts_server',
316+ 'non_lts_main',
317+ 'non_lts_universe']
318+
319+SUPPORTED_UPGRADES = LTS_UPGRADE + NON_LTS_UPGRADE
320
321
322 def _get_parser():
323@@ -75,22 +50,45 @@
324
325 """
326 parser = argparse.ArgumentParser(
327- description='Create/Update upgrade testing jenkins jobs.')
328+ description=('Create/Update upgrade testing jenkins jobs.'),
329+ epilog=('''For example:\n
330+ %(prog)s -b /path/to/branch
331+ -u user -p pass -j http://jenkins:8080
332+ -t upgrade type (lts_desktop or non_lts_main etc.)
333+ -B saucy
334+ -D trusty'''),
335+ formatter_class=argparse.RawDescriptionHelpFormatter)
336+ parser.add_argument("-b", "--branches",
337+ help="Path(s) to branch(es) to process")
338 parser.add_argument("-d", "--dryrun", action="store_true",
339 help="Dry run mode. Don't execute jenkins commands.")
340- parser.add_argument("-u", "--username",
341- help="username to use when logging into Jenkins.")
342- parser.add_argument("-p", "--password",
343- help="username to use when logging into Jenkins")
344- parser.add_argument("-j", "--jenkins", default="http://10.98.0.1:8080/",
345- help="URL of jenkins instance to configure jobs in.")
346+ parser.add_argument("-t", "--type",
347+ help=("Type of upgrade lts or non lts "
348+ "(default=%(default)s)"))
349+ group = parser.add_argument_group('authentication arguments')
350+ group.add_argument("-u", "--username",
351+ help="Username to use when logging into Jenkins")
352+ group.add_argument("-p", "--password",
353+ help="Password to use when logging into Jenkins")
354+ parser.add_argument("-j", "--jenkins", default="http://127.0.0.1:8080/",
355+ help="URL of jenkins instance to configure test in")
356 parser.add_argument("-n", "--node", default="aldebaran",
357 help=("Jenkins node were the job should be executed "
358 "(default=%(default)s)"))
359+ parser.add_argument("-D", "--dest", default=DEV_SERIES,
360+ help=("Destination release to be upgraded to "
361+ "(default=%(default)s)"))
362+ parser.add_argument("-B", "--base",
363+ help=("Source release to be upgraded from"
364+ "(default=%(default)s)"))
365+ parser.add_argument("--publish", action="store_true",
366+ help=("Publish build results. "
367+ "This is useful to test job changes "
368+ "without overwriting the configuration."))
369 return parser
370
371
372-def _get_jenkins(url, username, password):
373+def _get_jenkins(url, username=None, password=None):
374 logging.info('Attempting to login to jenkins at %s', url)
375 if username is not None:
376 logging.info('...with authentication as user: %s', username)
377@@ -98,7 +96,6 @@
378 else:
379 logging.info('...without authentication')
380 instance = jenkins.Jenkins(url)
381-
382 return instance
383
384
385@@ -111,7 +108,7 @@
386
387
388 def _get_job_name(job_args):
389- fmt = 'upgrade-{image_base}-{image_arch}-{image_type}-{image_dest}'
390+ fmt = 'upgrade-{image_base}-{image_arch}-{install_type}-{image_dest}'
391 return fmt.format(**job_args)
392
393
394@@ -125,9 +122,12 @@
395 return b
396
397
398-def _configure_job(instance, env, node, job_args, dryrun):
399+def _configure_job(instance, env, node, publish, job_args, dryrun):
400 tmpl = env.get_template('config.xml.jinja2')
401- cfg = tmpl.render(node=node, branch=_get_branch(), **job_args)
402+ cfg = tmpl.render(node=node,
403+ branch=_get_branch(),
404+ publish=publish,
405+ **job_args)
406 jobname = _get_job_name(job_args)
407 if instance.job_exists(jobname):
408 logging.info('reconfiguring job %s', jobname)
409@@ -137,23 +137,35 @@
410 instance.create_job(jobname, cfg)
411
412
413-def _dryrun_func(jobname, config):
414- logging.debug(config)
415-
416-
417 def main():
418 logging.basicConfig(level=logging.DEBUG)
419 args = _get_parser().parse_args()
420
421- jenkins_inst = _get_jenkins(args.jenkins, args.username, args.password)
422+ # Check to make sure the right releases are intended
423+ if args.type in SUPPORTED_UPGRADES and args.dest != 'trusty':
424+ logging.debug('Destination release can only be trusty')
425+ sys.exit(1)
426+ if args.type in LTS_UPGRADE and args.base != 'precise':
427+ logging.debug('lts base release can only be precise')
428+ sys.exit(1)
429+ if args.type in NON_LTS_UPGRADE and args.base != 'saucy':
430+ logging.debug('non_lts base release can only be saucy')
431+ sys.exit(1)
432+
433+ instance = _get_jenkins(args.jenkins, args.username, args.password)
434+
435 if args.dryrun:
436- jenkins_inst.create_job = _dryrun_func
437- jenkins_inst.reconfig_job = _dryrun_func
438+ return True
439
440 env = _get_environment()
441-
442- for job_args in PERMUTATIONS:
443- _configure_job(jenkins_inst, env, args.node, job_args, args.dryrun)
444+ config = imp.load_source('', 'production.py')
445+ for item in config.MATRIX[args.type]:
446+ _configure_job(instance,
447+ env,
448+ args.node,
449+ args.publish,
450+ item,
451+ args.dryrun)
452
453 if __name__ == '__main__':
454 main()
455
456=== modified file 'upgrade/release_upgrade/tc_control'
457--- upgrade/release_upgrade/tc_control 2013-05-30 21:26:26 +0000
458+++ upgrade/release_upgrade/tc_control 2013-11-04 10:17:11 +0000
459@@ -5,6 +5,6 @@
460 expected_results: |
461 1. updates to latest development release
462 type: userland
463-timeout: 36000 # 10 hours
464+timeout: 10800 # 3 hours
465 command: RELEASE_UPGRADE_NO_FORCE_OVERWRITE=1 do-release-upgrade -d -f DistUpgradeViewNonInteractive
466 reboot: pass

Subscribers

People subscribed via source and target branches

to all changes: