summaryrefslogtreecommitdiffstats
path: root/utils/agljobtemplate.py
diff options
context:
space:
mode:
authorlollivier <lollivier@baylibre.com>2017-10-30 16:08:23 +0100
committerlollivier <lollivier@baylibre.com>2017-11-06 10:27:51 +0100
commit223394c59690707a528fa512a61db8d95f117660 (patch)
treef973756ed7ea9415a5c6fb6cbbb2a01f1290242b /utils/agljobtemplate.py
parent848b44f4497613a0fcbae6a02380a9d6670d804f (diff)
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 <lollivier@baylibre.com>
Diffstat (limited to 'utils/agljobtemplate.py')
-rw-r--r--utils/agljobtemplate.py36
1 files changed, 35 insertions, 1 deletions
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