diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8b42eb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.retry diff --git a/tests/ansible/lint.yaml b/tests/ansible/lint.yaml new file mode 100644 index 0000000..f62ef67 --- /dev/null +++ b/tests/ansible/lint.yaml @@ -0,0 +1,33 @@ +--- +- hosts: primary + tasks: + - block: + - name: Ensuring ansible-lint package is present + fail: + msg: "Centos or RHEL is not yet supported" + when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' + + - name: Ensuring ansible-lint package is present + become: true + apt: + name: ansible-lint + state: present + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + + + - name: find files to lint + find: + paths: + - "{{ src_dir| default('../..') }}/playbooks" + - "{{ src_dir| default('../..') }}/roles" + patterns: + - "*.yaml" + - "*.yml" + register: files_to_lint + +# TODO (kkalynovskyi) develop suitable ansible-lint configuration + - name: run ansible-lint against found files + command: "ansible-lint {{ item.path }}" + with_items: "{{ files_to_lint.files }}" + + diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml new file mode 100644 index 0000000..7764817 --- /dev/null +++ b/zuul.d/jobs.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. + +- job: + name: ansible-lint-airship + run: tests/ansible/lint.yaml + nodeset: ubuntu-single-airship \ No newline at end of file diff --git a/zuul.d/nodesets.yaml b/zuul.d/nodesets.yaml new file mode 100644 index 0000000..84caf6f --- /dev/null +++ b/zuul.d/nodesets.yaml @@ -0,0 +1,17 @@ +# 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. + +- nodeset: + name: ubuntu-single-airship + nodes: + - name: primary + label: ubuntu-bionic diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml new file mode 100644 index 0000000..0e5189b --- /dev/null +++ b/zuul.d/project.yaml @@ -0,0 +1,7 @@ +- project: + check: + jobs: + - ansible-lint-airship + gate: + jobs: + - ansible-lint-airship