Commit Graph

24 Commits

Author SHA1 Message Date
Mark Goddard
e009f80ffc CI: Fix linters-devel and devstack tests
The linters-devel job fails with:

  ansible-test sanity: error: argument --skip-test: invalid choice:
  'metaclass-boilerplate' (choose from 'action-plugin-docs', ...)

The functional test fails with:

  The conditional check 'info1.volumes | selectattr("id", "equalto", "{{
  info.volumes.0.id }}") | list | length == 1' failed. The error was:
  Conditional is marked as unsafe, and cannot be evaluated.

This is due to a change in Ansible 2.17 preventing embedded templates
from referencing unsafe data [1].

[1] https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_9.html#playbook

Change-Id: I2f8411cac1403568afb13c2b96ba452c4c81f126
2024-01-19 17:42:23 +00:00
Jakob Meng
34017d511b Dropped unmaintained, obsolete and broken inventory script
This removes the old inventory script only. For a proper replacement,
please use inventory plugin openstack.cloud.openstack.

Change-Id: Ib677862c049b70f39630d56a147bd5537b12fb2b
2023-01-28 14:18:08 +01:00
Jakob Meng
94c150b2e7 Allow all external commands in tox
Change-Id: I76e0fc0e574d791e8f4d83ccc22289fa06360709
2022-12-10 11:48:48 +01:00
Jakob Meng
b87ae7dcce Dropped symbolic links and plugin routing for deprecated module names
With Ansible OpenStack collection 2.0.0 we break backward
compatibility to older releases, mainly due to breaking changes
coming with openstacksdk >=0.99.0. For example, results will change
for most Ansible modules in this collection.

We take this opportunity to drop the symbolic links with prefix
os_ in plugins/modules and the plugin routing in meta/runtime.yml.
This means users have to call modules of the Ansible OpenStack
collection using their FQCN (Fully Qualified Collection Name) such
as openstack.cloud.server. Short module names such as os_server
will now raise an Ansible error. This also decreases the likelihood
of incompatible Ansible code going undetected.

Symbolic links were introduced to keep our collection backward
compatible to user code which was written for old(er) Ansible releases
which did not have support for collections and where OpenStack modules
where named with a prefix os_ such as os_server which is nowadays
known and stored as openstack.cloud.server.

In Ansible aka ansible-base 2.10, a internal routing table
lib/ansible/config/ansible_builtin_runtime.yml [1] was introduced which
Ansible uses to resolve deprecated module names missing the FQCN (Fully
Qualified Collection Name). Additionally, collections can define their
own plugin routing table in meta/runtime.yml [2] which we did.

In ansible-base 2.10 and ansible-core 2.11 or later, if a user uses a
short module name and the collections keyword is not used, Ansible
will first look in the internal routing table, get an FQCN, and then
looks in the collection for that FQCN. If there is another routing
entry for that new name in that collection's meta/runtime.yml,
Ansible will continue with that redirect. If it does not find another
redirect, Ansible will look for the plugin itself, so it will not
find a redirect in the collection before looking at its internal
redirects. Except if the user uses a FQCN, then it looks directly in
that collection.

Ansible 2.9 and 2.8 do not have any notion of these redirects with a
plugin routing table, backward compatibility with deprecated os_*
module names is solely achieved with symbolic links. Ansible releases
older than 2.11 are EOL [3], so usage of os_* symlinks should reduce
soon.

[1] https://github.com/ansible/ansible/blob/devel/lib/ansible/config/ansible_builtin_runtime.yml
[2] https://github.com/openstack/ansible-collections-openstack/blob/master/meta/runtime.yml
[3] https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html

Change-Id: I28cc05c95419b72552899c926721eb87fb6f0868
2022-07-22 09:48:20 +00:00
Jakob Meng
9f60f0f26d Restricted galaxy-importer script to Python 3.6+
Ansible Galaxy content importer is using format strings [1] which
are supported since Python 3.6. Our Zuul CI job for OpenStack Queens
uses Ubuntu 16.04 LTS (Xenial Xerus) as its base image which has
Python 3.5 only.

Ref.:
[1] b7140d6b3b/galaxy_importer/main.py (L117)

Change-Id: I5d3b2f71937a0e4ab9a8d49df10744f7d95a7de2
2022-04-28 08:36:12 +02:00
Jakob Meng
938abd0d84 Reenabled check-import.sh which tests imports to Ansible Galaxy
Reverted commit 1f3417cdef [1] which disabled check-import.sh script.
Python module galaxy_importer will return a non-zero return value on
errors since commit 4f5fd0f29c [2].

Use galaxy-importer 0.3.1 for Ansible 2.9 and galaxy-importer 0.3.2
for later Ansible releases because galaxy-importer moved from ansible
2.9 to ansible-core 2.11 in 0.3.2 [3].

Ref.:
[1] 1f3417cdef
[2] 4f5fd0f29c
[3] 9893354783

Change-Id: I898149727d80cd7effe6a04ca77a13ef1774e781
2022-03-29 13:20:41 +00:00
Sagi Shnaidman
ae4e7f3c06 Remove tests directory from ansible-tests
Because we don't include tests in collection tar.
Change-Id: I3697f7b0ccd115ff1859658417d51e1643e10be8
2021-08-16 16:06:10 +03:00
Sagi Shnaidman
0441403c42 Run ansible devel sanity tests on py38
And fix some module typos.
Disable voting for octavia jobs till investigation.
Change-Id: Ie4cb69aa2337b0f951ac194cf456e4515dbc24fb
2021-08-03 01:32:31 +03:00
Sagi Shnaidman
1f3417cdef Temporarly disable check-import
check-import has ansible as a dependency, which installs only
2.9 ansible version and it conflicts with higher ansible versions
Issue to check-import will be submitted to have ansible-test as
a dep.
Change-Id: Ide46a8a6b45677e82e57eb6a4c5dfe412d7b37fd
2020-07-26 11:49:18 +03:00
Sagi Shnaidman
01c2499fb6 New CI jobs configuration
Change-Id: Ib6850184faf1bc0808502c098d610a5e2f41f47e
2020-06-23 12:27:04 +03:00
Sagi Shnaidman
4d0df9f022 Fix ansible-test errors
Add tox to requirements
Use only 3.6 python
Set ansible-test 2.9 as a gate job

Change-Id: I40757e1efc3ee297b44cda6c35cdce4c64ebaa4f
2020-06-17 12:53:05 +03:00
Sagi Shnaidman
7e4fbcf568 Fix ansible-tests for devel branch
Ignore for now deprecation warnings
(see https://github.com/ansible-collections/overview/issues/45#issuecomment-628262697)
Current there are bugs in ansible-test that prevent to run these
tests.

Change-Id: I9829bb23a45699e61d7b0af5ecc3e1a94bbbca85
2020-06-03 00:05:07 +03:00
Monty Taylor
a033a0804b Validate that we can upload build collection
Run galaxy-importer on the built artifact and fail if galaxy is
going to fail.

Remove license_file entry in galaxy.yml

Change-Id: I6c2ac22ccb56f52f8efcefc5891b10875ae8c0b5
2020-05-19 11:13:22 -05:00
Monty Taylor
6ab290839b Rename routing.yml to runtime.yml
The collection routing implementation for 2.10:

   https://github.com/ansible/ansible/pull/67684

just update the filename to be meta/runtime.yml.

Change-Id: I858f53e66bef2c40fb7ec2821d412bd966417106
2020-05-16 07:43:29 -05:00
Sagi Shnaidman
bcdf749938 Improve ansible-test sanity for collection
Check only things we build into collection.
Ignore sanity files from full CI jobs.
Add queens to gate because it's voting.
Add files to ignoring when building collection.
Remove non-required lines from ignorign sanity files.

Change-Id: I0dde756efa133cf75b67d072af78a1f8307ce932
2020-05-13 13:31:29 +03:00
Monty Taylor
52905480b8 Remove all of the os_ prefixes
The 2.10 transition has a routing.yml file that points each
individual module from ansible/ansible to a new location. That means
we can put:

    os_server:
      redirect: openstack.cloud.server

into lib/ansible/config/routing.yml in ansible/ansible and have
the result be the end user's playbooks still working with the
old names while providing new names that are less ugly.

This adds a routing file to our collection repo, as well as the
script used to generate the new mapping.

Change-Id: Ia5d18282b14ad0d86a347343be8bb477ae47130a
2020-05-12 10:19:28 -05:00
Monty Taylor
6271268567 Run linters in a temp dir instead of an install
We can't run linters in an install because installs expand
symlinks to regular files so the ansible-test code that detects
symlinks can't work so it looks at docs for symlink aliases
as if they were real.

Change-Id: I0a5659a1f693261a21a5b29528f950b846205f2e
2020-05-12 09:04:54 +00:00
Monty Taylor
852f385889 Remove MANIFEST.json before building
For reasons surpassing understanding this doesn't seem to get
overwritten.

Change-Id: Ib4d6b38757112908dbf58d70015482831a8c2e95
2020-03-13 10:14:58 -05:00
Monty Taylor
97eb24ac4d Deal with collection build modifying tree
ansible-galaxy collection build modifies the contents of the tree.
Let's not go in to why this is bad, but instead just deal with it.
The issue in question is that is removes the +x bit from files in
the tree, which means you can't run a build twice in a row locally.
Shrug. Just roll with the -x and update our usage to reflect it.

Change-Id: I0f82531e99a98d656b60079fd3e94d4e3a1dbb6b
2020-03-05 15:08:32 +00:00
Monty Taylor
96a5914eb6 Remove from __future__ lines
We only support python3

Change-Id: Ieb82eb3369c4ac73f3595dc84ca11e1f11766a79
2020-03-01 06:26:03 -06:00
Monty Taylor
9d29e8c847 Fix H236 and remove exclusion
We haven't needed this in a VERY long time.

Change-Id: I35041c2c6ae421e7caaef3c04ffca92e2ff10e35
2020-03-01 06:22:58 -06:00
Monty Taylor
4df2fdb4fe Just use shutil.rmtree in build.py
Turns out there's a stdlib function for this.

Change-Id: I38885c4b6d973b2a7083a04acb3f5cea9ad78ad9
2020-03-01 06:17:35 -06:00
Monty Taylor
40fe366727 Remove old artifacts when building new ones
For local dev, multiple iterations can wind up with multiple
files in the build_artifact dir. Remove them when building so
that the ls command works.

Change-Id: Id309c34679d2c0b6d9380665a381af4b52495d19
2020-02-27 13:56:27 -06:00
Monty Taylor
5936a8f691 Add a tool to build collections with pbr
OpenStack in general uses git tags to drive versioning of artifacts.
This is important because of our code review driven workflow, since
patches don't necessarily land in a predictable sequence, so flows
requiring a version number in a file to be updated at a specific
time are problematic.

By having pbr generate the correct version number then putting that
into the galaxy.yml file, we can match the behavior without too much
undue burden.

Also ignore build_artifact directory.

Change-Id: Id02fee682fb5a4b6fd6dcb0644848e6d1269e19b
2020-02-27 08:20:43 -06:00