This is preparation for a later version of ansbile-lint, which finds
missing names on blocks. This seems a reasonable rule, and the
Ansible manual says [1]
Names for blocks have been available since Ansible 2.3. We recommend
using names in all tasks, within blocks or elsewhere, for better
visibility into the tasks being executed when you run the playbook.
This simply adds a name tag for blocks that are missing it. This
should have no operational change, but allows us to update the linter
in a follow-on change.
[1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html
Change-Id: I92ed4616775650aced352bc9088a07e919f1a25f
This fixes a number of places where we do not have spaces between
filters. I think that this is a reasonable rule for readability (I
also think it probably was enforced, but maybe later versions got
better at detecting it?).
These are detected by a later version of Ansible lint; this change
should have no operational change to any roles but prepares us to
update in a follow-on change.
Change-Id: I07e1a109b87adce86f483d14d7e02fcecb8313d5
In some situations, projects may not keep a tox.ini in the root
directory of their repository, or may even have multiple tox
configuration files. Allow the location and name of the config to be
overridden explicitly through the use of a new rolevar.
Change-Id: I1927142e6d9fa75e96902ae001c8ca98d69c7443
Also we can parse the output from --showconfig to se which
testenvs we should act upon when installing siblings.
Change-Id: I438035c92d62102c80db9bed81e9f290e4c941b2
Since tox_envlist has a default value it cannot be undefined
so the fail task will never run. Instead handle the case when
tox_envlist is an empty string by getting the default configured
envlist from tox. Also handle the casewhen tox_envlist is 'ALL'.
This also updates tox_install_sibling_packages to correctly
handle multiple testenvs and uses configuration supplied by
'tox --showconfig -e <envlist>' instead of guessing where the
envdir and logdir are located.
We also cannot run tox inside python because it gets complicated
to know which tox_executable we should call during the python test
cases so run these commands in ansible and pass the output to
tox_install_sibling_packages.
Since role params have higher precedence than set_fact we set an
internal _tox_envlist fact that is a comma separated list of testenvs
that should be run.
Change-Id: I9e5a1b041f653cbcff7b8ed62e4a95a0a040fdd7
The line comments needs to run after the tox run so we set failed_when
to true. However this task won't be shown as failed in the log
then. Instead ignore errors to let the playbook continue and keep the
erorr status.
Change-Id: I6f2a4043de982aa3de6e0cc4eb489914fd5805c2
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
Sometimes there are linters that are producing output where
people do not care about it enough to want to see it.
Change-Id: I0d58a3f6a4c51e1419b645a7ce1a81e6adee57d3
Retrieving file comments is not an essential part of the job and
should not fail the job if something goes wrong.
Change-Id: Ide13343c6eda3a1fd0f45cb33cba35f3b048ece6
This allows to use lower-constraints.txt more easily as input
when everyone has switched over.
Depends-On: https://review.opendev.org/660823
Change-Id: I3f957187ed4f29fcf88db99cb79fb33b21a8dd8d
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
There is a bunch of duplicate logic between tox and tox-siblings, the
tox-siblings logic is already protected with a flag - and having them be
split already led to not doing the right thing with constraints files in
siblings when we did it right in tox itself.
Combine them into one role.
This means the siblings code will run as part of run instead of as part
of pre- but that's how things have worked for years anyway until
siblings was introduced - and is also the behavior is the siblings flag
is false -so it's more consistent overall.
Leave a no-op tox-siblings role so that we can gracefully remove the use of
tox-siblings from castellan, python-openstacksdk, shade and tacker.
Change-Id: Id61ae52d48b28cfc2221cb556a1c1f7c6dfd60dd
In the tox job it's nice to see what it is that we're gonna run. It's in
the json file, but that's a little bit hidden.
Change-Id: Iebe4b4c67d00ebc21be9038e06f1ee09badb4eb1
Create a parameter called tox_upper_constraints. The parameter points
to a file on the system. If the file exists, it will be passed to the
tox invocation in the UPPER_CONSTRAINTS_FILE environment variable.
This allows a global setting in a base job of a known file to be the
UPPER_CONSTRAINTS_FILE file, or for that to be overridden on a per-job
basis. For people who do not know or care what an
UPPER_CONSTRAINTS_FILE file is, the behavior should be a no-op.
Also, collapse tox_environment and tox_environment_defaults.
zuul already does variable merging on parent and child jobs, so we don't
need to do it in the playbook.
While we're in there, clean up a few small things in the yaml. Notably,
jlk says we should not put variables in task names, and we don't need
quotes around strings if they don't have special characters.
Change-Id: Ibede59ca6f85914952da175c77ea29391ef9a88c
Remove large chuck of run-tests.sh that was copypasta inside our
ansible tox role.
Change-Id: I53f2619a99e93be0ac210bf4254e37e441a7aaa2
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This logic makes more sense in the fetch-testr-output role. I've also
left a few TODO action for a followup patch. Specifically, this
still depends some openstack-infra configuration.
Change-Id: Iea8968708e3e80f0d21434ec08fff5e4ee7bdf4d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Expose the ability for tox jobs to define a default set of
environmental variables to pass to the tox role. We also do a few new
things.
Check to see if tox_environment and tox_environment_defaults are
defined, if so combined tox_environment_defaults with
tox_environment creating a new my_tox_environment variable.
Variables defined in tox_environment take priority when we combine
variables.
Change-Id: Ic4a5644e79ca7000cbdaee40467619a6832c8332
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This was legacy code needed for openstack-infra logging servers. We
can stop doing this in our tox role.
It is possible a job would want to do this, but it now makes more
sense to hav this happen as a post-run task in the job.
Change-Id: I981eb99468a352386f268fe6b8911291a93957ef
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
We no longer want to depend on these files directly. So lets remove
them.
Change-Id: Id9b91de774253bd0c33d8d2c9fd840528edac976
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This is something we did in openstack-infra but not sure it make sense
for default tox jobs. It is possible we want to make this an ansible
role for playbooks to opt into post-run. But with properly logging on
a job, it should be straightforward to determine why a tox test
failed.
Change-Id: I746fae586a3df40a07ceca9c0bebe579f9f74f34
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Make this variable a hard requirement, since we depend on it so much.
Also removes inline bash script logic.
Change-Id: Ic3e8831fd81e408e1cc7b393182ba15b953e8ce0
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Tox 2.4 will do this today by default:
http://tox.readthedocs.io/en/latest/config.html#confval-list_dependencies_command
It also means it is much easier for tox jobs to change pip freeze to
some other command (eg: pbr freeze).
Change-Id: I862a783500c46db99ac0971c88631764a2f982f2
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This doesn't make much sense in an ansible only world. There is my
ways today to block sudo or check if sudo failed with ansible. No need
to include our custom bash script for this check.
If a job wants sudo, they can either not use the revoke-sudo role or
write another job.
Change-Id: I267541a813b5ff6e7301f50421af46a0db33304d
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
It make sense to compress subunit file we want from tox before
uploading it to our log server.
Change-Id: Ibb1b6cedce0350f8c2baf40718a909f30ce954d7
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This is openstack specific code and not needed in our role tox.
Change-Id: I7c963944e94f427836a643f86bde8881cb9383d0
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This logic is very specific to openstack-infra and now that we have
exposed tox_environment, it is much easier for jobs to pass into shell
variables into our tox based roles.
Change-Id: I6c5897088158e1e4917d29d72f523f853c254314
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Because we run tox using the shell task, it is possible users will
need to pass custom shell variables to their tox.ini files. Expose a
way for users to do just that.
Change-Id: I0a0c15d85d91fe0a23cf688f0b0f228133922264
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Rename tox_environment to tox_envlist to better map with tox --help
documentation. This also allows the following patch to support shell
environmental variables.
Change-Id: I2fb4e1c167ef93ad2948f2d328beff5e39ac52b7
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
We'd like to be able to make some jobs that run tox on other projects
for ease of testing. This should allow us to do that.
Change-Id: I774a76eaaea16d8ea218b439a099b5c9335c2fc5
The original idea was that we'd have a "python27" job. But it turns out
that "python27" isn't actually as universal as you might think.
"tox-py27" on the other hand is a thing that can and should always work
for people who want to run tox with the py27 env.
Port in the jobs we had in openstack-zuul-jobs.
Also, copy in the text of the old shell scripts so that we can iterate on
them and make them better piecemeal.
These are named zuul-tox not tox because we already have tox jobs
defined elsewhere. We'll need to do the naming dance while we work on
them.
Change-Id: I813f3f2ae138c07918556bc81655518023527131