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 <Sreejith.Punnapuzha@outlook.com>
Change-Id: I6e8aad150c97c313a92426842b9076fc9a6fffbe
This commit is contained in:
diwakar thyagaraj 2021-01-12 23:46:02 +00:00
parent 060dfdff3b
commit 77864ae609
4 changed files with 93 additions and 0 deletions

69
playbooks/test-vino.yaml Normal file
View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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