Skip to main content

Convert ansible-lint outputs to a jUnit valid xml tests result file

Project description

https://badge.fury.io/py/ansible-lint-to-junit-xml.png https://travis-ci.org/andreferreirav2/ansible-lint-to-junit-xml.png?branch=master

Convert ansible-lint outputs to a jUnit valid xml tests result file.

Quickstart

Install ansible-lint-to-junit-xml in your preferred Python env

pip install ansible-lint-to-junit-xml

Run ansible-lint on the desired files and pipe to ansible-lint-to-junit-xml

ansible-lint -q -p <file or directly> | ansible-lint-to-junit-xml > results/ansible-lint-results.xml

Alternatively you can run ansible-lint separately from ansible-lint-to-junit-xml and use a file to pass the output

ansible-lint -q -p <file or directly> > ansible-lint-results.txt
ansible-lint-to-junit-xml ansible-lint-results.txt > results/ansible-lint-results.xml

Note: ansible-lint must run with -p for the output to be machine parsable

Features

Example

Running ansible-lint on a file results in:

playbooks/test_playbook.yml:41: [E303] curl used in place of get_url or uri module
playbooks/tasks/example_task.yml:28: [E601] Don't compare to literal True/False

Running ansible-lint and piping the output to ansible-lint-to-junit-xml looks line this:

ansible-lint -q -p playbooks/test_playbook.yml | ansible-lint-to-junit-xml

Would result in:

<?xml version="1.0" ?>
<testsuites>
    <testsuite errors="2" name="ansible-lint" tests="2">
        <testcase name="[E303] curl used in place of get_url or uri module">
            <failure message="playbooks/test_playbook.yml:41: [E303] curl used in place of get_url or uri module" type="ansible-lint">
            ansible-lint error: [E303] curl used in place of get_url or uri module
            ansible-lint error description: [E303] curl used in place of get_url or uri module
            filename: playbooks/test_playbook.yml
            line nr: 41
            </failure>
        </testcase>
        <testcase name="[E601] Don't compare to literal True/False">
            <failure message="playbooks/tasks/example_task.yml:28: [E601] Don't compare to literal True/False" type="ansible-lint">
            ansible-lint error: [E601] Don't compare to literal True/False
            ansible-lint error description: [E601] Don't compare to literal True/False
            filename: playbooks/tasks/example_task.yml
            line nr: 28
            </failure>
        </testcase>
    </testsuite>
</testsuites>

Documentation

The full documentation is at http://ansible-lint-to-junit-xml.rtfd.org.

History

0.1.0 (2019-07-30)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansible-lint-to-junit-xml-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

File details

Details for the file ansible-lint-to-junit-xml-0.1.0.tar.gz.

File metadata

  • Download URL: ansible-lint-to-junit-xml-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15

File hashes

Hashes for ansible-lint-to-junit-xml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf92aa7c8020e2de0830f38a68db9d63052c47c07432f6193d3372cb25473490
MD5 2697c7bcbd5f8fae6e123428655f36c6
BLAKE2b-256 b59695268c22d9d66f9714458b7d300e38554c7278d633924751f5d3b842dc73

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page