From ec5bb5ac2cffd2b864c55bda681e6ddb1f5e15f3 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Thu, 17 May 2018 12:39:35 -0500 Subject: [PATCH] Zuul: Initial Airship-Shipyard checks This PS adds the skeleton for a set of zuul checks and gates for Airship, using the framework from OpenStack-Helm. Change-Id: I620f75dd0d450168f5781a870ef8f29d4fd3a0cb Signed-off-by: Pete Birley --- .zuul.yaml | 58 +++++++++++++++++++ .../playbooks/airship-shipyard-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 | 15 +++++ tools/gate/playbooks/zuul-linter.yaml | 20 +++++++ tools/gate/scripts/010-build-charts.sh | 19 ++++++ 10 files changed, 320 insertions(+) create mode 100644 .zuul.yaml create mode 100644 tools/gate/playbooks/airship-shipyard-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 100644 tools/gate/playbooks/zuul-linter.yaml create mode 100755 tools/gate/scripts/010-build-charts.sh diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 00000000..56b2bb36 --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,58 @@ +# 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. + +- project: + check: + jobs: + - airship-shipyard-linter + - airship-shipyard-ubuntu: + voting: false + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + - ^releasenotes/.*$ + gate: + jobs: + - airship-shipyard-linter + # NOTE(portdirect): enable when voting enabled. + # - airship-shipyard-ubuntu: + # irrelevant-files: + # - ^.*\.rst$ + # - ^doc/.*$ + # - ^releasenotes/.*$ + +- job: + name: airship-shipyard-linter + run: tools/gate/playbooks/zuul-linter.yaml + nodeset: openstack-helm-single-node + +- job: + name: airship-shipyard + 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/airship-shipyard-check.yaml + post-run: tools/gate/playbooks/osh-infra-collect-logs.yaml + required-projects: + - openstack/openstack-helm-infra + +- job: + name: airship-shipyard-ubuntu + parent: airship-shipyard + nodeset: openstack-helm-single-node diff --git a/tools/gate/playbooks/airship-shipyard-check.yaml b/tools/gate/playbooks/airship-shipyard-check.yaml new file mode 100644 index 00000000..89cbd90d --- /dev/null +++ b/tools/gate/playbooks/airship-shipyard-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/010-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..eb6ffae1 --- /dev/null +++ b/tools/gate/playbooks/vars.yaml @@ -0,0 +1,15 @@ +# 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. + +null: null diff --git a/tools/gate/playbooks/zuul-linter.yaml b/tools/gate/playbooks/zuul-linter.yaml new file mode 100644 index 00000000..7b6fb37f --- /dev/null +++ b/tools/gate/playbooks/zuul-linter.yaml @@ -0,0 +1,20 @@ +# 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: Execute a Whitespace Linter check + command: find . -not -path "*/\.*" -not -path "*/doc/build/*" -not -name "*.tgz" -type f -exec egrep -l " +$" {} \; + register: result + failed_when: result.stdout != "" \ No newline at end of file diff --git a/tools/gate/scripts/010-build-charts.sh b/tools/gate/scripts/010-build-charts.sh new file mode 100755 index 00000000..878f54ae --- /dev/null +++ b/tools/gate/scripts/010-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 charts