From 1ade2e91bec59ed05897adb39d2f9df460bf9c7f Mon Sep 17 00:00:00 2001 From: Tin Lam Date: Tue, 14 Nov 2017 03:22:28 -0600 Subject: [PATCH] Gate: migrate to zuul v3 This patch set applies zuul v3 into openstack-helm-addons repository similar to the other OSH repos. Change-Id: Icdeaa8dbed381ee4264e1d015b87be700b97ddb0 --- .zuul.yaml | 24 +++++++ tools/gate/playbooks/legacy-gate-post.yaml | 31 +++++++++ tools/gate/playbooks/legacy-gate-runner.yaml | 66 ++++++++++++++++++++ tools/gate/playbooks/zuul-linter.yaml | 20 ++++++ 4 files changed, 141 insertions(+) create mode 100644 .zuul.yaml create mode 100644 tools/gate/playbooks/legacy-gate-post.yaml create mode 100644 tools/gate/playbooks/legacy-gate-runner.yaml create mode 100644 tools/gate/playbooks/zuul-linter.yaml diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 00000000..405fb20e --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,24 @@ +# 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: + - openstack-helm-addons-linter + gate: + jobs: + - openstack-helm-addons-linter + +- job: + name: openstack-helm-addons-linter + run: tools/gate/playbooks/zuul-linter.yaml + nodeset: openstack-helm-single-node diff --git a/tools/gate/playbooks/legacy-gate-post.yaml b/tools/gate/playbooks/legacy-gate-post.yaml new file mode 100644 index 00000000..e0b6411e --- /dev/null +++ b/tools/gate/playbooks/legacy-gate-post.yaml @@ -0,0 +1,31 @@ +# 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: + logs_dir: "/tmp/logs" + environment: + LOGS_DIR: "{{ logs_dir }}" + tasks: + - name: Capture logs from environment + shell: ./tools/gate/dump_logs.sh 0 + args: + chdir: "{{ zuul.project.src_dir }}" + ignore_errors: yes + - name: Downloads logs to executor + synchronize: + src: "{{ logs_dir }}/" + dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}" + mode: pull + ignore_errors: yes diff --git a/tools/gate/playbooks/legacy-gate-runner.yaml b/tools/gate/playbooks/legacy-gate-runner.yaml new file mode 100644 index 00000000..47014160 --- /dev/null +++ b/tools/gate/playbooks/legacy-gate-runner.yaml @@ -0,0 +1,66 @@ +# 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: Create nodepool directory + become: true + become_user: root + file: + path: /etc/nodepool + state: directory + mode: 0777 + - name: Create nodepool sub_nodes file + copy: + dest: /etc/nodepool/sub_nodes + content: "" + - name: Create nodepool sub_nodes_private file + copy: + dest: /etc/nodepool/sub_nodes_private + content: "" + - name: Populate nodepool sub_nodes file + lineinfile: + path: /etc/nodepool/sub_nodes + line: "{{ hostvars[item]['nodepool']['private_ipv4'] }}" + with_items: "{{ groups['nodes'] }}" + when: groups['nodes'] is defined + - name: Populate nodepool sub_nodes_private file + lineinfile: + path: /etc/nodepool/sub_nodes_private + line: "{{ hostvars[item]['nodepool']['private_ipv4'] }}" + with_items: "{{ groups['nodes'] }}" + when: groups['nodes'] is defined + - name: Create nodepool primary file + copy: + dest: /etc/nodepool/primary_node + content: "{{ hostvars['primary']['nodepool']['private_ipv4'] }}" + when: hostvars['primary'] is defined + - name: Create nodepool node_private for this node + copy: + dest: /etc/nodepool/node_private + content: "{{ nodepool.private_ipv4 }}" + - name: Run OSH Deploy + shell: | + set -xe; + export INTEGRATION=multi + export INTEGRATION_TYPE=basic + export PVC_BACKEND=ceph + export ZUUL_VERSION=v3 + export KUBECONFIG=${HOME}/.kube/config + export SDN_PLUGIN="{{ sdn_plugin }}" + export GLANCE="{{ glance_backend }}" + kubectl get nodes -o wide + ./tools/gate/setup_gate.sh + args: + chdir: "{{ zuul.project.src_dir }}" 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