Merge lp:~fgiff/linaro-android-build-tools/linaro-android-connect-android-build-to-lava into lp:linaro-android-build-tools

Proposed by Frans Gifford
Status: Superseded
Proposed branch: lp:~fgiff/linaro-android-build-tools/linaro-android-connect-android-build-to-lava
Merge into: lp:linaro-android-build-tools
Diff against target: 119 lines (+107/-0)
2 files modified
build-scripts/build-android (+5/-0)
build-scripts/post-build-lava.py (+102/-0)
To merge this branch: bzr merge lp:~fgiff/linaro-android-build-tools/linaro-android-connect-android-build-to-lava
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle (community) Approve
James Westby (community) Approve
Paul Sokolovsky Approve
Zach Pfeffer Pending
Paul Larson Pending
Alexander Sack Pending
Review via email: mp+67074@code.launchpad.net

This proposal has been superseded by a proposal from 2011-07-26.

Description of the change

Connect the Android Builder to LAVA

To post a comment you must log in.
Revision history for this message
Frans Gifford (fgiff) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 reviewer pfefferz
 reviewer plars
 reviewer asac
 reviewer mwhudson
 reviewer james-w
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOFLjuAAoJEAeFjc2hVnFUUQYIANMRXQ6uQXGEtf0p85a0d1Lv
2WAEZvQt1Fmv3ty3x9MH9DJmss8q92Et3hiOMR/tgVzLqpJdgMF6S3+5DkOst43u
MjnhkXi74PLpAskUmr9SRn3cKWPASzQ8z2PEVmMQQ2nyDUPcLU/OVjYYH9//lpwF
6rid9k9D2UukbVieWyV8wLntm66CoJMFhifyyitt9MFZqdoLp/soOdGFVPq5iLvs
1PtTrYbaENya1GXx4onW1mbetjQkbKmjcyS+bd7RJmj5iY4RfLTlxDwIO/yxxzT1
wTuXrvhBBt60XwPRKCxxqYcjDXPcUQ2S41fY51dyDWeKqrea/B2PZ4sGZFkJPwU=
=iRKu
-----END PGP SIGNATURE-----

Revision history for this message
James Westby (james-w) wrote :

18 + if job_name == "linaro-android_leb-panda":

I would think that this would be better using TARGET_PRODUCT wouldn't it?

That way we don't have to edit the script for every job added.

It would mean basing the stream name on the job name as I suggested, but I don't
know if Paul L. thinks that's a good idea.

30 + "job_name": "''' + build_url + '''",

You might prefer string interpolation rather than concatenation:

  print """{"job_name": "%(build_url)s"}""" % dict(build_url=build_url)

or to do it using the json module:

  import json
  config = {"job_name": build_url}
  print json.dumps(config)

I think that they will be a bit easier to modify, and this is going to
see plenty of modifications.

Up to you though.

Lastly convention is for four space indent rather than two.

Thanks,

James

review: Approve
Revision history for this message
James Westby (james-w) wrote :

Oh, and I think there should be a toggle so that we can turn off submission if we want
to while testing. That should maybe be decided by the caller though?

Thanks,

James

Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

I agree about usage of json module. My idea was also that this script should take values it needs from the environment, not on command line, then it would be more flexible. For example, regarding toggle James talks about - I guess, for starters, we'd want to enable submission feature just for few selected jobs, so the script could check for LAVA_SUBMIT=1 var. Later, we may want to have it enabled by default and have switch to disable it instead. This all can be done in the script itself.

Anyway, current idea is to provide you with a sandbox, where you can test/tweak such integration issues (more info in email).

review: Approve
283. By Frans Gifford

Interim checkin

284. By Frans Gifford

Using JSON module

285. By Frans Gifford

Added LAVA_SUBMIT env flag

286. By Frans Gifford

Added LAVA_SUBMIT env flag

Revision history for this message
Frans Gifford (fgiff) wrote :

OK, I've updated to:

 use the JSON module.
 use a LAVA_SUBMIT environment variable to toggle output.
 read environment variables from env instead of command line.
 use 4-space indent.

I'll try it out in the sandbox now.

Revision history for this message
James Westby (james-w) wrote :

72 + if os.environ.get("LAVA_SUBMIT") > 0:
73 + main()

I think you need to wrap the get in an int() to get LAVA_SUBMIT=0 to work,
as it returns a string.

I think this is ok to land and hook in to the build.

Thanks,

James

review: Approve
Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

On Thu, 07 Jul 2011 14:56:37 -0000
James Westby <email address hidden> wrote:

> I think this is ok to land and hook in to the build.

I've created ec2-184-73-120-120.compute-1.amazonaws.com sandbox for
Frans to use, and it is set up to fetch binutils from his branch. So, I
guess it makes sense to let him do complete integration work (up to
some milestone of course) in his branch (he can test it right away), and
then merge it, so I skip merging this patch now.

--
Best Regards,
Paul

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I share the concern that defining the mapping between thing that was built and the tests to run and the stream to submit to by hardcoding it in this file is not that great, but we don't really have anything else yet and it's easy to change to something better later. Otherwise, looks fine enough to me.

review: Approve
287. By Frans Gifford

Call post-build-lava.py from build-script.
Base stream and board on target_product, not job.

288. By Frans Gifford

Update path to post-build-lava.py

289. By Frans Gifford

Add some logging

290. By Frans Gifford

See if build server dislikes test syntax

291. By Frans Gifford

Debugging

292. By Frans Gifford

Remove redundant path separator.

293. By Frans Gifford

Updated syntax for 0xbench to conform to https://wiki.linaro.org/Platform/Validation/LAVA/Documentation

294. By Frans Gifford

Added call into LAVA

295. By Frans Gifford

Adding call to LAVA

296. By Frans Gifford

Fix bug if LAVA_SERVER not specified

297. By Frans Gifford

Fixed up lava submission

298. By Frans Gifford

Submit to lava from python and add beagleboard

299. By Frans Gifford

Removed testing placeholders

300. By Frans Gifford

Syntax cleanup

301. By Frans Gifford

Use files on server to authenticate to lava rather than environment vars

302. By Frans Gifford

Use device_type so validation can load balance boards

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build-scripts/build-android'
2--- build-scripts/build-android 2011-06-03 16:29:06 +0000
3+++ build-scripts/build-android 2011-07-26 13:34:55 +0000
4@@ -51,3 +51,8 @@
5 toolchain-build/build-sysroot.sh out/target/product/`ls -1 out/target/product | head -n1` /tmp/sysroot
6 tar -cj -C /tmp/sysroot -f out/sysroot.tar.bz2 .
7 fi
8+
9+if test -n "$LAVA_SUBMIT"; then
10+ "${BUILD_SCRIPT_ROOT}"/post-build-lava.py
11+fi
12+
13
14=== added file 'build-scripts/post-build-lava.py'
15--- build-scripts/post-build-lava.py 1970-01-01 00:00:00 +0000
16+++ build-scripts/post-build-lava.py 2011-07-26 13:34:55 +0000
17@@ -0,0 +1,102 @@
18+#!/usr/bin/env python
19+import os
20+import json
21+import xmlrpclib
22+
23+def main():
24+ """Script entry point: return some JSON based on calling args.
25+ We should be called from Jenkins and expect the following to
26+ be defined: $TARGET_PRODUCT $JOB_NAME $BUILD_NUMBER $BUILD_URL"""
27+
28+ # Target product name, user defined, e.g. pandaboard
29+ target_product=os.environ.get("TARGET_PRODUCT")
30+ # Job name, defined by android-build, e.g. linaro-android_leb-panda
31+ job_name=os.environ.get("JOB_NAME")
32+ # Build number, defined by android-build, e.g. 61
33+ build_number=os.environ.get("BUILD_NUMBER")
34+ # Build url, defined by android-build, e.g.
35+ # https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/
36+ build_url=os.environ.get("BUILD_URL")
37+ test_plan=os.environ.get("LAVA_TEST_PLAN")
38+ if test_plan == None:
39+ test_plan="test_android_0xbench"
40+
41+ # Board-specific parameters
42+ if target_product == "pandaboard":
43+ # Board to test on. Let validation worry about load balancing.
44+ # TODO: Validation are working on removing the need for this parameter.
45+ test_target="panda01"
46+ test_stream="/anonymous/android-daily/"
47+ elif target_product == "beagleboard":
48+ test_target="beaglexm01"
49+ test_stream="/anonymous/android-daily/"
50+ #elif target_product == ---> Add other boards here
51+ else:
52+ #TODO: We don't know how to test this job, so skip testing.
53+ print "Don't know how to test this board. Skip testing."
54+ return
55+
56+ config = json.dumps( { "job_name": build_url,
57+ "image_type": "android",
58+ "target": test_target,
59+ "timeout": 18000,
60+ "actions": [
61+ {
62+ "command": "deploy_linaro_android_image",
63+ "parameters":
64+ {
65+ "boot":
66+build_url + "artifact/build/out/target/product/" + target_product + "/boot.tar.bz2",
67+ "system":
68+build_url + "artifact/build/out/target/product/" + target_product + "/system.tar.bz2",
69+ "data":
70+build_url + "artifact/build/out/target/product/" + target_product + "/userdata.tar.bz2"
71+ },
72+ "metadata":
73+ {
74+ "android.name": job_name,
75+ "android.build": build_number,
76+ "android.url": build_url
77+ }
78+ },
79+ {
80+ "command": "boot_linaro_android_image"
81+ },
82+ {
83+ "command": test_plan
84+ },
85+ {
86+ "command": "submit_results",
87+ "parameters":
88+ {
89+ "result_disk": "sdcard",
90+ "server": "http://validation.linaro.org/lava-server/dashboard",
91+ "stream": test_stream
92+ }
93+ }
94+ ]
95+}, indent=4)
96+
97+ print config
98+ lava_user=os.environ.get("LAVA_USER")
99+ if lava_user == None:
100+ print "ERROR: No LAVA_USER specified."
101+ return
102+
103+ lava_token=os.environ.get("LAVA_TOKEN")
104+ if lava_token == None:
105+ print "ERROR: No LAVA_TOKEN specified."
106+ return
107+
108+ lava_server=os.environ.get("LAVA_SERVER")
109+ if lava_server == None:
110+ lava_server="validation.linaro.org/lava-server/RPC2/"
111+
112+ server = xmlrpclib.ServerProxy("https://%(lava_user)s:%(lava_token)s@%(lava_server)s" % \
113+ dict(lava_user=lava_user, lava_token=lava_token, lava_server=lava_server))
114+ server.scheduler.submit_job(config)
115+
116+if __name__ == "__main__":
117+ if os.environ.get("LAVA_SUBMIT") > 0:
118+ main()
119+

Subscribers

People subscribed via source and target branches