From 223394c59690707a528fa512a61db8d95f117660 Mon Sep 17 00:00:00 2001 From: lollivier Date: Mon, 30 Oct 2017 16:08:23 +0100 Subject: New machine, url, branch, version arguments - Machine is now a mandatory argument: --machine - Change in the URL scheme usage: Now the argument is --url, it should be used with --branch & --version (or --changeid and --patchset which are aliases). The default url is the latest AGL release (dab - 4.0.2) - Build version is derived from the URL, branch and version if not set through command line. Example usage: ./utils/create-jobs.py --machine m3ulcb ./utils/create-jobs.py --machine qemux86-64 ./utils/create-jobs.py --url release --branch eel --version 4.99.1 --machine m3ulcb ./utils/create-jobs.py --url release --branch eel --version 4.99.1 --machine qemux86-64 ./utils/create-jobs.py --url daily --branch master --version latest --machine m3ulcb ./utils/create-jobs.py --url daily --branch master --version latest --machine raspberrypi3 ./utils/create-jobs.py --url ci --changeid 11533 --patchset 2 --machine raspberrypi3 ./utils/create-jobs.py --url ci --changeid 11533 --patchset 2 --machine m3ulcb ./utils/create-jobs.py --url http://baylibre.com/pub/agl/ci/raspberrypi3 --machine raspberrypi3 Update the README.md following changes on the url scheme and --machine argument. Bug-AGL: SPEC-975 Change-Id: Idd0d539627d56e8d28e1e4990570a929b3fa0f5d Signed-off-by: lollivier --- utils/agljobtemplate.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'utils/agljobtemplate.py') diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py index 528a3b9..b4d44af 100644 --- a/utils/agljobtemplate.py +++ b/utils/agljobtemplate.py @@ -4,11 +4,21 @@ import os import jinja2 import ConfigParser +import urlparse def get_extension(path): return path.split('.')[-1] +def parse_url_file(template_path, url_file, url_type): + url_file_path = template_path + '/URLs/' + url_file + try: + with open(url_file_path): + cfg = ConfigParser.ConfigParser() + cfg.read(url_file_path) + return cfg.get(url_type, 'urlbase'), cfg.get('infra', 'style') + except IOError: + raise IOError, "Unable to read from file {}".format(url_file_path) def parse_callback_file(template_path, callback_file, job): callback_file_path = template_path + '/callback/' + callback_file + '.cfg' @@ -59,7 +69,8 @@ class Agljobtemplate(object): def rfs_types(self): return self.RFS_TYPE - def render_job(self, url, machine, job_name="AGL-short-smoke", priority="medium", tests=[], rfs_type=None, + def render_job(self, url, machine, url_branch=None, url_version=None, + job_name="AGL-short-smoke", priority="medium", tests=[], rfs_type=None, kci_callback=None, rfs_image=None, kernel_image=None, dtb_image=None, modules_image=None, build_version=None): test_templates = [] @@ -78,9 +89,32 @@ class Agljobtemplate(object): job['name'] = job_name job['yocto_machine'] = machine job['priority'] = priority + + if url[:4] != 'http': + # If not a full url, read from config file + url_base, infra = parse_url_file(self._template_path, 'default.cfg', url) + if infra == 'AGL': + url_fragment = '' + if (url != 'default'): + url_fragment += url_branch + '/' + url_version + '/' + + if (machine == 'm3ulcb') or (machine == 'porter'): + url_fragment += machine + '-nogfx' + else: + url_fragment += machine + + if (url != 'ci'): + url_fragment += '/deploy/images/' + machine + + url = urlparse.urljoin(url_base, url_fragment) + job['urlbase'] = url + job['test_templates'] = test_templates + if (not build_version) and (url_branch) and (url_version): + build_version = 'AGL-' + url + '-' + url_branch + '-' + url_version + if build_version is not None: job['kernel_version'] = build_version -- cgit 1.2.3-korg