This commit in Ansible:
9142be2f6c
now allows Python modules to specify their interpreter with the shebang.
We expect our roles to use the discovered python interpreter on remote
nodes, and on the executor, we need them to use the virtualenv. Removing
the specific shebang accomplishes this under Ansible 6, and has no effect
under older versions of Ansible.
Without this, for example, the log upload roles would not have access to
their cloud libraries.
Also update our ansible/cli check in our module files. Many of our modules
can be run from the command line for ease of testing, but the check that we
perform to determine if the module is being invoked from the command line
or Ansible fails on Ansible 5. Update it to a check that should work in
all 4 versions of Ansible that Zuul uses.
Change-Id: I4e6e85156459cca032e6c3e1d8a9284be919ccca
This reverts commit 53f2444dbb.
Revert to avoid regression:
https://review.opendev.org/710208 just gave a lot of new linting warnings that look new "py38: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()"
Change-Id: I26c862255cce6b6c99a69d9e3f5f4354db90f953
This is needed to be able to parse output from ansible-lint.
Removes a testcase with a faulty assumption that if the column is
not present the output must be a warning and should not be returned.
It is probably better to allow the user to configure their linting
output themselves.
Also we don't need a separate matcher for sphinx.
Change-Id: I6d06dce921348d3c6fb5a56cdc1e4df675d685c2
The sphinx regex is picking up python warnings. We can disambiguate
the two because sphinx doesn't emit a space before the message but
the python warnings module does. This adjusts the regex to do that
and adds a test file that includes warnings output.
If we need/want to make this more robust, we could also simply filter
the sphinx output for messages that start with " ?\w+Warning:".
We could also decide that we want to include python warnings.
Change-Id: Ib58cc1a2d4f673a0ce3d2a9cae306004559f5b52
We get many false positives on the .tox directory, ignore it.
Even better would be to only handle files under version control but that
is more involved, so use the simple heuristic for .tox for now since
that catches 90+ per cent of the cases.
Change-Id: Ibb17958454a4d6bf156020fe4d9f588f3c666cc7
After stripping the work dir there should not be any absolute path
left that can be related to the repo. Thus filter them so they don't
produce mapping warnings in zuul.
Change-Id: Iadeac9b1faea63aa6009e2cfbc215853695abbe6
Some programs like sphinx emit absolute paths in error messages. Those
cannot be processed by zuul so filter them if they're part of
zuul.project.
Change-Id: Ie8af91017c26f39c3aa9ca098d4230f0688351ce
We shouldn't catch exceptions during parsing without having any
log. This makes debugging impossible. Since errors are now ignored we
can stop silently catching any exception and take the chance to harden
the parsing when we hit exceptions in the future.
Change-Id: Ie58acc4c7fbfcb7e44eef49883fb69f3bccef994
The regex used to filter for line comments needs to be fine tuned for
different linters. Instead having a huge complicated regex add support
for more specialized regexes. Start with a regex that matches spinx
output.
Change-Id: I516086bba315b8bb03a1103e1b33f1a819853be7
keystoneauth has some unit tests which output lines like:
stdin:5:1: K333 'from oslo import utils' must be used instead of 'from oslo import utils'.
The stdin isn't a file, but we try to report it back.
Pass in zuul_work_dir and use it to check that the "file"
is a file that exists.
Change-Id: I2c2aeb4e68f7d50f15ea6c6128fec6050d476c64
To make it clear which tox command a given comment came from
in the case where more than one job has messages, prepend the
tox_envlist parameter to the inline message.
Change-Id: I70228baa285c4e676dc1348c354d4bbf3a3825bc
The `tox_parse_output` currently logs the entire output of tox
into the syslog as the natural Ansible behaviour, as part of doing
that, it also encodes it inside utf-8. This results in errors
in the case that the the data contains surrogates and crashes the
entire job.
Given that this issue really occurs during logging and we don't
have a reason to log all of the tox output to the syslog, this
patch sets the module parameter to `no_log` which should skip the
encoding and logging for that parameter[0].
[0]: https://github.com/ansible/ansible/blob/stable-2.9/lib/ansible/module_utils/basic.py#L1945-L1957
Change-Id: I470cd35111a63662c43f779fc9e119aa8d78c838
Move the zuul requirement from test-requirements into the linters
section of tox.ini because we need it as a src install in the tox
env, so that we can reference the ansible library location.
Change-Id: I089c69b539107bdbc25791f5730502a4f46e7cf6