Merge lp:~milo/linaro-ci/bug1090416 into lp:linaro-ci

Proposed by Milo Casagrande
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 123
Merged at revision: 128
Proposed branch: lp:~milo/linaro-ci/bug1090416
Merge into: lp:linaro-ci
Diff against target: 344 lines (+141/-122)
5 files modified
get_latest_ci_hwpack (+122/-111)
jenkins_common_lib (+1/-1)
jenkins_kernel_build_inst (+9/-4)
jenkins_lava_job_submissions (+6/-3)
jenkins_packaged_kernel_build_inst (+3/-3)
To merge this branch: bzr merge lp:~milo/linaro-ci/bug1090416
Reviewer Review Type Date Requested Status
James Tunnicliffe (community) Approve
Deepti B. Kalakeri (community) Needs Fixing
Review via email: mp+140215@code.launchpad.net

Commit message

Support sending LAVA jobs to multiple boards.

Description of the change

The branch adds support for sending multiple jobs to LAVA to different boards, from the same CI job.

It introduces a new env variable: board_types.
The old one can still be used in the CI jobs, but the new one will be exported, and it will be used looping through the defined boards.

Multiple boards have to be written comma separated.

To post a comment you must log in.
Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :

283 +elif test -n "$boards" -a -n "$board_type"; then
284 + board_types="$board_types,$board_type"

Typo error: elseif needs to be "elif test -n "$board_types" -a -n "$board_type"; than the above
between, I don't know why would anyone want to define board_types and board_type together in a job, instead if someone needed to define multiple board_types then they could just use board_types param or if they needed single board testing then they can use only board_type. I feel they are compliment params.

review: Needs Fixing
Revision history for this message
Milo Casagrande (milo) wrote :

On Fri, Dec 21, 2012 at 12:34 PM, Deepti B. Kalakeri
<email address hidden> wrote:
> Review: Needs Fixing
>
> 283 +elif test -n "$boards" -a -n "$board_type"; then
> 284 + board_types="$board_types,$board_type"
>
> Typo error: elseif needs to be "elif test -n "$board_types" -a -n "$board_type"; than the above
> between, I don't know why would anyone want to define board_types and board_type together in a job, instead if someone needed to define multiple board_types then they could just use board_types param or if they needed single board testing then they can use only board_type. I feel they are compliment params.

They are, or well should be: just one of them should be defined in the
job. Actually, it has been done in that way, introducing
'board_types', not to drop support for all the jobs that are already
using 'board_type'. Or we could just use 'board_type' even for
multiple boards.
All the if-elif code is just for using 'board_types' in the script,
and looping other it, instead of exporting both of them and having to
test which one is defined or not later.

--
Milo Casagrande
Infrastructure Engineer
Linaro.org <www.linaro.org> │ Open source software for ARM SoCs

lp:~milo/linaro-ci/bug1090416 updated
122. By Milo Casagrande

Fixed wrong env variable name.

123. By Milo Casagrande

Merged from trunk.

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Looks good. I wish the diff viewer could show "the indentation changed on this bit" though!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'get_latest_ci_hwpack'
2--- get_latest_ci_hwpack 2012-08-27 08:23:44 +0000
3+++ get_latest_ci_hwpack 2012-12-21 15:41:20 +0000
4@@ -3,119 +3,130 @@
5 Generate a job definition from a template using the latest hwpack and rootfs
6 of specified types.
7 """
8-import os, sys
9+import os
10+import sys
11 import re
12 import json
13 from find_latest import find_latest_rootfs, find_ci_latest
14
15-hwpacktype = os.getenv("HWPACK_TYPE", "unknown")
16-imagetype = os.getenv("ROOTFS_TYPE", "unknown")
17-job_name = os.getenv("KERNEL_JOB_NAME", "unknown") + '_' + \
18- os.getenv("HWPACK_BUILD_DATE", "unknown") + '_daily test'
19-
20-testplan = os.getenv("LAVA_TEST_PLAN", "ltp, pwrmgmt")
21-osdevicetags = os.getenv("DEVICE_TAGS", "none")
22-
23-template = {
24- "timeout": 20000,
25- "actions": [
26- {
27- "command": "deploy_linaro_image"
28- },
29- {
30- "command": "boot_linaro_image"
31- },
32- {
33- "command": "submit_results",
34- "parameters": {
35- "stream": os.getenv("BUNDLE_STREAM_NAME", "/anonymous/plars/"),
36- "server": "http://validation.linaro.org/lava-server/RPC2/"
37- }
38+
39+def main(board):
40+ if not board:
41+ board = 'unknown'
42+
43+ hwpacktype = os.getenv("HWPACK_TYPE", "unknown")
44+ imagetype = os.getenv("ROOTFS_TYPE", "unknown")
45+ job_name = os.getenv("KERNEL_JOB_NAME", "unknown") + '_' + \
46+ os.getenv("HWPACK_BUILD_DATE", "unknown") + '_daily test'
47+
48+ testplan = os.getenv("LAVA_TEST_PLAN", "ltp, pwrmgmt")
49+ osdevicetags = os.getenv("DEVICE_TAGS", "none")
50+
51+ template = {
52+ "timeout": 20000,
53+ "actions": [
54+ {
55+ "command": "deploy_linaro_image"
56+ },
57+ {
58+ "command": "boot_linaro_image"
59+ },
60+ {
61+ "command": "submit_results",
62+ "parameters": {
63+ "stream": os.getenv("BUNDLE_STREAM_NAME", "/anonymous/plars/"),
64+ "server": "http://validation.linaro.org/lava-server/RPC2/"
65+ }
66+ }
67+ ],
68+ "job_name": job_name,
69+ "device_type": board
70 }
71- ],
72- "job_name": job_name,
73- "device_type": os.getenv("BOARD_TYPE", "unknown")
74-}
75-
76-if osdevicetags != "none":
77- devicetags = osdevicetags.split(',')
78- template["device_tags"] = devicetags
79-
80-url=os.getenv("JOB_URL", "http://snapshots.linaro.org/kernel-hwpack/")
81-hwpack_parent_url=os.getenv("KERNEL_NAME","unknown")
82-hwpack_dir_url=os.getenv("KERNEL_JOB_NAME", "unknown")
83-hwpack_url_path = os.path.join(url, hwpack_parent_url)
84-hwpack_url_path = os.path.join(hwpack_url_path, hwpack_dir_url)
85-
86-latest_hwpack = os.getenv('HWPACK_NAME', 'unknown')
87-hwpack_url = find_ci_latest(hwpack_url_path, latest_hwpack)
88-if hwpack_url == None:
89- sys.exit(1)
90-rootfs_url = find_latest_rootfs(imagetype)
91-rootfs_name, rootfsdate, rootfsbuild = os.path.basename(rootfs_url).\
92- rsplit(".", 2)[0].rsplit("-", 2)
93-
94-deploy_params = { 'hwpack':hwpack_url, 'rootfs':rootfs_url }
95-template['actions'][0]['parameters'] = deploy_params
96-
97-metadata = {}
98-hwpack_filename = os.path.basename(hwpack_url)
99-hwpackdate, hwpackbuild = hwpack_filename.rsplit('_', 4)[1].split('-')
100-metadata['git_url'] = os.getenv("KERNEL_GIT", "git://git.linaro.org/kernel/unknown")
101-metadata['kernel.gitweb_url'] = os.getenv("GIT_WEB_URL", "unknown")
102-metadata['git_commitid'] = os.getenv("KERNEL_COMMIT", "unknown")
103-metadata['kernel_name'] = os.getenv("KERNEL_NAME", "unknown")
104-metadata['kernel_version'] = os.getenv("KERNEL_VERSION", "unknown")
105-metadata['build.id'] = os.getenv("BUILD_ID", "unknown")
106-metadata['kernel.config'] = os.getenv('KERNEL_CONFIG', 'unknown')
107-metadata['kernel.build_url'] = os.getenv("KERNEL_BUILD_URL", "unknown")
108-metadata['kernel.git_branch_name'] = os.getenv("KERNEL_BRANCH", "unknown")
109-metadata['kernel.git_log_info'] = os.getenv("GIT_LOG", "unknown")
110-metadata['hwpack.type'] = hwpacktype
111-metadata['hwpack.date'] = hwpackdate
112-
113-metadata['rootfs.type'] = imagetype
114-metadata['rootfs.date'] = rootfsdate
115-metadata['rootfs.build'] = rootfsbuild
116-
117-template['actions'][0]['metadata'] = metadata
118-
119-testcases = testplan.split(',')
120-testcases = [tc.strip() for tc in testplan.split(',')]
121-regex = re.compile("(?P<testcase>^\w+)(\((?P<options>[^\)]+)\))?"\
122- "(:(?P<timeout>\d+))?")
123-
124-# Dict for lava_test_install
125-lava_test_install_command = {}
126-lava_test_install_command["command"] = "lava_test_install"
127-lava_test_install_command["parameters"] = { "tests" : [], "timeout" : 4000 }
128-
129-# The positions in the template dict to insert test install/run commands
130-install_cmd_pos = 1
131-run_cmd_pos = 2
132-
133-for testcase in testcases:
134- r = regex.search(testcase)
135- if r.group("testcase") != None:
136- lava_test_install_command["parameters"]["tests"].\
137- append(r.group("testcase"))
138-
139- # append lava_test_run commands
140- timeout = 4800
141- if r.group('timeout'):
142- timeout = r.group('timeout')
143-
144- lava_test_run_command = {}
145- lava_test_run_command["command"] = "lava_test_run"
146- lava_test_run_command["parameters"] = {"test_name" : r.group('testcase'),
147- "timeout" : timeout }
148-
149- if r.group("options"):
150- lava_test_run_command["parameters"]["test_options"] = r.group("options")
151-
152- template['actions'].insert(run_cmd_pos, lava_test_run_command)
153- run_cmd_pos = run_cmd_pos + 1
154-
155-# append the lava test install command
156-template['actions'].insert(install_cmd_pos, lava_test_install_command)
157-print json.dumps(template, indent=2)
158+
159+ if osdevicetags != "none":
160+ devicetags = osdevicetags.split(',')
161+ template["device_tags"] = devicetags
162+
163+ url = os.getenv("JOB_URL", "http://snapshots.linaro.org/kernel-hwpack/")
164+ hwpack_parent_url = os.getenv("KERNEL_NAME", "unknown")
165+ hwpack_dir_url = os.getenv("KERNEL_JOB_NAME", "unknown")
166+ hwpack_url_path = os.path.join(url, hwpack_parent_url)
167+ hwpack_url_path = os.path.join(hwpack_url_path, hwpack_dir_url)
168+
169+ latest_hwpack = os.getenv('HWPACK_NAME', 'unknown')
170+ hwpack_url = find_ci_latest(hwpack_url_path, latest_hwpack)
171+ if hwpack_url == None:
172+ sys.exit(1)
173+ rootfs_url = find_latest_rootfs(imagetype)
174+ rootfs_name, rootfsdate, rootfsbuild = os.path.basename(rootfs_url).\
175+ rsplit(".", 2)[0].rsplit("-", 2)
176+
177+ deploy_params = {'hwpack': hwpack_url, 'rootfs': rootfs_url}
178+ template['actions'][0]['parameters'] = deploy_params
179+
180+ metadata = {}
181+ hwpack_filename = os.path.basename(hwpack_url)
182+ hwpackdate, hwpackbuild = hwpack_filename.rsplit('_', 4)[1].split('-')
183+ metadata['git_url'] = os.getenv("KERNEL_GIT", "git://git.linaro.org/kernel/unknown")
184+ metadata['kernel.gitweb_url'] = os.getenv("GIT_WEB_URL", "unknown")
185+ metadata['git_commitid'] = os.getenv("KERNEL_COMMIT", "unknown")
186+ metadata['kernel_name'] = os.getenv("KERNEL_NAME", "unknown")
187+ metadata['kernel_version'] = os.getenv("KERNEL_VERSION", "unknown")
188+ metadata['build.id'] = os.getenv("BUILD_ID", "unknown")
189+ metadata['kernel.config'] = os.getenv('KERNEL_CONFIG', 'unknown')
190+ metadata['kernel.build_url'] = os.getenv("KERNEL_BUILD_URL", "unknown")
191+ metadata['kernel.git_branch_name'] = os.getenv("KERNEL_BRANCH", "unknown")
192+ metadata['kernel.git_log_info'] = os.getenv("GIT_LOG", "unknown")
193+ metadata['hwpack.type'] = hwpacktype
194+ metadata['hwpack.date'] = hwpackdate
195+
196+ metadata['rootfs.type'] = imagetype
197+ metadata['rootfs.date'] = rootfsdate
198+ metadata['rootfs.build'] = rootfsbuild
199+
200+ template['actions'][0]['metadata'] = metadata
201+
202+ testcases = testplan.split(',')
203+ testcases = [tc.strip() for tc in testplan.split(',')]
204+ regex = re.compile("(?P<testcase>^\w+)(\((?P<options>[^\)]+)\))?"\
205+ "(:(?P<timeout>\d+))?")
206+
207+ # Dict for lava_test_install
208+ lava_test_install_command = {}
209+ lava_test_install_command["command"] = "lava_test_install"
210+ lava_test_install_command["parameters"] = {"tests": [], "timeout": 4000}
211+
212+ # The positions in the template dict to insert test install/run commands
213+ install_cmd_pos = 1
214+ run_cmd_pos = 2
215+
216+ for testcase in testcases:
217+ r = regex.search(testcase)
218+ if r.group("testcase") != None:
219+ lava_test_install_command["parameters"]["tests"].\
220+ append(r.group("testcase"))
221+
222+ # append lava_test_run commands
223+ timeout = 4800
224+ if r.group('timeout'):
225+ timeout = r.group('timeout')
226+
227+ lava_test_run_command = {}
228+ lava_test_run_command["command"] = "lava_test_run"
229+ lava_test_run_command["parameters"] = {"test_name": r.group('testcase'),
230+ "timeout": timeout}
231+
232+ if r.group("options"):
233+ lava_test_run_command["parameters"]["test_options"] = r.group("options")
234+
235+ template['actions'].insert(run_cmd_pos, lava_test_run_command)
236+ run_cmd_pos = run_cmd_pos + 1
237+
238+ # append the lava test install command
239+ template['actions'].insert(install_cmd_pos, lava_test_install_command)
240+ print json.dumps(template, indent=2)
241+
242+
243+if __name__ == '__main__':
244+ # We need only one argument, the board type.
245+ main(sys.argv[1])
246
247=== modified file 'jenkins_common_lib'
248--- jenkins_common_lib 2012-12-21 15:18:27 +0000
249+++ jenkins_common_lib 2012-12-21 15:41:20 +0000
250@@ -15,7 +15,7 @@
251 echo BUILD_ID=$BUILD_NUMBER >> hwpack_info
252 echo GCC_VERSION=`dpkg -s gcc | grep Version | cut -d ' ' -f2` >> hwpack_info
253 echo GCC_CROSS_COMPILER=$gcc_cc_version >> hwpack_info
254-echo BOARD_TYPE=$board_type >> hwpack_info
255+echo BOARD_TYPES=$board_types >> hwpack_info
256 echo HWPACK_TYPE=$hwpack_type >> hwpack_info
257 echo ROOTFS_TYPE=$rootfs_type >> hwpack_info
258 echo BUNDLE_STREAM_NAME=$bundle_stream_name_path >> hwpack_info
259
260=== modified file 'jenkins_kernel_build_inst'
261--- jenkins_kernel_build_inst 2012-12-21 15:15:51 +0000
262+++ jenkins_kernel_build_inst 2012-12-21 15:41:20 +0000
263@@ -1,7 +1,7 @@
264 #! /bin/bash
265 # Example env variables and its values
266 # kernel_config='omap2plus_defconfig'
267-# export board_type='panda'
268+# export board_types='panda'
269 # kernel_flavour='omap4'
270 # rootfs_type='nano'
271 #
272@@ -32,8 +32,13 @@
273 if test -z "$hwpack_type"; then
274 hwpack_type='panda'
275 fi
276-if test -z "$board_type"; then
277- board_type='panda'
278+# Use the new board_types variable to define multiple boards for LAVA testing.
279+if test -z "$board_types" -a -z "$board_type"; then
280+ board_types="panda"
281+elif test -z "$board_types" -a -n "$board_type"; then
282+ board_types="$board_type"
283+elif test -n "$board_types" -a -n "$board_type"; then
284+ board_types="$board_types,$board_type"
285 fi
286 if test -z "$kernel_flavour"; then
287 kernel_flavour='omap'
288@@ -78,7 +83,7 @@
289 export conf_external
290 export kernel_config
291 export hwpack_type
292-export board_type
293+export board_types
294 export kernel_flavour
295 export rootfs_type
296 export git_web_url
297
298=== modified file 'jenkins_lava_job_submissions'
299--- jenkins_lava_job_submissions 2012-05-28 03:38:56 +0000
300+++ jenkins_lava_job_submissions 2012-12-21 15:41:20 +0000
301@@ -15,7 +15,10 @@
302 python $WORKSPACE/lci-build-tools/jenkins_kernel_ci_bundle > $build_json_fname
303 lava-dashboard-tool put --dashboard-url "$LAVA_ENDPOINT" $build_json_fname "$BUILD_STREAM_NAME"
304 if test $SUBMIT_LAVA_JOB -eq 1; then
305- python $WORKSPACE/lci-build-tools/get_latest_ci_hwpack > $kernel_test_json_fname
306- lava_job_id=`lava-tool submit-job "$LAVA_ENDPOINT" $kernel_test_json_fname | grep -v EXPERIMENTAL | cut -d ":" -f 2 | tr -d ' '`
307- echo "LAVA Job Id: $lava_job_id, URL: http://$LAVA_SERVER/lava-server/scheduler/job/$lava_job_id"
308+ for board in `printf "$BOARD_TYPES" | tr ',' ' '`
309+ do
310+ python $WORKSPACE/lci-build-tools/get_latest_ci_hwpack "$board" > $kernel_test_json_fname
311+ lava_job_id=`lava-tool submit-job "$LAVA_ENDPOINT" $kernel_test_json_fname | grep -v EXPERIMENTAL | cut -d ":" -f 2 | tr -d ' '`
312+ echo "LAVA Job Id: $lava_job_id, URL: http://$LAVA_SERVER/lava-server/scheduler/job/$lava_job_id"
313+ done
314 fi
315
316=== modified file 'jenkins_packaged_kernel_build_inst'
317--- jenkins_packaged_kernel_build_inst 2012-03-23 11:27:18 +0000
318+++ jenkins_packaged_kernel_build_inst 2012-12-21 15:41:20 +0000
319@@ -1,6 +1,6 @@
320 #! /bin/sh
321 # Example env variables and its values
322-# export board_type='panda'
323+# export board_types='panda'
324 # rootfs_type='nano'
325 set -xe
326
327@@ -9,7 +9,7 @@
328 #
329 : ${kernel_config:='packaged_kernel_config'}
330 : ${hwpack_type:='panda'}
331-: ${board_type:='panda'}
332+: ${board_types:='panda'}
333 : ${rootfs_type:='nano'}
334 : ${submit_job:=1}
335 : ${upstream_git_tree:='git://git.linaro.org/kernel/linux-linaro-3.0.git'}
336@@ -337,7 +337,7 @@
337 BUILD_ID=$BUILD_NUMBER
338 GCC_VERSION=$(dpkg -s gcc | grep Version | cut -d ' ' -f2)
339 GCC_CROSS_COMPILER=$(dpkg -s gcc-arm-linux-gnueabi | grep Version | cut -d ' ' -f2)
340- BOARD_TYPE=$board_type
341+ BOARD_TYPES=$board_types
342 HWPACK_TYPE=$hwpack_type
343 ROOTFS_TYPE=$rootfs_type
344 BUNDLE_STREAM_NAME=$bundle_stream_name_path

Subscribers

People subscribed via source and target branches