From: Thanh Ha Date: Tue, 9 Jan 2018 16:31:59 +0000 (-0500) Subject: Convert robot packer to ansible provisioner X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=83fd299e3c0fd085a69be6ddd89747714fe38b93;p=releng%2Fbuilder.git Convert robot packer to ansible provisioner Change-Id: Icec7459c969446f19e4506f7501b5adf38188d4b Signed-off-by: Thanh Ha --- diff --git a/jjb/releng-jobs.yaml b/jjb/releng-jobs.yaml index 6ca3f4772..766846289 100644 --- a/jjb/releng-jobs.yaml +++ b/jjb/releng-jobs.yaml @@ -54,7 +54,6 @@ build-timeout: 60 - mininet-ovs-2.6: build-timeout: 75 - - robot exclude: - platforms: centos @@ -65,8 +64,6 @@ templates: mininet-ovs-2.5 - platforms: centos templates: mininet-ovs-2.6 - - platforms: ubuntu-14.04 - templates: robot - platforms: ubuntu-14.04 templates: devstack-pre-pip-newton - platforms: ubuntu-14.04 @@ -79,8 +76,6 @@ templates: mininet-ovs-2.5 - platforms: ubuntu-14.04 templates: mininet-ovs-2.6 - - platforms: ubuntu-16.04 - templates: robot - platforms: ubuntu-16.04 templates: devstack-pre-pip-newton - platforms: ubuntu-16.04 diff --git a/jjb/releng-packer-jobs.yaml b/jjb/releng-packer-jobs.yaml index f23d7784f..f2d7f0f83 100644 --- a/jjb/releng-packer-jobs.yaml +++ b/jjb/releng-packer-jobs.yaml @@ -30,3 +30,18 @@ platforms: centos templates: docker + +- project: + name: packer-robot-jobs + jobs: + - gerrit-packer-merge + + project: releng/builder + project-name: builder + branch: master + archive-artifacts: '**/*.log' + + build-node: centos7-builder-2c-8g + + platforms: centos + templates: robot diff --git a/packer/provision/robot.sh b/packer/provision/robot.sh deleted file mode 100644 index 13bfa219e..000000000 --- a/packer/provision/robot.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# vim: sw=4 ts=4 sts=4 et tw=72 : - -# force any errors to cause the script and job to end in failure -set -xeu -o pipefail - -# Install minimal python requirements to get virtualenv going -# Additional python dependencies should be installed via JJB configuration -# inside project jobs using a virtualenv setup. -yum install -y @development \ - python-devel \ - python-setuptools \ - python-virtualenv - -# TODO: Move docker-py and netaddr to virtualenv in the csit jobs. -yum install -y python-docker-py \ - python-netaddr - -# Install dependencies for robotframework and robotframework-sshlibrary -# installed elsewhere -yum install -y yum-utils unzip sshuttle nc libffi-devel openssl-devel - -# Install dependencies for matplotlib library used in longevity framework -yum install -y libpng-devel freetype-devel python-matplotlib - -# install crudini command line tool for editing config files -yum install -y crudini - -# Install dependency for postgres database used in storing performance plot results -yum -y install postgresql-devel - -################################ -# LISPFLOWMAPPING REQUIREMENTS # -################################ - -# Needed for pyangbind -yum install -y libxml2-devel libxslt-devel - -# Install `udpreplay` to be used for (lispflowmapping) performance tests -yum install -y libpcap-devel boost-devel -git clone https://github.com/ska-sa/udpreplay.git -cd udpreplay -./bootstrap.sh -./configure -make &> /dev/null && cp udpreplay /usr/local/bin - -## Install docker-py and netaddr -yum install -y -q python-docker-py python-netaddr - -##################### -# DLUX requirements # -##################### - -# - Xvfb: Display manager in RAM -# -# Note: The end goal will be to test with multiple browser (Firefox, Chrome) -# Chrome need a other library named chromedriver so let start with -# one already supported with selenium. -yum install -y firefox xorg-x11-server-Xvfb diff --git a/packer/provision/robot.yaml b/packer/provision/robot.yaml new file mode 100644 index 000000000..88509d60c --- /dev/null +++ b/packer/provision/robot.yaml @@ -0,0 +1,72 @@ +--- +- import_playbook: ../common-packer/provision/baseline.yaml + +- hosts: all + become_user: root + become_method: sudo + + pre_tasks: + - include_role: name=system-update + + tasks: + - name: Install robot dependencies + yum: 'name={{item}} state=present' + with_items: + - postgresql-devel + - python-docker-py + - python-matplotlib + - python-netaddr + become: true + + - name: Install dlux dependencies + block: + - name: Install dlux dependencies + yum: 'name={{item}} state=present' + with_items: + - firefox + - xorg-x11-server-Xvfb + become: true + + - name: Install lispflowmapping dependencies + block: + - name: Install lispflowmapping dependencies + yum: 'name={{item}} state=present' + with_items: + - boost-devel + - libpcap-devel + - libxml2-devel + - libxslt-devel + - python-docker-py + - python-netaddr + become: true + - name: Install udpreplay + block: + - name: Fetch udpreplay git repo + git: + repo: https://github.com/ska-sa/udpreplay.git + dest: /tmp/udpreplay + - name: Run bootstrap.sh script + command: /tmp/udpreplay/bootstrap.sh + args: + chdir: /tmp/udpreplay + - name: Run configure script + command: /tmp/udpreplay/configure + args: + chdir: /tmp/udpreplay + - name: Run make + command: make + args: + chdir: /tmp/udpreplay + - name: Install udpreplay to /usr/local/bin/udpreplay + copy: + src: /tmp/udpreplay/udpreplay + dest: /usr/local/bin/udpreplay + mode: 0755 + owner: root + remote_src: yes + become: yes + + post_tasks: + - name: System Reseal + script: ../common-packer/provision/system-reseal.sh + become: true diff --git a/packer/templates/robot.json b/packer/templates/robot.json index 246698b50..33aa9f654 100644 --- a/packer/templates/robot.json +++ b/packer/templates/robot.json @@ -1,35 +1,36 @@ { "variables": { - "public_base_image": null, - "public_network": null, - "public_cloud_user": null, - "public_auth_url": null, - "public_tenant": null, - "public_user": null, - "public_pass": null, + "base_image": null, "distro": null, + "cloud_auth_url": null, + "cloud_user": null, + "cloud_pass": null, + "cloud_network": null, + "cloud_tenant": null, "cloud_user_data": null, + "ssh_user": null, "ssh_proxy_host": "" }, "builders": [ { + "name": "vexxhost", + "image_name": "ZZCI - {{user `distro`}} - robot - {{isotime \"20060102-1504\"}}", + "source_image_name": "{{user `base_image`}}", "type": "openstack", - "identity_endpoint": "{{user `public_auth_url`}}", + "identity_endpoint": "{{user `cloud_auth_url`}}", + "username": "{{user `cloud_user`}}", + "password": "{{user `cloud_pass`}}", + "tenant_name": "{{user `cloud_tenant`}}", "domain_name": "Default", - "tenant_name": "{{user `public_tenant`}}", - "username": "{{user `public_user`}}", - "password": "{{user `public_pass`}}", "region": "ca-ymq-1", "availability_zone": "ca-ymq-2", - "ssh_username": "{{user `public_cloud_user`}}", - "ssh_proxy_host": "{{user `ssh_proxy_host`}}", - "image_name": "ZZCI - {{user `distro`}} - robot - {{isotime \"20060102-1504\"}}", - "source_image_name": "{{user `public_base_image`}}", - "flavor": "v1-standard-1", "networks": [ - "{{user `public_network`}}" + "{{user `cloud_network`}}" ], "user_data_file": "{{user `cloud_user_data`}}", + "ssh_username": "{{user `ssh_user`}}", + "ssh_proxy_host": "{{user `ssh_proxy_host`}}", + "flavor": "v1-standard-1", "metadata": { "ci_managed": "yes" } @@ -39,12 +40,20 @@ { "type": "shell", "scripts": [ - "provision/baseline.sh", - "provision/robot.sh", - "provision/system_reseal_local_env.sh", - "provision/system_reseal.sh" + "common-packer/provision/install-python.sh" ], "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi" + }, + { + "type": "ansible", + "playbook_file": "provision/robot.yaml", + "ansible_env_vars": [ + "ANSIBLE_NOCOWS=1", + "ANSIBLE_PIPELINING=True", + "ANSIBLE_ROLES_PATH=../lf-ansible/roles", + "ANSIBLE_CALLBACK_WHITELIST=profile_tasks", + "ANSIBLE_STDOUT_CALLBACK=debug" + ] } ] }