summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2014-09-08 20:24:12 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2014-09-08 20:24:12 +0300
commitadbbf5d90c53ae06b439c3986549d40756e84f3d (patch)
tree4b76a32dca0e5db9d662f1bfee837209a27c7aaf
parentc8b81e36cb6434f9981bd8c0e6907362c5f9658f (diff)
downloadlci-build-tools-adbbf5d90c53ae06b439c3986549d40756e84f3d.tar.gz
Add scripts for upstream kernel CI
Submit LAVA job based on the dtbs and include a custom job definition example. Change-Id: I9065b10b9e5238f016a04ce44e57d48c33989561 Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
-rw-r--r--custom_lava_job_definition.yaml20
-rw-r--r--dtb-to-device.py118
2 files changed, 138 insertions, 0 deletions
diff --git a/custom_lava_job_definition.yaml b/custom_lava_job_definition.yaml
new file mode 100644
index 0000000..e86a24a
--- /dev/null
+++ b/custom_lava_job_definition.yaml
@@ -0,0 +1,20 @@
+actions:
+ - command: deploy_linaro_kernel
+ parameters:
+ dtb: 'http://snapshots.linaro.org/kernel-hwpack/linux-next/${defconfig}/${BUILD_NUMBER}/dtb/${DTB_FILE_NAME}'
+ kernel: 'http://snapshots.linaro.org/kernel-hwpack/linux-next/${defconfig}/${BUILD_NUMBER}/${KERNEL_FILE_NAME}'
+ nfsrootfs: 'http://snapshots.linaro.org/openembedded/images/minimal-armv7a-gcc-4.9/293/linaro-image-minimal-genericarmv7a-20140901-293.rootfs.tar.gz'
+ metadata:
+ build id: '${BUILD_NUMBER}'
+ defconfig: '${kernel_config}'
+ git URL: '${GIT_URL}'
+ git branch: '${GIT_BRANCH}'
+ git commit: '${GIT_COMMIT}'
+ - command: boot_linaro_image
+ - command: submit_results
+ parameters:
+ server: 'http://validation.linaro.org/RPC2/'
+ stream: '${BUNDLE_STREAM_NAME}'
+device_type: ${DEVICE_TYPE}
+job_name: ${BUILD_URL}
+timeout: 3600
diff --git a/dtb-to-device.py b/dtb-to-device.py
new file mode 100644
index 0000000..2b19921
--- /dev/null
+++ b/dtb-to-device.py
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+
+import json
+import os
+import re
+import string
+import yaml
+
+# mapping device tree blob - device type
+device = {
+ 'am335x-boneblack.dtb': 'beaglebone-black',
+ 'apm-mustang.dtb': 'mustang',
+ 'axm5516-amarillo.dtb': 'lng-amarillo',
+ 'bcm28155-ap.dtb': 'capri',
+ 'ecx-2000.dtb': 'midway',
+ 'exynos4210-origen.dtb': 'origen',
+ 'exynos5250-arndale.dtb': 'arndale',
+ 'exynos5420-arndale-octa.dtb': 'arndale-octa',
+ 'hi3620-hi4511.dtb': 'k3v2',
+ 'highbank.dtb': 'highbank',
+ 'hip04-d01.dtb': 'd01',
+ 'hisi-x5hd2-dkb.dtb': 'hi3716cv200',
+ 'juno.dtb': 'wg',
+ 'k2hk-evm.dtb': 'lng-keystone',
+ 'mb8ac0300eb.dtb': 'aa9',
+ 'omap4-panda-es.dtb': 'panda-es',
+ 'omap4-panda.dtb': 'panda',
+ 'qcom-apq8064-ifc6410.dtb': 'ifc6410',
+ 'qcom-apq8074-dragonboard.dtb': 'dragonboard-8074',
+ 'stih407-b2120.dtb': 'b2120stxh407',
+ 'vexpress-v2p-ca15_a7.dtb': 'vexpress-tc2',
+ 'vexpress-v2p-ca5s.dtb': 'vexpress-a5',
+ 'vexpress-v2p-ca9.dtb': 'vexpress-a9',
+}
+
+
+def obfuscate_credentials(s):
+ return re.sub(r'([^ ]:).+?(@)', r'\1xxx\2', s)
+
+
+def lava_submit(config, lava_server):
+ print config
+
+ skip_lava = os.environ.get('SKIP_LAVA')
+ if skip_lava is None:
+ # LAVA user
+ lava_user = os.environ.get('LAVA_USER')
+ if lava_user is None:
+ f = open('/var/run/lava/lava-user')
+ lava_user = f.read().strip()
+ f.close()
+
+ # LAVA token
+ lava_token = os.environ.get('LAVA_TOKEN')
+ if lava_token is None:
+ f = open('/var/run/lava/lava-token')
+ lava_token = f.read().strip()
+ f.close()
+
+ # LAVA server base URL
+ lava_server_root = lava_server.rstrip('/')
+ if lava_server_root.endswith('/RPC2'):
+ lava_server_root = lava_server_root[:-len('/RPC2')]
+
+ try:
+ server_url = \
+ 'https://{lava_user:>s}:{lava_token:>s}@{lava_server:>s}'
+ server = \
+ xmlrpclib.ServerProxy(server_url.format(
+ lava_user=lava_user,
+ lava_token=lava_token,
+ lava_server=lava_server))
+ lava_job_id = server.scheduler.submit_job(config)
+ except xmlrpclib.ProtocolError, e:
+ print 'Error making a LAVA request:', obfuscate_credentials(str(e))
+
+ print 'LAVA Job Id: %s, URL: http://%s/scheduler/job/%s' % \
+ (lava_job_id, lava_server_root, lava_job_id)
+ else:
+ print 'LAVA job submission skipped.'
+
+
+def main():
+ # LAVA server URL
+ lava_server = os.environ.get('LAVA_SERVER',
+ 'validation.linaro.org/RPC2/')
+
+ for root, dirs, dtb_files in os.walk('out/dtb'):
+ for dtb_file in dtb_files:
+ with open('custom_lava_job_definition.yaml') as f:
+ buffer = f.read()
+ template = string.Template(buffer)
+ buffer = template.safe_substitute(
+ DTB_FILE_NAME=dtb_file,
+ KERNEL_FILE_NAME=os.environ.get('KERNEL_FILE_NAME'),
+ defconfig=os.environ.get('defconfig'),
+ kernel_config=os.environ.get('kernel_config'),
+ BUILD_NUMBER=os.environ.get('BUILD_NUMBER'),
+ STARTUP_NSH=os.environ.get('STARTUP_NSH'),
+ HWPACK_BUILD_URL=os.environ.get('HWPACK_BUILD_URL'),
+ ROOTFS_BUILD_URL=os.environ.get('ROOTFS_BUILD_URL'),
+ hwpack_type=os.environ.get('hwpack_type'),
+ ROOTFS_BUILD_NUMBER=os.environ.get('ROOTFS_BUILD_NUMBER'),
+ GIT_URL=os.environ.get('GIT_URL'),
+ GIT_BRANCH=os.environ.get('GIT_BRANCH'),
+ GIT_COMMIT=os.environ.get('GIT_COMMIT'),
+ BUNDLE_STREAM_NAME=os.environ.get('BUNDLE_STREAM_NAME'),
+ LAVA_SERVER=lava_server,
+ DEVICE_TYPE=device[dtb_file],
+ BUILD_URL=os.environ.get('BUILD_URL')
+ )
+
+ config = json.dumps(yaml.safe_load(buffer), indent=2)
+ lava_submit(config, lava_server)
+
+
+if __name__ == '__main__':
+ main()