~pwlars/ubuntu-test-cases/dashboard-no-fail

« back to all changes in this revision

Viewing changes to scripts/run-smoke

  • Committer: Paul Larson
  • Date: 2014-10-07 19:56:38 UTC
  • Revision ID: paul.larson@canonical.com-20141007195638-cl5qh6capxsahaup
Don't fail if the dashboard client api has problems

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
def _sync_results(build, image, test, fname):
323
323
    with open(fname) as f:
324
324
        d = yaml.safe_load(f)
325
 
        dashboard_api.result_syncing(image, build, test, d)
 
325
        if image and build:
 
326
            try:
 
327
                dashboard_api.result_syncing(image, build, test, d)
 
328
            except:
 
329
                log.warn('Dashboard live update failed')
326
330
 
327
331
 
328
332
def _test_utah(args, build, image):
331
335
        with statsd.time_it('TESTS'):
332
336
            for test in args.test:
333
337
                os.environ['RESDIR'] = os.path.join(res_dir, test)
334
 
                dashboard_api.result_running(image, build, test)
 
338
                if image and build:
 
339
                    try:
 
340
                        dashboard_api.result_running(image, build, test)
 
341
                    except:
 
342
                        log.warn('Dashboard live update failed')
335
343
                _run(cargs + ['-a', test, '-p', '/tmp/results'],
336
344
                     ignore_error=True)
337
345
                fname = os.path.join(res_dir, test, 'utah.yaml')
344
352
    # this is set in the job environment variable IMAGE_SERIES
345
353
    release = os.environ.get('IMAGE_SERIES')
346
354
    if release:
347
 
        return dashboard_api.image_add(build_number, release, args.image_type,
348
 
                                       detect_device(None), 'ubuntu')
 
355
        try:
 
356
            img = dashboard_api.image_add(build_number, release,
 
357
                                          args.image_type,
 
358
                                          detect_device(None), 'ubuntu')
 
359
        except:
 
360
            img = 0
 
361
            log.warn('Dashboard live update failed')
 
362
            return img
349
363
 
350
364
 
351
365
def main(args):
357
371
 
358
372
        job_name = os.environ.get('JOB_NAME', '')
359
373
        job_number = os.environ.get('BUILD_NUMBER', '')
360
 
        build = dashboard_api.build_add(job_name, job_number)
 
374
        try:
 
375
            build = dashboard_api.build_add(job_name, job_number)
 
376
        except:
 
377
            build = 0
 
378
            log.warn('Dashboard live update failed')
361
379
 
362
380
        if args.no_provision:
363
381
            logging.info('Skipping the provisioning step as requested')
370
388
        # so that the status is updated *before* flashing rather than after
371
389
        image = _image_add(args)
372
390
 
373
 
        if args.test:
 
391
        if args.test and image and build:
374
392
            for x in args.test:
375
 
                dashboard_api.result_queue(image, build, x)
376
 
        if args.app:
 
393
                try:
 
394
                    dashboard_api.result_queue(image, build, x)
 
395
                except:
 
396
                    log.warn('Dashboard live update failed')
 
397
        if args.app and image and build:
377
398
            for x in args.app:
378
 
                dashboard_api.result_queue(image, build, x)
 
399
                try:
 
400
                    dashboard_api.result_queue(image, build, x)
 
401
                except:
 
402
                    log.warn('Dashboard live update failed')
379
403
 
380
404
        _test_utah(args, build, image)
381
405
        _test_autopilot(args, build, image)