diff options
Diffstat (limited to 'packer/provision/agl_dependencies.attic')
-rw-r--r-- | packer/provision/agl_dependencies.attic | 261 |
1 files changed, 261 insertions, 0 deletions
diff --git a/packer/provision/agl_dependencies.attic b/packer/provision/agl_dependencies.attic new file mode 100644 index 00000000..6692de8b --- /dev/null +++ b/packer/provision/agl_dependencies.attic @@ -0,0 +1,261 @@ +if false ; then + +# ATTIC + +# clone lava-boot to /opt/AGL/ +mkdir -p /opt/AGL/ +cd /opt/AGL/ +git clone http://git.linaro.org/people/riku.voipio/lava-boot.git +cd lava-boot +sed -i '16iimport ssl' lava-boot +sed -i '17issl._create_default_https_context = ssl._create_unverified_context' lava-boot +sed -i -e 's#"~/.lava.yaml"#"/opt/AGL/lava-agl/lava.yaml"#' lava-boot + +cat <<EOFLAVAYAML > /opt/AGL/lava-agl/.lava.yaml +server: ${LAVAHOST} +user: ${LAVAUSER} +token: ${LAVATOKEN} +https: true +EOFLAVAYAML + + +# AGL specific lab integration. To be moved into git repo and cloned or the like. +################################################################################# +mkdir -p /opt/AGL/lava-agl/ +cat <<EOFBR >> /opt/AGL/lava-agl/boardready.py +#!/usr/bin/python +import xmlrpclib +import ssl +import sys +import time + +# bug, ssl chain cannot be verified (letsencrypt) +# to be fixed +ssl._create_default_https_context = ssl._create_unverified_context + +username = "$LAVAUSER" +token = "$LAVATOKEN" +myhostname = "$LAVAHOST" + +print "Starting ..." +sys.stdout.flush() +arg = None +if len(sys.argv) > 1: + arg = sys.argv[1] + +if arg == None: + print("No argument, need lava jobnumber as argument.") + sys.stdout.flush() + sys.exit(1) + +server = xmlrpclib.ServerProxy("https://%s:%s@%s/RPC2" % (username, token, myhostname)) +#print(arg) +#sys.stdout.flush() + +# Poll loop +while True: + try: + x = server.scheduler.job_status(arg)['job_status'] + except: + print("Error, quitting.") + sys.stdout.flush() + sys.exit(1) + break + if 'Cancelled' in x: + sys.exit(1) + break + if 'Submitted' in x: + print("Job submitted - pending") + sys.stdout.flush() + time.sleep(20) + continue + if 'Running' in x: + print("Job Running now.") + print("Remote boot takes around 5 minutes to complete (download+boot) - waiting ...") + sys.stdout.flush() + time.sleep(300) + y = server.scheduler.job_status(arg)['job_status'] + if 'Running' in y: + break + else: + continue + break + break +# end +EOFBR + + +cat <<EOFPORTERUPLOADYAML > /opt/AGL/lava-agl/porter_nbd_upload.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'http://localhost/porter/upload/\${KERNELIMAGE}' + nbdroot: 'http://localhost/porter/upload/\${ROOTFSTOBOOT}' + ramdisk: 'http://localhost/porter/upload/\${NETBOOTIMAGE}' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' + - command: lava_command_run + parameters: + commands: + - "while test ! -f /jta.done ; do echo \"Waiting for JTA to finish ... \" ; sleep 20 ; done" + timeout: 22100 +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 + +EOFPORTERUPLOADYAML + +cat <<EOFPORTERUPLOADYAML1 > /opt/AGL/lava-agl/porter_nbd_upload_stress.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'http://localhost/porter/upload/\${KERNELIMAGE}' + nbdroot: 'http://localhost/porter/upload/\${ROOTFSTOBOOT}' + ramdisk: 'http://localhost/porter/upload/\${NETBOOTIMAGE}' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' + - command: lava_command_run + parameters: + commands: + - "stress -v -t 120 -c 1 -m 1 -i 1 " + timeout: 300 +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 + +EOFPORTERUPLOADYAML1 + +cat <<EOFPORTERUPLOADYAML1 > /opt/AGL/lava-agl/porter_nbd_upload_simple.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'http://localhost/porter/upload/\${KERNELIMAGE}' + nbdroot: 'http://localhost/porter/upload/\${ROOTFSTOBOOT}' + ramdisk: 'http://localhost/porter/upload/\${NETBOOTIMAGE}' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 + +EOFPORTERUPLOADYAML1 + +cat <<EOFPORTERSNAPYAML > /opt/AGL/lava-agl/porter_nbd_snapshot.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/uImage+dtb' + nbdroot: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/core-image-minimal-porter.ext4' + ramdisk: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/initramfs-netboot-image-porter.ext4.gz.u-boot' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' + - command: lava_command_run + parameters: + commands: + - "while test ! -f /jta.done ; do echo \"Waiting for JTA to finish ... \" ; sleep 20 ; done" + timeout: 22100 +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 +EOFPORTERSNAPYAML + +cat <<EOFPORTERSNAPYAML1 > /opt/AGL/lava-agl/porter_nbd_snapshot_stress.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/uImage+dtb' + nbdroot: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/core-image-minimal-porter.ext4' + ramdisk: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/initramfs-netboot-image-porter.ext4.gz.u-boot' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 +EOFPORTERSNAPYAML1 + +cat <<EOFPORTERSNAPYAML1 > /opt/AGL/lava-agl/porter_nbd_snapshot_simple.yaml +actions: + - command: deploy_linaro_kernel + parameters: + kernel: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/uImage+dtb' + nbdroot: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/core-image-minimal-porter.ext4' + ramdisk: 'https://download.automotivelinux.org/AGL/snapshots/master/latest/porter-nogfx/deploy/images/porter/initramfs-netboot-image-porter.ext4.gz.u-boot' + login_prompt: 'porter login:' + username: 'root' + - command: boot_linaro_image + parameters: + test_image_prompt: 'root@porter:~#' +device_type: 'renesas-porter' +logging_level: INFO +job_name: '\${JOB_NAME}' +timeout: 22600 +EOFPORTERSNAPYAML1 + + +cat <<EOFUPLOAD > /opt/AGL/lava-agl/upload4lava.sh +#!/bin/bash +#set -x + +if test x"" != x"\$1"; then +Y=\$(echo "\$1" | sed -e "s#\.\.##g" -e "s#/##g") +curl -T "\$Y" https://porter.automotivelinux.org/porter/upload/\$Y --insecure +else +echo "Help: \$0 file" +fi + +EOFUPLOAD + +cat <<EOFDELETE > /opt/AGL/lava-agl/delete4lava.sh +#!/bin/bash +#set -x + +if test x"" != x"\$1"; then +Y=\$(echo "\$1" | sed -e "s#\.\.##g" -e "s#/##g") +curl -X DELETE https://porter.automotivelinux.org/porter/upload/\$Y --insecure +else +echo "Help: \$0 file" +fi + +EOFDELETE + +cat <<EOFDEPLOY > /opt/AGL/lava-agl/deploy.sh +#!/bin/bash +#set -x +set -e +PORTERYAML="porter_nbd_snapshot.yaml" + +if test x"" != x"\$1" ; then + PORTERYAML="\$1" +fi +if test -f /opt/AGL/lava-agl/\${PORTERYAML}; then + /opt/AGL/lava-agl/boardready.py \$(/opt/AGL/lava-boot/lava-boot -j /opt/AGL/lava-agl/\${PORTERYAML} -a -q | sed -e "s#.*job/##g") +else + echo "\${PORTERYAML} not found." + exit 1 +fi +EOFDEPLOY + +chmod a+x /opt/AGL/lava-agl/* + + +fi
\ No newline at end of file |