From c1a96769e4dcdf2985a6cc125ebb479af5286ed4 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Wed, 16 May 2018 19:56:44 -0500 Subject: [PATCH] Basic addons gate This PS adds a basic gate, follow on PS's will add deployment testing. Change-Id: I9a980ac811f55eb9aba3d2f358a2636d9b0b54c2 Signed-off-by: Pete Birley --- .zuul.yaml | 32 ++++++++++++++ tools/gate/playbooks/osh-addons-check.yaml | 22 ++++++++++ tools/gate/playbooks/osh-infra-build.yaml | 36 ++++++++++++++++ .../playbooks/osh-infra-collect-logs.yaml | 30 +++++++++++++ .../playbooks/osh-infra-deploy-docker.yaml | 43 +++++++++++++++++++ .../gate/playbooks/osh-infra-deploy-k8s.yaml | 36 ++++++++++++++++ .../playbooks/osh-infra-upgrade-host.yaml | 41 ++++++++++++++++++ tools/gate/playbooks/vars.yaml | 17 ++++++++ tools/gate/scripts/build-charts.sh | 19 ++++++++ 9 files changed, 276 insertions(+) create mode 100644 tools/gate/playbooks/osh-addons-check.yaml create mode 100644 tools/gate/playbooks/osh-infra-build.yaml create mode 100644 tools/gate/playbooks/osh-infra-collect-logs.yaml create mode 100644 tools/gate/playbooks/osh-infra-deploy-docker.yaml create mode 100644 tools/gate/playbooks/osh-infra-deploy-k8s.yaml create mode 100644 tools/gate/playbooks/osh-infra-upgrade-host.yaml create mode 100644 tools/gate/playbooks/vars.yaml create mode 100755 tools/gate/scripts/build-charts.sh diff --git a/.zuul.yaml b/.zuul.yaml index 405fb20e..1e16ffba 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -14,11 +14,43 @@ check: jobs: - openstack-helm-addons-linter + - openstack-helm-addons-ubuntu: + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + - ^releasenotes/.*$ gate: jobs: - openstack-helm-addons-linter + - openstack-helm-addons-ubuntu: + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + - ^releasenotes/.*$ - job: name: openstack-helm-addons-linter run: tools/gate/playbooks/zuul-linter.yaml nodeset: openstack-helm-single-node + +- job: + name: openstack-helm-addons + roles: + - zuul: openstack/openstack-helm-infra + vars: + zuul_osh_infra_relative_path: ../openstack-helm-infra/ + timeout: 7200 + pre-run: + - tools/gate/playbooks/osh-infra-upgrade-host.yaml + - tools/gate/playbooks/osh-infra-deploy-docker.yaml + - tools/gate/playbooks/osh-infra-build.yaml + - tools/gate/playbooks/osh-infra-deploy-k8s.yaml + run: tools/gate/playbooks/osh-addons-check.yaml + post-run: tools/gate/playbooks/osh-infra-collect-logs.yaml + required-projects: + - openstack/openstack-helm-infra + +- job: + name: openstack-helm-addons-ubuntu + parent: openstack-helm-addons + nodeset: openstack-helm-single-node diff --git a/tools/gate/playbooks/osh-addons-check.yaml b/tools/gate/playbooks/osh-addons-check.yaml new file mode 100644 index 00000000..61c81a3c --- /dev/null +++ b/tools/gate/playbooks/osh-addons-check.yaml @@ -0,0 +1,22 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +- hosts: primary + tasks: + - name: Build Charts + shell: | + set -xe; + ./tools/gate/scripts/build-charts.sh + args: + chdir: "{{ zuul_osh_relative_path | default(zuul.project.src_dir) }}" diff --git a/tools/gate/playbooks/osh-infra-build.yaml b/tools/gate/playbooks/osh-infra-build.yaml new file mode 100644 index 00000000..d06296c1 --- /dev/null +++ b/tools/gate/playbooks/osh-infra-build.yaml @@ -0,0 +1,36 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +- hosts: primary + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + gather_facts: True + roles: + - build-helm-packages + tags: + - build-helm-packages + +- hosts: all + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + gather_facts: False + become: yes + roles: + - build-images + tags: + - build-images diff --git a/tools/gate/playbooks/osh-infra-collect-logs.yaml b/tools/gate/playbooks/osh-infra-collect-logs.yaml new file mode 100644 index 00000000..f08f7066 --- /dev/null +++ b/tools/gate/playbooks/osh-infra-collect-logs.yaml @@ -0,0 +1,30 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +- hosts: all + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + logs_dir: "/tmp/logs" + roles: + - gather-host-logs + - helm-release-status + - describe-kubernetes-objects + - gather-pod-logs + - gather-prom-metrics + tags: + - gather-host-logs + - helm-release-status + - describe-kubernetes-objects + - gather-pod-logs + - gather-prom-metrics \ No newline at end of file diff --git a/tools/gate/playbooks/osh-infra-deploy-docker.yaml b/tools/gate/playbooks/osh-infra-deploy-docker.yaml new file mode 100644 index 00000000..4c543245 --- /dev/null +++ b/tools/gate/playbooks/osh-infra-deploy-docker.yaml @@ -0,0 +1,43 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +- hosts: all + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + gather_facts: False + become: yes + roles: + - deploy-python + tags: + - deploy-python + +- hosts: all + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + gather_facts: True + become: yes + roles: + - setup-firewall + - deploy-python-pip + - deploy-docker + - deploy-yq + tags: + - setup-firewall + - deploy-python-pip + - deploy-docker + - deploy-yq diff --git a/tools/gate/playbooks/osh-infra-deploy-k8s.yaml b/tools/gate/playbooks/osh-infra-deploy-k8s.yaml new file mode 100644 index 00000000..5dc2ddeb --- /dev/null +++ b/tools/gate/playbooks/osh-infra-deploy-k8s.yaml @@ -0,0 +1,36 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +- hosts: primary + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + gather_facts: True + roles: + - build-helm-packages + - deploy-kubeadm-aio-master + tags: + - build-helm-packages + - deploy-kubeadm-aio-master + +- hosts: nodes + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + roles: + - deploy-kubeadm-aio-node + tags: + - deploy-kubeadm-aio-node \ No newline at end of file diff --git a/tools/gate/playbooks/osh-infra-upgrade-host.yaml b/tools/gate/playbooks/osh-infra-upgrade-host.yaml new file mode 100644 index 00000000..495b5cb9 --- /dev/null +++ b/tools/gate/playbooks/osh-infra-upgrade-host.yaml @@ -0,0 +1,41 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +- hosts: all + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + gather_facts: False + become: yes + roles: + - deploy-python + tags: + - deploy-python + +- hosts: all + vars_files: + - vars.yaml + vars: + work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}" + gather_facts: True + become: yes + roles: + - upgrade-host + - start-zuul-console + - disable-local-nameserver + tags: + - upgrade-host + - start-zuul-console + - disable-local-nameserver diff --git a/tools/gate/playbooks/vars.yaml b/tools/gate/playbooks/vars.yaml new file mode 100644 index 00000000..1135e326 --- /dev/null +++ b/tools/gate/playbooks/vars.yaml @@ -0,0 +1,17 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +# NOTE(portdirect): for use in the dev-deploy scripts, a valid vars.yaml is +# required, so provide some nonsense, yet harmless input. +dummy_value: "Lorem Ipsum" diff --git a/tools/gate/scripts/build-charts.sh b/tools/gate/scripts/build-charts.sh new file mode 100755 index 00000000..0981807d --- /dev/null +++ b/tools/gate/scripts/build-charts.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright 2017 The Openstack-Helm Authors. +# +# 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. + +set -xe + +make all