Convert robot packer to ansible provisioner 83/66983/3
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 9 Jan 2018 16:31:59 +0000 (11:31 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 9 Jan 2018 17:22:28 +0000 (12:22 -0500)
Change-Id: Icec7459c969446f19e4506f7501b5adf38188d4b
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/releng-jobs.yaml
jjb/releng-packer-jobs.yaml
packer/provision/robot.sh [deleted file]
packer/provision/robot.yaml [new file with mode: 0644]
packer/templates/robot.json

index 6ca3f4772117fabd221f1074bffbdc29f95e4a1c..7668462894381da079f2e910720d48747ae67d12 100644 (file)
@@ -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
index f23d7784f2b3af56496aa557b0a1ee6f31d7947f..f2d7f0f83e001260a50db64b9e8c90e5354b26b0 100644 (file)
 
     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 (file)
index 13bfa21..0000000
+++ /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 (file)
index 0000000..88509d6
--- /dev/null
@@ -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
index 246698b5073ab81cf1b688ba632c50fa45a3e524..33aa9f6547ebc637d11ea1c3e84a29afc941cfc8 100644 (file)
@@ -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"
       }
     {
       "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"
+      ]
     }
   ]
 }