summaryrefslogtreecommitdiff
path: root/lkft
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2019-08-21 16:02:48 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2019-08-21 16:02:48 +0800
commitdafd3373efc512b71bfc3823e297b49aac4244f3 (patch)
tree47f659d1a653a0055de6c3b4d9e8dccb1faa6ef3 /lkft
parentac62f1fab0b29cdd79e18d6e6fb3e7066d1f8f69 (diff)
lkft: show ci trigger build name
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'lkft')
-rw-r--r--lkft/lkft_config.py63
-rw-r--r--lkft/templates/lkft-projects.html11
-rw-r--r--lkft/views.py29
3 files changed, 86 insertions, 17 deletions
diff --git a/lkft/lkft_config.py b/lkft/lkft_config.py
new file mode 100644
index 0000000..1456f2c
--- /dev/null
+++ b/lkft/lkft_config.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+import re
+
+citrigger_lkft = {
+ 'trigger-lkft-aosp-mainline': [
+ 'mainline-9.0-hikey',
+ 'mainline-9.0-hikey-auto',
+ 'mainline-9.0-hikey960',
+ 'mainline-9.0-hikey960-auto',
+ 'mainline-9.0-x15',
+ 'mainline-9.0-x15-auto',
+ ],
+
+ 'trigger-lkft-ti-4.19': [
+ '4.19-9.0-x15',
+ '4.19-9.0-x15-auto',
+ '4.19-9.0-am65x',
+ '4.19-9.0-am65x-auto',
+ ],
+ 'trigger-lkft-hikey-4.19': [
+ '4.19-9.0-hikey',
+ '4.19-9.0-hikey-auto',
+ '4.19-9.0-hikey960',
+ '4.19-9.0-hikey960-auto',
+ ],
+
+ 'trigger-lkft-x15-4.14': [
+ '4.14-8.1-x15',
+ ],
+ 'trigger-lkft-hikey-4.14-premerge-ci': [
+ '4.14-9.0-hikey',
+ '4.14-9.0-hikey960',
+ ],
+ 'trigger-lkft-hikey-4.14': [
+ '4.14-8.1-hikey',
+ ],
+
+ 'trigger-lkft-hikey-4.9-premerge-ci': [
+ '4.9-9.0-hikey',
+ '4.9-9.0-hikey960',
+ ],
+ 'trigger-lkft-hikey-4.9': [
+ '4.9-8.1-hikey',
+ ],
+
+ 'trigger-lkft-hikey-4.4-premerge-ci': [
+ '4.4-lts-9.0-hikey',
+ ],
+ 'trigger-lkft-hikey-4.4': [
+ '4.4-8.1-hikey',
+ '4.4-9.0-hikey',
+ ],
+}
+
+def find_citrigger(lkft_pname=""):
+ if not lkft_pname:
+ return None
+ for trigger_name, lkft_pnames in citrigger_lkft.items():
+ if lkft_pname in lkft_pnames:
+ return trigger_name
+ return None
diff --git a/lkft/templates/lkft-projects.html b/lkft/templates/lkft-projects.html
index 7a601a3..f47e153 100644
--- a/lkft/templates/lkft-projects.html
+++ b/lkft/templates/lkft-projects.html
@@ -12,6 +12,7 @@
<th>Project</th>
<th>Last Build Timestamp</th>
<th>Last Build No.</th>
+ <th>Last Trigger Build No.</th>
</tr>
{% for project in projects %}
<tr>
@@ -37,6 +38,16 @@
No Build Yet
{% endif %}
</td>
+ <td>
+ {% if project.last_trigger_build %}
+ {% with project.last_trigger_build as last_trigger_build %}
+ <a href="{{last_trigger_build.url}}">{{ last_trigger_build.displayName}}</a>
+ {% endwith %}
+ {% else %}
+ No Trigger Build Setup Yet
+ {% endif %}
+ </td>
+ </td>
</tr>
{% endfor %}
</table>
diff --git a/lkft/views.py b/lkft/views.py
index d53f282..47e6897 100644
--- a/lkft/views.py
+++ b/lkft/views.py
@@ -26,9 +26,11 @@ from lcr.settings import QA_REPORT, QA_REPORT_DEFAULT
from lcr import qa_report
from lcr.qa_report import DotDict
from lcr.utils import download_urllib
+from lkft.lkft_config import find_citrigger
qa_report_def = QA_REPORT[QA_REPORT_DEFAULT]
qa_report_api = qa_report.QAReportApi(qa_report_def.get('domain'), qa_report_def.get('token'))
+jenkins_api = qa_report.JenkinsApi('ci.linaro.org', None)
DIR_ATTACHMENTS = os.path.join(FILES_DIR, 'lkft')
@@ -201,24 +203,12 @@ def extract(result_zip_path, failed_testcases_all={}, metadata={}):
'failed_number': failed_number
}
-citrigger_lkft = {
- 'trigger-lkft-aosp-mainline': [
- 'mainline-9.0-hikey',
- 'mainline-9.0-hikey-auto',
- 'mainline-9.0-hikey960',
- 'mainline-9.0-hikey960-auto',
- 'mainline-9.0-x15',
- 'mainline-9.0-x15',
- ],
-}
-
-def find_citrigger(lkft_pname=""):
- if not lkft_pname:
+
+def get_last_trigger_build(lkft_pname=''):
+ ci_trigger_name = find_citrigger(lkft_pname=lkft_pname)
+ if not ci_trigger_name:
return None
- for trigger_name, lkft_pnames in citrigger_lkft:
- if lkft_pname in lkft_pnames:
- return trigger_name
- return None
+ return jenkins_api.get_last_build(cijob_name=ci_trigger_name)
def list_projects(request):
projects = []
@@ -235,6 +225,11 @@ def list_projects(request):
last_build['created_at'] = datetime.datetime.strptime(str(created_str), '%Y-%m-%dT%H:%M:%S.%fZ')
project['last_build'] = last_build
+ last_trigger_build = get_last_trigger_build(project.get('name'))
+ if last_trigger_build:
+ last_trigger_url = last_trigger_build.get('url')
+ project['last_trigger_build'] = jenkins_api.get_build_details_with_full_url(build_url=last_trigger_url)
+
projects.append(project)
bugs = get_lkft_bugs()