This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linters & syntax check in tox and extra docker tests in travis CI
- Loading branch information
Showing
16 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.tox | ||
*.retry | ||
roles/provision_docker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
sudo: required | ||
language: python | ||
python: | ||
- "2.7" | ||
|
||
services: | ||
- docker | ||
|
||
env: | ||
global: | ||
- ANSIBLE_HOST_KEY_CHECKING="False" | ||
matrix: | ||
- TEST_NAME=4.1 | ||
- TEST_NAME=master | ||
- TEST_NAME=upgrade-4.1-to-master | ||
# Tests on previous versions cannot be enabled on Centos | ||
# because of https://github.com/rhevm-qe-automation/ovirt-ansible/issues/155 | ||
|
||
# Install python-pip | ||
addons: | ||
apt: | ||
packages: | ||
- python-pip | ||
|
||
install: | ||
- pip install tox ansible docker-py | ||
|
||
# Check ansible version | ||
- ansible --version | ||
|
||
# Install ansible role tests requirements | ||
- ansible-galaxy install -r tests/requirements.yml -p tests/roles/ | ||
|
||
script: | ||
# Run sytax checks and linters | ||
- tox | ||
# Execute oVirt engine deployment playbook | ||
- travis_wait 20 ansible-playbook tests/test-${TEST_NAME}.yml -i tests/inventory --skip-tags skip-travis -vvv | ||
|
||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
line-length: disable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ansible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ansible-lint | ||
yamllint | ||
flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- name: Bring up docker containers | ||
hosts: localhost | ||
gather_facts: false | ||
roles: | ||
- role: provision_docker | ||
provision_docker_inventory_group: "{{ groups['engine'] }}" | ||
|
||
- name: "Update python because of ovirt-imageio-proxy" | ||
hosts: engine | ||
tasks: | ||
- name: Update python | ||
yum: | ||
name: python-libs | ||
state: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Run ovirt-ansible roles on containerized environments | ||
hosts: engine | ||
vars_files: | ||
- passwords.yml | ||
vars: | ||
ovirt_engine_setup_type: "ovirt-engine" | ||
ovirt_engine_setup_version: "{{ ovirt_engine_setup_version }}" | ||
ovirt_engine_setup_hostname: "localhost" | ||
ovirt_engine_setup_organization: "example.com" | ||
ovirt_engine_setup_dwh_db_configure: true | ||
ovirt_engine_setup_dwh_db_host: "localhost" | ||
ovirt_engine_setup_firewall_manager: null | ||
ovirt_repositories_ovirt_release_rpm: "{{ ovirt_release_rpm }}" | ||
roles: | ||
- role: oVirt.repositories | ||
- role: oVirt.engine-setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Run ovirt-ansible roles on containerized environments | ||
hosts: engine | ||
vars_files: | ||
- passwords.yml | ||
vars: | ||
ovirt_engine_setup_type: "ovirt-engine" | ||
ovirt_engine_setup_version: "{{ ovirt_engine_setup_version }}" | ||
ovirt_engine_setup_hostname: "localhost" | ||
ovirt_engine_setup_organization: "example.com" | ||
ovirt_engine_setup_firewall_manager: null | ||
ovirt_engine_setup_dwh_db_configure: false | ||
ovirt_repositories_ovirt_release_rpm: "{{ ovirt_release_rpm }}" | ||
roles: | ||
- role: oVirt.repositories | ||
- role: oVirt.engine-setup | ||
# --accept-defaults needed because of: https://bugzilla.redhat.com/show_bug.cgi?id=1518697 | ||
# Can be solved also with https://bugzilla.redhat.com/show_bug.cgi?id=1396925 | ||
ovirt_engine_setup_accept_defaults: true | ||
ovirt_engine_setup_answer_file_path: "answerfile_{{ ovirt_engine_setup_version }}_upgrade.txt.j2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python" | ||
|
||
[engine] | ||
engine_centos7 image="katerinak/c7-systemd-utf8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
# As an example this file is keep in plaintext, if you want to | ||
# encrypt this file, please execute following command: | ||
# | ||
# $ ansible-vault encrypt passwords.yml | ||
# | ||
# It will ask you for a password, which you must then pass to | ||
# ansible interactively when executing the playbook. | ||
# | ||
# $ ansible-playbook myplaybook.yml --ask-vault-pass | ||
# | ||
ovirt_engine_setup_admin_password: 123456 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- src: chrismeyersfsu.provision_docker | ||
name: provision_docker | ||
- src: oVirt.repositories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- import_playbook: containers-deploy.yml | ||
- import_playbook: engine-deploy.yml | ||
vars: | ||
ovirt_engine_setup_version: "4.1" | ||
ovirt_release_rpm: "http://plain.resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- import_playbook: containers-deploy.yml | ||
- import_playbook: engine-deploy.yml | ||
vars: | ||
ovirt_engine_setup_version: "4.2" | ||
ovirt_release_rpm: "http://plain.resources.ovirt.org/pub/yum-repo/ovirt-release-master.rpm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- import_playbook: containers-deploy.yml | ||
- import_playbook: engine-deploy.yml | ||
vars: | ||
ovirt_engine_setup_version: "4.1" | ||
ovirt_release_rpm: "http://plain.resources.ovirt.org/pub/yum-repo/ovirt-release41.rpm" | ||
- import_playbook: engine-upgrade.yml | ||
vars: | ||
ovirt_engine_setup_version: "4.2" | ||
ovirt_release_rpm: "http://plain.resources.ovirt.org/pub/yum-repo/ovirt-release-master.rpm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[tox] | ||
skipsdist = True | ||
envlist = linters | ||
|
||
[testenv] | ||
deps = | ||
-r{toxinidir}/requirements.txt | ||
-r{toxinidir}/test-requirements.txt | ||
whitelist_externals = bash | ||
|
||
|
||
[testenv:ansible-lint] | ||
commands = bash -c "\ | ||
ansible-lint "{toxinidir}"/tests/test*.yml" | ||
|
||
[testenv:yamllint] | ||
commands = bash -c "\ | ||
yamllint \ | ||
-c {toxinidir}/.yamllint \ | ||
{toxinidir}/tasks \ | ||
{toxinidir}/tests/*.yml" | ||
|
||
[testenv:ansible-syntax] | ||
commands = bash -c "\ | ||
ansible-galaxy install -r tests/requirements.yml -p tests/roles/; \ | ||
ansible-playbook \ | ||
--syntax-check \ | ||
--list-tasks \ | ||
{toxinidir}/tests/test*.yml" | ||
|
||
[testenv:linters] | ||
commands = | ||
{[testenv:yamllint]commands} | ||
{[testenv:ansible-syntax]commands} | ||
{[testenv:ansible-lint]commands} |