From 635a6e3b85d397f75578bf08c944713279e2c7b7 Mon Sep 17 00:00:00 2001 From: "dt241s@att.com" Date: Tue, 26 Jan 2021 20:32:15 +0000 Subject: [PATCH] Enable Make testing Functionailty Change-Id: I6076f4162b3feb2f961bd38e968481168edff465 --- playbooks/test-sip.yaml | 65 +++++++++++++++++++++++++++++++++ playbooks/vars/airship-sip.yaml | 16 ++++++++ zuul.d/jobs.yaml | 7 +++- zuul.d/projects.yaml | 2 + 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 playbooks/test-sip.yaml create mode 100644 playbooks/vars/airship-sip.yaml diff --git a/playbooks/test-sip.yaml b/playbooks/test-sip.yaml new file mode 100644 index 0000000..6c0fca6 --- /dev/null +++ b/playbooks/test-sip.yaml @@ -0,0 +1,65 @@ +- 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-sip.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_sip.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_sip.kube_builder.kube_version}}/kubebuilder_{{airship_sip.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: Run test suite + make: + chdir: "{{ zuul.project.src_dir }}" + target: test + - name: Build Docker image + make: + chdir: "{{ zuul.project.src_dir }}" + target: docker-build diff --git a/playbooks/vars/airship-sip.yaml b/playbooks/vars/airship-sip.yaml new file mode 100644 index 0000000..878ad25 --- /dev/null +++ b/playbooks/vars/airship-sip.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_sip: + 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 cba78f7..83985ee 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -12,4 +12,9 @@ name: airship-deploy-sip run: playbooks/integration-tests.yaml description: Deploys kubernetes and sip - timeout: 9600 \ No newline at end of file + timeout: 9600 +- job: + name: airship-sip-test-suite + description: Install kube-builder and tests make functionality. + run: playbooks/test-sip.yaml + timeout: 9600 diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index f47fe1a..62ea218 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -2,9 +2,11 @@ check: jobs: - airship-deploy-sip + - airship-sip-test-suite gate: jobs: - airship-deploy-sip + - airship-sip-test-suite post: jobs: - airship-sip-upload-git-mirror \ No newline at end of file