Merge lp:~doanac/ubuntu-test-cases/apt-get-update-rerun into lp:ubuntu-test-cases/touch

Proposed by Andy Doan
Status: Needs review
Proposed branch: lp:~doanac/ubuntu-test-cases/apt-get-update-rerun
Merge into: lp:ubuntu-test-cases/touch
Diff against target: 274 lines (+170/-1)
6 files modified
jenkins/production.py (+1/-0)
jenkins/setup_jenkins.py (+24/-0)
jenkins/templates/touch-smoke-rerun.xml.jinja2 (+123/-0)
scripts/assert-image (+4/-0)
scripts/provision.sh (+10/-1)
scripts/run-smoke (+8/-0)
To merge this branch: bzr merge lp:~doanac/ubuntu-test-cases/apt-get-update-rerun
Reviewer Review Type Date Requested Status
Ubuntu Test Case Developers Pending
Review via email: mp+208458@code.launchpad.net

Description of the change

This adds support for a new "rerun" job. This job is identical to our smoke job except:

 * it doesn't publish results (or do live streaming)
 * it has an option, APT_GET_UPDATE, to allow running apt-get update after provisioning the device.

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

I think we need a parameter for revision also, and if specified we also pass --revison {rev} in IMAGE_OPTS

Was none of the xml in the rerun job something we could import from other template blocks? If not, fine. I was just wondering.

Also, I'm not sure we want to publish these anywhere on the dashboard do we?

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

On 02/26/2014 01:20 PM, Paul Larson wrote:
> I think we need a parameter for revision also, and if specified we also pass --revison {rev} in IMAGE_OPTS

I was thinking we could use the existing INSTALL_URL feature for that.
Is that okay, or should we try and add functionality for --rev (its not
currently supported in provision.sh)

> Was none of the xml in the rerun job something we could import from other template blocks? If not, fine. I was just wondering.

we don't really have template blocks for the smoke job anymore. maybe
its worth copying, but i thought it would be easier to prevent mistakes
this way (ie, not accidententally streaming live results to the dashboard).

> Also, I'm not sure we want to publish these anywhere on the dashboard do we?

The rerun template doesn't do any publishing.

Unmerged revisions

194. By Andy Doan

add a new "re-run" job

This job will show up like the smoke-daily, but have rerun on the end.
Its a non-publishing job and also includes an option to run
"apt-get upate" after provisioning the device.

193. By Andy Doan

provide a mechanism to perform apt-get update after provisioning device

We have a need for some one-off testing where an apt-get update call
is required.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jenkins/production.py'
2--- jenkins/production.py 2014-02-24 21:43:03 +0000
3+++ jenkins/production.py 2014-02-26 19:13:48 +0000
4@@ -31,6 +31,7 @@
5 {
6 'image-type': 'touch',
7 'include-qa': True,
8+ 'include-rerun': True,
9 'dashboard-host': 'ci.ubuntu.com',
10 'dashboard-port': '80',
11 'dashboard-user': 'doanac',
12
13=== modified file 'jenkins/setup_jenkins.py'
14--- jenkins/setup_jenkins.py 2014-01-10 00:22:13 +0000
15+++ jenkins/setup_jenkins.py 2014-02-26 19:13:48 +0000
16@@ -179,6 +179,27 @@
17 return job
18
19
20+def _configure_rerun_job(instance, env, args, config_item, device):
21+ defserial = '$(${BZRDIR}/scripts/get-adb-id ${NODE_NAME})'
22+
23+ params = {
24+ 'name': device['slave-label'],
25+ 'serial': device.get('serial', defserial),
26+ 'branch': args.branch,
27+ 'imagetype': config_item['image-type'],
28+ 'image_opt': config_item.get('IMAGE_OPT', ''),
29+ }
30+
31+ prefix = ""
32+ if(args.prefix):
33+ prefix = args.prefix + "-"
34+
35+ job = '{}{}-{}-{}-smoke-daily-rerun'.format(
36+ prefix, args.series, config_item['image-type'], device['name'])
37+ _publish(
38+ instance, env, args, 'touch-smoke-rerun.xml.jinja2', job, **params)
39+
40+
41 def _dryrun_func(jobname, config):
42 logging.debug(jobname)
43 logging.debug(config)
44@@ -209,5 +230,8 @@
45 jenkins_inst, env, args, item, device)
46 _configure_master(jenkins_inst, env, args, item, device, job, jobs)
47
48+ if item.get('include-rerun'):
49+ _configure_rerun_job(jenkins_inst, env, args, item, device)
50+
51 if __name__ == '__main__':
52 main()
53
54=== added file 'jenkins/templates/touch-smoke-rerun.xml.jinja2'
55--- jenkins/templates/touch-smoke-rerun.xml.jinja2 1970-01-01 00:00:00 +0000
56+++ jenkins/templates/touch-smoke-rerun.xml.jinja2 2014-02-26 19:13:48 +0000
57@@ -0,0 +1,123 @@
58+<?xml version='1.0' encoding='UTF-8'?>
59+<project>
60+ <actions/>
61+ <description>
62+<![CDATA[
63+This job provides a flexible way to execute a one-off non-published rerun
64+of a daily image.
65+The job is parameterized to give flexibility in what gets tested. A couple of
66+common ways to run this job are:
67+<dl>
68+ <dt>Full Test Run</dt>
69+ <dd>TESTS=ALL</dd>
70+ <dd>APPS=ALL</dd>
71+ <dd>PACKAGES=ALL</dd>
72+ <dd>APT_GET_UPDATE=1</dd>
73+ <dt>Re-run a Failed Autopilot Test</dt>
74+ <dd>INSTALL_URL=http://dev-jenkins:8080/job/saucy-touch_ro-mako/9</dd>
75+ <dd>APPS=friends_app</dd>
76+ <dt>Re-run a Failed UTAH Test</dt>
77+ <dd>INSTALL_URL=http://dev-jenkins:8080/job/saucy-touch_ro-mako/9</dd>
78+ <dd>TESTS=security</dd>
79+</dl>
80+<pre>
81+#NOTE: Automatically created from a script as part of daily smoke testing
82+ {{branch}}
83+</pre>
84+]]>
85+ </description>
86+ <keepDependencies>false</keepDependencies>
87+ <properties>
88+ <hudson.model.ParametersDefinitionProperty>
89+ <parameterDefinitions>
90+ <hudson.model.StringParameterDefinition>
91+ <name>INSTALL_URL</name>
92+ <description>A URL to the previous job. If provided this job will use the same install options as it used. If the device executing the job happens to have the exact same image, then provisioning can be skipped.
93+ </description>
94+ <defaultValue></defaultValue>
95+ </hudson.model.StringParameterDefinition>
96+ <hudson.model.StringParameterDefinition>
97+ <name>APT_GET_UPDATE</name>
98+ <description>run apt-get update after provisioning the device
99+ </description>
100+ <defaultValue></defaultValue>
101+ </hudson.model.StringParameterDefinition>
102+ <hudson.model.StringParameterDefinition>
103+ <name>TESTS</name>
104+ <description>A space separated list of utah tests to run. "ALL" can be used to run all known utah tests.
105+ </description>
106+ <defaultValue>ALL</defaultValue>
107+ </hudson.model.StringParameterDefinition>
108+ <hudson.model.StringParameterDefinition>
109+ <name>APPS</name>
110+ <description>A space separated list of autopilot tests to run. "ALL" can be used to run all known tests.
111+ </description>
112+ <defaultValue>ALL</defaultValue>
113+ </hudson.model.StringParameterDefinition>
114+ <hudson.model.StringParameterDefinition>
115+ <name>PACKAGES</name>
116+ <description>A space separated list of packages required by autopilot tests. "ALL" can be used to install all known packages required.
117+ </description>
118+ <defaultValue>ALL</defaultValue>
119+ </hudson.model.StringParameterDefinition>
120+ </parameterDefinitions>
121+ </hudson.model.ParametersDefinitionProperty>
122+ <com.sonyericsson.rebuild.RebuildSettings>
123+ <autoRebuild>false</autoRebuild>
124+ </com.sonyericsson.rebuild.RebuildSettings>
125+ </properties>
126+ <scm class="hudson.scm.NullSCM"/>
127+ <assignedNode>{{ name }}</assignedNode>
128+ <canRoam>false</canRoam>
129+ <disabled>false</disabled>
130+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
131+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
132+ <triggers class="vector"/>
133+ <concurrentBuild>true</concurrentBuild>
134+ <builders>
135+ <hudson.tasks.Shell>
136+ <command>set -e
137+BRANCH=&quot;{{branch}}&quot;
138+BZRDIR=`echo &quot;$BRANCH&quot; | awk -F/ &apos;{ print $(NF) }&apos;`
139+BZRDIR=$(readlink -f $BZRDIR)
140+[ -d $BZRDIR ] &amp;&amp; rm -rf $BZRDIR
141+bzr branch ${BRANCH} ${BZRDIR}
142+
143+export ANDROID_SERIAL={{serial}}
144+export IMAGE_TYPE={{imagetype}}
145+
146+{{image_opt}}
147+${BZRDIR}/scripts/run-smoke
148+ </command>
149+ </hudson.tasks.Shell>
150+ </builders>
151+ <publishers>
152+ <hudson.tasks.ArtifactArchiver>
153+ <artifacts>clientlogs/**</artifacts>
154+ <latestOnly>false</latestOnly>
155+ </hudson.tasks.ArtifactArchiver>
156+ <hudson.tasks.junit.JUnitResultArchiver>
157+ <testResults>clientlogs/**/*.xml</testResults>
158+ <keepLongStdio>true</keepLongStdio>
159+ <testDataPublishers>
160+ <hudson.plugins.junitattachments.AttachmentPublisher/>
161+ </testDataPublishers>
162+ </hudson.tasks.junit.JUnitResultArchiver>
163+ <hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
164+ <regexp>^= TOUCH IMAGE VERSION:([0-9]+.*)</regexp>
165+ <regexpForFailed>^= TOUCH IMAGE VERSION:([0-9]+.*)</regexpForFailed>
166+ <setForMatrix>false</setForMatrix>
167+ </hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
168+ </publishers>
169+ <buildWrappers>
170+ <hudson.plugins.build__timeout.BuildTimeoutWrapper>
171+ <timeoutMinutes>300</timeoutMinutes>
172+ <failBuild>true</failBuild>
173+ <writingDescription>false</writingDescription>
174+ <timeoutPercentage>0</timeoutPercentage>
175+ <timeoutType>absolute</timeoutType>
176+ <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault>
177+ </hudson.plugins.build__timeout.BuildTimeoutWrapper>
178+ </buildWrappers>
179+</project>
180+
181
182=== modified file 'scripts/assert-image'
183--- scripts/assert-image 2014-02-10 16:18:04 +0000
184+++ scripts/assert-image 2014-02-26 19:13:48 +0000
185@@ -24,5 +24,9 @@
186 echo $REQUIRED_UUID > clientlogs/.ci-uuid
187 curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-args > clientlogs/.ci-flash-args
188 curl ${INSTALL_URL}/artifact/clientlogs/.ci-customizations > clientlogs/.ci-customizations
189+ if [ -n "$APT_GET_UPDATE" ] ; then
190+ echo "= RUNNING apt-get update on target"
191+ adb shell apt-get update
192+ fi
193 fi
194
195
196=== modified file 'scripts/provision.sh'
197--- scripts/provision.sh 2014-02-25 02:52:34 +0000
198+++ scripts/provision.sh 2014-02-26 19:13:48 +0000
199@@ -26,6 +26,7 @@
200 -P add the ppa to the target (can be repeated)
201 -p add the package to the target (can be repeated)
202 -w make the system writeable (implied with -p and -P arguments)
203+ -u perform "apt-get update" after provisioning
204
205 EOF
206 }
207@@ -53,7 +54,7 @@
208 echo = $(date): $*
209 }
210
211-while getopts i:s:n:P:p:wh opt; do
212+while getopts i:s:n:P:p:wuh opt; do
213 case $opt in
214 h)
215 usage
216@@ -78,6 +79,9 @@
217 p)
218 CUSTOMIZE="$CUSTOMIZE -p $OPTARG"
219 ;;
220+ u)
221+ APT_GET_UPDATE=1
222+ ;;
223 esac
224 done
225
226@@ -129,3 +133,8 @@
227 # Make sure whoopsie-upload-all can work (bug #1245524)
228 adb shell "sed -i '/Waiting for whoopsie/ a\ subprocess.call([\"restart\", \"whoopsie\"])' /usr/share/apport/whoopsie-upload-all"
229 fi
230+
231+if [ -n "$APT_GET_UPDATE" ] ; then
232+ log "RUNNING apt-get update on target"
233+ adb shell apt-get update
234+fi
235
236=== modified file 'scripts/run-smoke'
237--- scripts/run-smoke 2014-02-07 23:05:01 +0000
238+++ scripts/run-smoke 2014-02-26 19:13:48 +0000
239@@ -77,6 +77,9 @@
240 help='''Image type being tested. This can be changed
241 to 'touch_sf4p' so that SurfaceFlinger will be used
242 instead of Mir. default=%(default)s''')
243+ parser.add_argument('--apt-get-update', '-u', action='store_true',
244+ help='''Perform and apt-get update after provisioning
245+ the device.''')
246 return parser
247
248
249@@ -103,6 +106,7 @@
250 _arg_from_env(args, 'image_opt', 'IMAGE_OPT', False)
251 _arg_from_env(args, 'image_type', 'IMAGE_TYPE', False)
252 _arg_from_env(args, 'install_url', 'INSTALL_URL', False)
253+ _arg_from_env(args, 'apt_get_update', 'APT_GET_UPDATE', False)
254
255
256 def _assert_args(args):
257@@ -181,6 +185,8 @@
258 def _assert_image(args):
259 log.info('checking if device has proper image ...')
260 os.environ['INSTALL_URL'] = args.install_url
261+ if args.apt_get_update:
262+ os.environ['APT_GET_UPDATE'] = '1'
263 _run([os.path.join(script_dir, 'assert-image')])
264
265
266@@ -251,6 +257,8 @@
267
268 cargs = [os.path.join(script_dir, 'provision.sh'), '-i', args.image_type]
269
270+ if args.apt_get_update:
271+ cargs.append('-u')
272 if args.package:
273 for p in args.package:
274 cargs.extend(['-p', p])

Subscribers

People subscribed via source and target branches