From 77864ae609f404af96cca6690e87b458aaf0c1d8 Mon Sep 17 00:00:00 2001 From: diwakar thyagaraj Date: Tue, 12 Jan 2021 23:46:02 +0000 Subject: [PATCH] Enable Make testing functionality * Install dependency packages like docker, runc, make,wget & build-essential * Download and install golang and kubebuilder * Run make tests Co-Authored-By: Sreejith Punnapuzha Change-Id: I6e8aad150c97c313a92426842b9076fc9a6fffbe --- playbooks/test-vino.yaml | 69 ++++++++++++++++++++++++++++++++ playbooks/vars/airship-vino.yaml | 16 ++++++++ zuul.d/jobs.yaml | 5 +++ zuul.d/projects.yaml | 3 ++ 4 files changed, 93 insertions(+) create mode 100644 playbooks/test-vino.yaml create mode 100644 playbooks/vars/airship-vino.yaml diff --git a/playbooks/test-vino.yaml b/playbooks/test-vino.yaml new file mode 100644 index 0000000..1dc2ba2 --- /dev/null +++ b/playbooks/test-vino.yaml @@ -0,0 +1,69 @@ +- hosts: ubuntu-bionic + environment: + GOROOT: '/usr/local/go' + GOBIN: /tmp/bin/ + PATH: /usr/local/go/bin:/tmp/bin/:/usr/local/kubebuilder/bin:{{ ansible_env.PATH }} + tasks: + - name: set default vars + set_fact: + var_files_default: + - airship-vino.yaml + - name: read test variables + include_vars: + file: "vars/{{ var_file }}" + with_items: "{{ var_files | default(var_files_default) }}" + loop_control: + loop_var: var_file + - name: Install Dependent Packages + package: + name: + - docker + - debconf + - runc + - make + - wget + - build-essential + update_cache: yes + state: present + become: yes + - name: Run ensure-docker + include_role: + name: ensure-docker + - name: Ensure docker group exists + group: + name: docker + state: present + - name: Add user "{{ ansible_user }}" to docker group + become: yes + user: + name: "{{ ansible_user }}" + groups: + - docker + append: yes + - name: Reset ssh connection to add docker group to user + meta: reset_connection + ignore_errors: true + - name: Download Extract and install Golang + become: yes + unarchive: + src: https://golang.org/dl/go{{airship_vino.go_lang.go_version}}.linux-amd64.tar.gz + dest: /usr/local/ + remote_src: yes + - name: Download Extract and install Kubebuilder + become: yes + shell: | + wget -c https://github.com/kubernetes-sigs/kubebuilder/releases/download/v{{airship_vino.kube_builder.kube_version}}/kubebuilder_{{airship_vino.kube_builder.kube_version}}_linux_amd64.tar.gz -O - | tar -xz -C /usr/local --one-top-level=kubebuilder --strip-components 1 + args: + executable: /bin/bash + - name: Lint source code + make: + chdir: "{{ zuul.project.src_dir }}" + target: lint + - name: Run test suite + make: + chdir: "{{ zuul.project.src_dir }}" + target: test + - name: Build Docker image + make: + chdir: "{{ zuul.project.src_dir }}" + target: docker-build \ No newline at end of file diff --git a/playbooks/vars/airship-vino.yaml b/playbooks/vars/airship-vino.yaml new file mode 100644 index 0000000..8bfe511 --- /dev/null +++ b/playbooks/vars/airship-vino.yaml @@ -0,0 +1,16 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +airship_vino: + go_lang: + go_version: "1.15.6" + kube_builder: + kube_version: "2.3.1" diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 02a876f..f249622 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -13,3 +13,8 @@ run: playbooks/integration-test.yaml description: Deploys kubernetes and vino timeout: 9600 +- job: + name: airship-vino-test-suite + description: Install kube-builder and tests make functionality. + run: playbooks/test-vino.yaml + timeout: 9600 \ No newline at end of file diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index 294b247..2001d46 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -2,10 +2,13 @@ check: jobs: - airship-deploy-vino + - airship-vino-test-suite gate: jobs: - airship-deploy-vino + - airship-vino-test-suite post: jobs: - airship-vino-upload-git-mirror - airship-deploy-vino + - airship-vino-test-suite \ No newline at end of file