Include the name and number of the image that will be used for QA purposes in
the job metadata so that these jobs and their results can be unambiguously
identified in the LAVA database.
---
 I haven't tested this at all!

 lava-submit.py |   14 ++++++++++++--
 submit-to-lava |    7 +++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lava-submit.py b/lava-submit.py
index 185759f..ff014a3 100755
--- a/lava-submit.py
+++ b/lava-submit.py
@@ -54,7 +54,7 @@ def get_test_actions(tests):
         })
     return actions
 
-def get_job(jobname, device_type, img_url, tests):
+def get_job(jobname, device_type, img_url, tests, image_name, image_number):
     stream = '/private/team/linaro/pre-built-%s/' % DEVICE_STREAM[device_type]
 
     job = collections.OrderedDict()
@@ -66,6 +66,10 @@ def get_job(jobname, device_type, img_url, tests):
             'command': "deploy_linaro_image",
             'parameters': {
                 'image': img_url
+            },
+            'metadata': {
+                'ubuntu.name': image_name,
+                'ubuntu.build': image_number,
             }
         },
             {
@@ -98,6 +102,10 @@ def main():
                    help='The device type to execute on. ie "panda"')
     p.add_argument('-t', dest='image_type', default='nano',
                    help='The image type to execute on, nano (default) or 
ubuntu-desktop')
+    p.add_argument('-n', dest='image_name', required=True,
+                   help='The name of the image for QA purposes, e.g. 
"lt-panda-x11-base"')
+    p.add_argument('-c', dest='image_number', required=True,
+                   help='The build number for this image')
     args = p.parse_args()
 
     # test sets specific to images and boards
@@ -126,7 +134,9 @@ def main():
         except ValueError:
             pass
 
-    job = get_job(args.job_name, args.device_type, args.img_url, tests)
+    job = get_job(
+        args.job_name, args.device_type, args.img_url, tests, args.image_name,
+        args.image_number)
 
     user = os.environ.get('LAVA_USER')
     token = os.environ.get('LAVA_TOKEN')
diff --git a/submit-to-lava b/submit-to-lava
index b297b5b..5f763dd 100755
--- a/submit-to-lava
+++ b/submit-to-lava
@@ -29,8 +29,11 @@ SCRIPT_ROOT=$(dirname $0)
 
 BUILD_PAT="_${TYPE}_[[:digit:]]*-[[:digit:]]*\.img\.gz$"
 for img in `find $PREBUILT_DIR -type f | grep "${BUILD_PAT}"` ; do
-       
url="http://snapshots.linaro.org/precise/pre-built/${img#${PREBUILT_DIR}/}";
+        relpath="${img#${PREBUILT_DIR}/}"
+       url="http://snapshots.linaro.org/precise/pre-built/${relpath}";
        info_file=$(dirname $img)/$(basename $img .img.gz).html
+        image_name="echo $relpath | cut -d/ -f 1"
+        image_number="echo $relpath | cut -d/ -f 2"
        if `echo "$url" | grep /lt-panda/ >/dev/null` ; then
                DEVICE="panda"
        elif `echo "$url" | grep /lt-panda-x11-base/ >/dev/null` ; then
@@ -55,7 +58,7 @@ for img in `find $PREBUILT_DIR -type f | grep "${BUILD_PAT}"` 
; do
 
        if [ -n "$DEVICE" ] ; then
                echo "submitting $img to LAVA"
-               jid=`${SCRIPT_ROOT}/lava-submit.py -t ${TYPE} -j 
${JOB_NAME}-${DEVICE} -u $url -d ${DEVICE}`
+               jid=`${SCRIPT_ROOT}/lava-submit.py -t ${TYPE} -j 
${JOB_NAME}-${DEVICE} -u $url -d ${DEVICE} -n ${image_name} -c ${image_number}`
                if [ $? -eq 0 ] ; then
                        echo "job id: ${jid}"
                        sed -i -e "s/lavaJobId = 0;/lavaJobId=${jid};/" 
${info_file}
-- 
1.7.9.5


_______________________________________________
linaro-validation mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/linaro-validation

Reply via email to