Commit Graph

29 Commits

Author SHA1 Message Date
Marc Gariepy 0a244ca090 auto-detect interpreter
setting ANSIBLE_PYTHON_INTERPRETER to auto will use the value from the
ansible/config/base.yml

debian gets a /usr/bin/python3 for now and need to revisit once we have
ansible 2.10.

Change-Id: I503c1b71c0d01eea668500c0125c752c0584a7ef
Co-Authored-By: Jonathan Rosser <jonathan.rosser@rd.bbc.co.uk>
2020-06-11 14:43:02 -04:00
Jonathan Rosser b4355c9360 Install python3 tools and libraries instead of python2
Change-Id: Ibe3b9fe5f3ec46524c7ac039789163d77dacb710
2020-03-10 14:44:33 +02:00
Jonathan Rosser 0c1e2c2c0e Ansible 'match' and 'search' is a test not a filter
Older ansible versions used match as a filter but this is no longer
valid, and match and search should be used as a test

Change-Id: I7017220f04fa98ea5d7f1f6e511a395963308b47
2019-11-01 13:53:18 +02:00
Logan V 7a3e528929 Fix clone list for opendev changes
Change-Id: I67ebe9e813c95a3a8bcf204678ddccbcea7a45cd
2019-05-03 14:26:16 -06:00
Mohammed Naser c68f0f5c10 opendev: fix cutover bugs
- Update ZUUL_TESTS_CLONE_LOCATION path to new OpenDev path
- Update location of clones repos

Co-Authored-By: Jonathan Rosser <jonathan.rosser@rd.bbc.co.uk>
Change-Id: I3968602b5ddf8a7d3f4292bbc8744d8d6daf1395
2019-04-20 16:26:34 +00:00
Jesse Pretorius 85b51389cc Use local connection and become for localhost plays
When targeting localhost with 'remote_user: root' and
using 'become: yes' we lose the environment variables
for the user running the playbook (eg: USER, HOME).

However, if we use 'connection: local' and 'become: yes'
together, it works properly.

To ensure these plays have the correct access to change
things on the host, we apply this change to them all.

We also ensure that 'become: no' is explicitly set on
any local connection plays to make the intent more
obvious. Finally, we also use 'yes' and 'no' uniformly.

Change-Id: I6e4607dd4aaffa0bfcda254103697bf9b28eca1a
2018-07-14 14:37:06 +01:00
Markos Chandras 2dac764ac9 get-ansible-role-requirements: Use refspec when outside of OpenStack CI
This is a fixup for a6e2e511a47e("Use refspec to try Gerrit changes").
We also need to take the refspec parameter into consideration when
cloning repositories outside of OpenStack CI. This will facilitate
manual testing.

Change-Id: Ie96eb6dcd14cfec8c2b3813fbd67eef441178cdb
2018-06-15 10:46:03 +01:00
Markos Chandras a6e2e511a4 get-ansible-role-requiremnets: Use refspec to try Gerrit changes
Without this patch, deployers have to mimic zuul structure
to locally test Gerrit patches in-depth, with their specific
references, before they are merged into the main tree.

This is a problem for people wanting to not change the location
of the openstack-ansible folder.

This patches solves the problem by using the refspec
parameter of the ansible git module: A user can then
edit its own ansible-role-requirements for testing
patches.

Change-Id: I6c0fa078da3f32b542d3a3492a0fb79c822a5f8d
2018-06-07 12:35:04 +00:00
Jesse Pretorius 0fa83f7d3d Do not clone role being tested as a dep outside openstack-ci
When executing the clones outside of openstack-ci, we should
verify that we're not cloning the role repository for the role
we are testing because we already have it.

Change-Id: Ibc64fc5c97f0b711934eb3e297159b0d38587647
2018-04-30 17:47:13 +01:00
Jesse Pretorius 14fc2af8cc Test repos with the ansible-role prefix in openstack-ci
Now that we're using a broader range of repository names,
we need to adjust how we implement the role linking to
ensure that the new role names are catered for.

Change-Id: I43efc47dcacdfba31193f7f8a3159a1d0481c586
2018-04-27 18:59:39 +01:00
Jesse Pretorius 8908a96546 Remove zuul v2 shim
There is absolutely no chance that zuul will be reverted
back to v2, so let's remove the extra code.

Change-Id: Ia3e4c5ea6514f9caeeea936afd10fac9a54a09c8
2018-04-27 18:29:00 +01:00
Markos Chandras 4bb840d2de Skip ansible-lint test against roles
In order to decouple changes in the roles repositories from changes
needed in other repositories due to the ansible-lint test, the roles
repositories will skip all dependent roles when executing the lint test.
The roles can be updated in time as patches are submitted to those
repositories. In order to do that, we need to stop symlinking the
role into the same directory where its dependent roles are and place
it to its own directory so we can ignore the dependent roles in
ansible-lint.

Change-Id: I49c01fb63054e45bae5ae45a89cce986579959de
Closes-Bug: #1737310
2017-12-19 11:14:18 +00:00
Jesse Pretorius d861c3902d Improve lint test flexibility
Currently the ansible-syntax and ansible-lint tests
assume the playbook to be tested against, the role
requirements file location and a single path for all
roles. This patch allows these to be modified so that
the tests can be used for the integrated repo which
does not have the same structure as the roles.

Various lint failures are no being picked up with
these modifications, so they're resolved using quick
hacks.

Change-Id: I8bea90082dbde7de49c5e2e86d298c017b16591d
2017-11-17 15:38:43 +00:00
Jesse Pretorius a70706c2f5 Implement retries for git clones
There have been several failures due to git clone TLS handshake
fails.

This patch implement the use of clone depth in order to reduce
the amount of data being cloned. This will not always work as
depth only works when the clone is from a ref, but it will help
in those circumstances.

This patch also implements retries with a delay between each
retry in order to try and improve the success rate.

Change-Id: I72a7d39218c307fc1c6f108b81f35d2cd5bb5c66
2017-11-10 10:40:22 +00:00
Jesse Pretorius ac930796d6 Initial OSA zuul v3 role jobs
This patch implements an initial set of jobs intended to match
the current job execution method. It does not intend to improve
how the jobs are executed - only to replicate what is currently
in openstack-infra/openstack-zuul-jobs and provide the platform
to iterate on.

Change-Id: Iafe9f3622037d7ba71f9ba8b73217f9e2070f246
2017-10-17 13:40:52 +01:00
Jesse Pretorius b58a2c0287 Implement zuul v2/v3 role fetch shim
In order to be able to simultaneously work with the
differing implementations of zuul-cloner in zuul v2
and zuul v3 we implement a detection routine to
behave appropriately for each version.

This is very much a band-aid just to help us transition
because once the transition to zuul v3 is complete we
should be able to ditch this whole playbook for
something built into zuul v3, and use something very
simple for executing tests when not using zuul.

Change-Id: Ic824e7ca7c564d5de7a27c77a79014ad274afade
2017-10-16 18:08:05 +01:00
Jesse Pretorius c8ca914004 Make zuul ignore roles named 'previous_*'
In order to facilitate upgrade testing of more
than just openstack roles, we use the previous_
prefix and need zuul to ignore those.

Change-Id: Ic881bf3acf6fb6daf71611c26322f02fb8b0b9be
2017-07-14 13:47:05 +01:00
Jesse Pretorius fb5b3612a3 Enable ARA cross-repo testing
When executing tests in OpenStack-CI, this patch
enables the use of 'Depends-On: <change-id>' in
the commit message to execute the test using a
patch that is still in review for the openstack/ara
repository.

This patch also lays the ground for similar testing
to be done with other openstack repositories, but
that will no work just yet as it will take quite a
bit more machinery to make the cloned repositories
be used to build the venvs. That work will be
submitted in subsequent patches.

Change-Id: I7bc665bc7f8dd1759f521622e7607c089696a546
2017-05-04 18:34:50 +01:00
Jenkins ff7cc014b7 Merge "Clone tests repo to the right place" 2017-05-04 10:59:52 +00:00
Jesse Pretorius fa4937e52e Remove connection: local usage
In Ansible 2.3 the local connection plugin overrides
the host vars for the ansible_python_interpreter,
causing tests to use the wrong interpreter and
install python packages into unexpected locations.
This is especially visible when using host
delegation to localhost instead of the targeting
localhost directly.

To ensure that the behaviour remains consistent with
our expectations all local connection usage for
localhost is removed and localhost is targeted as
a remote host.

Change-Id: Ifcccf3c25aa10085b35017b01644354e10eca15a
2017-05-02 15:39:36 +01:00
Jesse Pretorius 3476d33db5 Clone tests repo to the right place
When including a patch from the tests repo, it's not
cloned to the right place. This should ensure that
it is.

Change-Id: Ia1edf6454823880554f9beeb20e821e9d15413af
2017-04-28 19:08:31 +01:00
Jenkins 58f9994ff7 Merge "Skip os_previous_* role clone with zuul-cloner" 2017-04-25 17:42:59 +00:00
Jesse Pretorius 849c43e7a6 Skip os_previous_* role clone with zuul-cloner
During upgrade tests a static source is used for the role
that is being upgraded from and it uses a special name.

In this patch we ensure that zuul-cloner does not try to
do anything clever with it.

Change-Id: I0760597a218cd6fe4d6cd3a81b0b437c89b48b40
2017-04-25 16:55:10 +01:00
Jenkins dce8cda19b Merge "Reduce git clone noise when zuul cloner is used" 2017-04-25 15:43:28 +00:00
Markos Chandras c0c198088a get-ansible-role-requirements: Do not gather Ansible facts
There is no need to spend time gathering facts since we are not using
any of them so avoid that in order to speed up the role fetching
process.

Change-Id: Ib7a13e180eff41d67052378ecec204a620c4e8d8
2017-04-25 14:59:08 +01:00
Jesse Pretorius a4d33d74aa Reduce git clone noise when zuul cloner is used
When zuul cloner is used, the git clone task skips all the
openstack repositories and generates a lot of log noise.

This patch filters the list prior to giving it to the task
so that the noise is reduced.

Change-Id: Ia51b6c0899611fe92c8232a252b07c985aef923d
2017-04-25 12:08:41 +00:00
Markos Chandras fd13e5a7f6 get-ansible-role-requirements: Do not clone the repositories as root
Commit cf6bea2acc ("Enable cross-repo testing for OSA role tests")
added the ability to test patchsets along with their dependencies.
However, it also modified the get-ansible-role-requirements.yml
playbook leading to repositories being cloned as root. This breaks
regular user testing as follows:

ln -s /vagrant /home/vagrant/.ansible/roles/<role>
ln: failed to create symbolic link ‘/home/vagrant/.ansible/roles/<role>’: Permission denied

The reason for that is that the $HOME/.ansible/roles is created as
'root' in the get-ansible-role-requirements.yml playbook so any attempt
to make modifications as regular user results to failure. It appears
that nothing in that playbook needs 'root' privileges so we run the
whole playbook as a regular user. Moreover, the playbook clears the
/etc/ansible/roles/* directories but the cloning happens in the $HOME
directory so we fix that as well.

Fixes: cf6bea2acc ("Enable cross-repo testing for OSA role tests")
Change-Id: I20c668108aea7404006247c9ba6abb1f5899735a
2017-04-25 10:01:08 +01:00
Jesse Pretorius cf6bea2acc Enable cross-repo testing for OSA role tests
When 'Depends-On: <change-id>' is used in a patch,
Zuul cloner must be used in order to ensure that
both patches are actually used for the gate test.

This patch implements the use of zuul-cloner [1]
for gate tests and falls back to using git if
zuul-cloner is not present.

Additionally the playbook execution requires the
file based inventory to be used instead of the
CLI string so that the python interpreter is set.
This is required in order to ensure that the copy
module can act against CentOS with access to the
libselinux-python library on the host. See [2] for
more details.

[1] http://docs.openstack.org/infra/zuul/cloner.html
[2] https://goo.gl/VCKKfp

Change-Id: I8cf4d7d30284e5ef1e70897f2ecfe1da0b11c0c7
2017-04-24 13:14:31 +01:00
Nish Patwa 00902d8120 Implement git clone of roles
Added get-ansible-role-requirements.yml to a testing repo that
uses git clone to download the roles instead of downloading the
roles using ansible-galaxy.

Closes-Bug: 1626113
Change-Id: I241de348310a7a3beba6181a271f5351c9460318
2016-09-30 12:58:14 +00:00