Return goaccess html as zuul artifact
This will give us a nice link to the goaccess reports on the zuul dashboard build pages. Move ansible-lint config into config file As of 4.2.0 we can configure ansible-lint with a config file. It's also apparently now smart enough to only find ansible yaml. Let's see how that goes. Add a fake zuul_return module This should let us fake out ansible-lint without having to install all of zuul. Change-Id: Ib233eb577a8ca2aabfe3a49b2cd823dd4a00bd82
This commit is contained in:
parent
703dd8a05a
commit
9e394d24d0
40
.ansible-lint
Normal file
40
.ansible-lint
Normal file
@ -0,0 +1,40 @@
|
||||
parseable: true
|
||||
quiet: true
|
||||
# ANSIBLE0010: Package installs should not use latest
|
||||
# We often deploy latest pip packages
|
||||
#
|
||||
# 204: Lines < 160
|
||||
# Things like keys, script lines, etc exceed this. We have good
|
||||
# taste and only use long lines where appropriate.
|
||||
#
|
||||
# 206: {{var}} should have spaces {{ var }}
|
||||
# This rule seems sane, but it appears there's no way to convince
|
||||
# ansible-lint perfectly good things that are *not* ansible (like
|
||||
# exim configs) in YAML shouldn't have to follow this rule. See
|
||||
# https://github.com/ansible/ansible-lint/issues/534; might be able
|
||||
# to turn on if fixed.
|
||||
#
|
||||
# 306: shells with pipes should use pipefail
|
||||
# This requires running the shell as /bin/bash. There is a small
|
||||
# possibility to hide errors, but we can rely on
|
||||
# developers to decide when to explicitly check for failures.
|
||||
#
|
||||
# 503: tasks that run when "changed" should likely be handlers
|
||||
# We can trust reviewers to decide if something should be a
|
||||
# generic handler or not.
|
||||
skip_list:
|
||||
- ANSIBLE0004
|
||||
- ANSIBLE0006
|
||||
- ANSIBLE0007
|
||||
- ANSIBLE0010
|
||||
- ANSIBLE0011
|
||||
- ANSIBLE0012
|
||||
- ANSIBLE0013
|
||||
- ANSIBLE0015
|
||||
- '204'
|
||||
- '206'
|
||||
- '304'
|
||||
- '306'
|
||||
- '503'
|
||||
use_default_rules: true
|
||||
verbosity: 1
|
@ -60,10 +60,18 @@
|
||||
executable: /bin/bash
|
||||
# Not using normal zuul job roles as static.opendev.org is not a
|
||||
# test node with all the normal bits in place.
|
||||
# TODO: should this be an artifact instead?
|
||||
- name: Collect log output
|
||||
synchronize:
|
||||
dest: "{{ zuul.executor.log_root }}/{{ goaccess_site }}_goaccess_report.html"
|
||||
mode: pull
|
||||
src: "/home/zuul/{{ goaccess_site }}_goaccess_report.html"
|
||||
verify_host: true
|
||||
- name: Return goaccess artifact to Zuul
|
||||
zuul_return:
|
||||
data:
|
||||
zuul:
|
||||
artifacts:
|
||||
- name: "Goaccess report"
|
||||
url: "{{ goaccess_site }}_goaccess_report.html"
|
||||
metadata:
|
||||
type: html_report
|
||||
|
11
tools/fake-ansible/library/zuul_return.py
Normal file
11
tools/fake-ansible/library/zuul_return.py
Normal file
@ -0,0 +1,11 @@
|
||||
# This is a fake zuul_return to make ansible-lint happy
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
data=dict(default=None),
|
||||
path=dict(default=None, type=str),
|
||||
file=dict(default=None, type=str),
|
||||
)
|
||||
)
|
31
tox.ini
31
tox.ini
@ -11,6 +11,8 @@ deps = -r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:linters]
|
||||
whitelist_externals = bash
|
||||
setenv =
|
||||
ANSIBLE_LIBRARY= {toxinidir}/tools/fake-ansible/library
|
||||
commands =
|
||||
flake8
|
||||
{toxinidir}/tools/run-bashate.sh
|
||||
@ -21,34 +23,7 @@ commands =
|
||||
# parses, but doesn't do anything.
|
||||
bash -c "ANSIBLE_INVENTORY_PLUGINS=./playbooks/roles/install-ansible/files/inventory_plugins ansible -i ./inventory/openstack.yaml not_a_host -a 'true'"
|
||||
python3 -m unittest playbooks/roles/install-ansible/files/inventory_plugins/test_yamlgroup.py
|
||||
# Ansible Lint Check
|
||||
#
|
||||
# ANSIBLE0010: Package installs should not use latest
|
||||
# We often deploy latest pip packages
|
||||
#
|
||||
# 204: Lines < 160
|
||||
# Things like keys, script lines, etc exceed this. We have good
|
||||
# taste and only use long lines where appropriate.
|
||||
#
|
||||
# 206: {{var}} should have spaces {{ var }}
|
||||
# This rule seems sane, but it appears there's no way to convince
|
||||
# ansible-lint perfectly good things that are *not* ansible (like
|
||||
# exim configs) in YAML shouldn't have to follow this rule. See
|
||||
# https://github.com/ansible/ansible-lint/issues/534; might be able
|
||||
# to turn on if fixed.
|
||||
#
|
||||
# 306: shells with pipes should use pipefail
|
||||
# This requires running the shell as /bin/bash. There is a small
|
||||
# possibility to hide errors, but we can rely on
|
||||
# developers to decide when to explicitly check for failures.
|
||||
#
|
||||
# 503: tasks that run when "changed" should likely be handlers
|
||||
# We can trust reviewers to decide if something should be a
|
||||
# generic handler or not.
|
||||
bash -c "find roles playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \
|
||||
ansible-lint -x ANSIBLE0004 -x ANSIBLE0006 -x ANSIBLE0007 -x ANSIBLE0010 \
|
||||
-x ANSIBLE0011 -x ANSIBLE0012 -x ANSIBLE0013 -x ANSIBLE0015 \
|
||||
-x 204 -x 206 -x 304 -x 306 -x 503"
|
||||
ansible-lint playbooks roles
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
Loading…
Reference in New Issue
Block a user