Commit Graph

252 Commits

Author SHA1 Message Date
Jonathan Rosser d80a61f810 Workaround ansible unsafe text templating bug
See https://github.com/ansible/ansible/issues/82598

Setting the 'use' parameter to something other than 'auto'
should cause a different code path to be use in the package
action plugin which could avoid the templating unsafe text
inside the plugin.

Change-Id: I0c14510eb625d74a654a6398387ab74c4355a4e8
2024-02-28 08:51:29 +00:00
OpenStack Release Bot c2c961317a Update master for stable/2023.2
Add file to the reno documentation build to show release notes for
stable/2023.2.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/2023.2.

Sem-Ver: feature
Change-Id: I79b16ce2f6b0045f8c9239ed86d37389af14c1db
2023-12-07 11:04:12 +00:00
Dmitriy Rabotyagov 158ef2dbf1 Use distribution_major_version for all distros except Ubuntu
That is a follow-up patch for Rocky, that as EL derivative also follows
naming convention, where distribution_version contains also minor
version, while we need to build only against major versions of distros.
With that the only distro we need to use distro version for is Ubuntu.

Change-Id: I62f69bc31ed04ab65a167d07de44067fcaa74a66
2023-11-21 10:22:01 +01:00
Dmitriy Rabotyagov 3d1740bde2 Drop unneeded become overrides
We add become overrides on the task level which neglect provided by
user options in favor of quite narrow usecase. As a result, role can not
be run as a non-root user in cases where venv_build_host is not localhost

Removing become override potenially unblocks running OSA with non-root
user on hosts.

Change-Id: I663bdb1bcc60fec0d9efc55cbb1b2a0c566ab2ab
2023-10-11 15:18:43 +02:00
Dmitriy Rabotyagov 965cad09fa Use distribution_major_version for Debian and CentOS
Debian does include minor versioning into distribution_version facts
causing versions to look like "12.2" or "11.4", which is causing issues
once debian is minorly updated since there might be no repo container
to satisfy such specific request across the board (ie having repo 11.3
while compute reports 11.4). Thus we're taking into account only major
versions for these distros. Same approach has been taken for building
wheels in project-config [1]

[1] https://review.opendev.org/c/openstack/project-config/+/897545

Change-Id: Iaf6ed4dd5e01b25b5935b959c73ab657cfefef47
2023-10-10 08:00:11 +00:00
Jonathan Rosser 824639308e Rename _package_list variable
This is renamed to be more specific to the wheel build process
and not to collied with similarly named variables in other ansible
roles.

Change-Id: I470507ed904bca1845fdccc9494cc62bc10229b7
2023-08-15 15:08:11 +01:00
Dmitriy Rabotyagov 43032d25cf Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: I6b4b83ec472d4a3de9139eb4e7c7b2dc8a9fc260
2023-07-14 05:48:27 +00:00
Dmitriy Rabotyagov 0e1abb2858 Remove warn argument for command/shell
Since ansible-core 2.14 you can't use warn as module argument.

Instead, a tag is used to instruct ansible-lint to
supress alerts.

Change-Id: I4ceeee4bf6c1020851824450ec7b30f6d14573f3
2023-06-30 16:55:59 +02:00
Dmitriy Rabotyagov 01a08f39bb Build wheels depending on presence of venv_build_group
In case venv_build_group is not present in inventory or does not contain
a single host, it does not make sense to attept building wheels.

With that we're changing default behaviour to avoid building wheels
if there're no potential targets exists.

Change-Id: Ifd0e80dd1d1f002a1b80f57b53b81ca9110e719c
2023-05-24 15:58:55 +00:00
Dmitriy Rabotyagov e24c1a4f71 Add venv_build_group variable
In order to be flexible and get rid of hardcoded repo_all group, new
variable named `venv_build_group` was added. It's set to repo_all by
default, so it is not changing current behaviour remains

Change-Id: I30c2c26abeb103de63aff0946ec7783f902886b8
2023-05-24 15:58:50 +00:00
Dmitriy Rabotyagov a3ea0c74ab Add a failure message when no build targets are present
At the moment if no appropriate build target is present role fails with
quite unclear message. This patch aims to provide human-readable
failure message when it's not possible to select build target, but
wheels build is enabled.

Change-Id: Ice35e3e4a14ee74b6ff40bd2385550f2da162878
2023-05-24 15:58:39 +00:00
Dmitriy Rabotyagov e43dcdbf6a Align distro_arch naming in the role
At the moment we have 2 slightly different variations of merging
distro_arch - one through `-` and another through `_`. This patch
aligns usage and re-use  _venv_build_dist_arch.

Change-Id: If478ab0f0c0a5acc8974a69a11453377c98c28be
2023-05-24 12:48:51 +02:00
Zuul 70b25cb6ba Merge "Fix venv_build_targets when used with multi-arch" 2023-05-19 21:45:45 +00:00
Zuul 95405d21bb Merge "setup.cfg: Replace dashes with underscores" 2023-05-19 17:35:15 +00:00
Stuart Grace 76dc23fd06 Fix venv_build_targets when used with multi-arch
Change venv_build_targets data structure to a single-level dict
with keys of the form  <distro_ver>_<arch> instead of nested dicts.
When adding new architectures to the old structure, previous
entries for other architectures were overwritten, leaving only
the last seen architecture for each distro version. This could
result in a "Dict object has no attribute ..." error when trying
to build a venv for any other architure.

Closes-Bug: #2018012
Change-Id: I8ddabf996559b5300b52cad1649d8657889337cd
2023-05-18 16:32:59 +00:00
niuke 5e0c8b19ab setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:

  UserWarning: Usage of dash-separated 'description-file' will not be
  supported in future versions. Please use the underscore name
  'description_file' instead

[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb

Change-Id: I3699a7b8ae858463cdd84b11072557049e798309
2023-05-05 09:12:38 +08:00
Dmitriy Rabotyagov 26ef6bd7b8 Reduce amount of task that are executed
With this patch we're trying to optimize role runtime by replacing
separate tasks with loops. Hoepfully, this will slighlty improve
permorfance as we need less connections now.

We also create a venv with pip module rather then command.

Change-Id: I219c0336079ca89bde586c8076bd964fada747c6
2023-04-25 10:29:03 +00:00
Takashi Kajinami 185713df0e Remove TripleO jobs
We are tearing down TripleO master because of project removal.

Change-Id: I2eadaafa33b829e5f8445c947644791166cc78f5
2023-03-15 23:49:47 +09:00
Zuul 84f0a74e77 Merge "Always build wheels by default" 2023-02-22 02:47:45 +00:00
Dmitriy Rabotyagov 2a25337b98 Drop empty elements from constraint/requirement files
We should filter out empty elements from lists that are provided as
input to the role, to ensure idempotence of build constraints and
requirements file as a result.

Additionally to that we should ensure to control jinja whitespaces
not to add extra new lines to the end of files.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/872896
Change-Id: Ide47712f775c91d90b749bc8e4d8f87c5bd658f2
Closes-Bug: #2004546
2023-02-08 21:48:47 +01:00
Dmitriy Rabotyagov 4715b470f9 Always build wheels by default
Due to some corner cases that are possible with currnet logic,
it was decided to simply it and always build wheel regardless of host
count. While runtime might take a bit longer, it's always better for
scaling up to already have wheels prepared.

Closes-Bug: #2004252
Change-Id: I5f53db8476eb394516fb35d593932d2552b95a57
2023-02-07 18:36:19 +01:00
Dmitriy Rabotyagov 7fd75008cf Allow to set ENV vars for wheels build and venv install
It's not always enough to provide extra arguments for pip installation.
For usescases, like isolated installations, and some specific packages
that still utilize deprecated setuptools.installer instead of
PEP 517 installer,
you might find impossible to provide some easyisntall options without
having a configuration file that should be created by deployer as
pre-step. However, these options might be covered with ENV variables.

Change-Id: I9a060cbcdf9f5c54efd423a4b4fe32b418377f86
2023-01-23 14:17:47 +01:00
Dmitriy Rabotyagov a6c6dfe358 Update tox.ini to work with 4.0
With tox release of 4.0, some parameters were deprecated and are ignored now
which causes tox failures. One of the most spread issues we have is using
`whitelist_externals` isntead of `allowlist_externals`


Change-Id: Ic77fb02afbf08e071d7ba0f0eb3a273f03a3a960
2022-12-27 17:53:06 +01:00
OpenStack Release Bot 61141126d0 Update master for stable/zed
Add file to the reno documentation build to show release notes for
stable/zed.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/zed.

Sem-Ver: feature
Change-Id: I720d64d26b796db633fe9cae25c0b0497637ad00
2022-12-13 13:04:36 +00:00
Zuul 83998be6b8 Merge "Change default value for venv_wheel_build_enable" 2022-09-24 20:05:32 +00:00
Dmitriy Rabotyagov 4a04d08eb4 Change default value for venv_wheel_build_enable
With fixing multi-distro support logic, venv_wheel_build_enable logic
stopped working for metal deployments, that have more then 1 host.
Currently, we were checking, that we are not building wheels if build_host
is the same as inventory_hostname. Which is now true for all metal
deployments. However, other hosts do expect wheels to present, which
results in installation failure.

According to the original idea we need to build wheels only when we have
more then 1 host with same arch/distro combination otherwise it does
not make sense to build wheels and faster to install tarball.

To achieve that we build mapping of all distro/arch combinations and
enable wheels building only when there distro-arch combination
is not unique for the host we're playing against.

Despite it might be overkill, as scenario of having only single host
with uniqe distro-arch combination, and overhead of building wheels for
it would be quite small, alternative would be to hardcode `True` for
venv_wheel_build_enable.

Closes-Bug: #1989506
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-os_placement/+/858258
Change-Id: I762e36acf76729fd61f28ca1b03bc9f562b5db0a
2022-09-19 07:59:51 +00:00
Erik Berg 4d766a1f9d Remove redundant vars line
This line was introduced by I3c2164ca8f610fbef88744d9acfca4e926059c81
but should already be covered by the distribution_major_version line
above.

Change-Id: I33a9a85649ff955adfdc8164f42610400381f5bb
2022-09-15 14:41:30 +02:00
Zuul a3b3b7d7aa Merge "Gather build hosts facts once." 2022-07-13 10:11:10 +00:00
Jonathan Rosser 295827ac59 Gather build hosts facts once.
In [1] the build host facts gathering was moved from a place in the
code which was covered by run_once to one that is not. The task is
now missing a run_once so it iterates over the repo_all group for
each host in the play which could be a very large number of tasks.

[1]  I79a10a3f774246ab9c57313f19f3804f9422e08c

Change-Id: Ic86c19ca48fb55ad2c464c22f31ac41c5cc4c2e5
2022-07-07 20:24:44 +01:00
Dmitriy Rabotyagov 57a2f226eb Run wheels build for each unique distro/arch
There may be multiple architecures and OS versions in
ansible_play_hosts. However, with run_once we build wheels only
for one selected distro and do not repsect multi-arch/multi-distro
setups.
Instead of run_once we need to select single (and first in play)
host of each architecture and distro and delegate wheels building
from it. That is needed, because venv_build_host is selected based
on the facts gathered for current inventory_hostname and will
depend on it's arch/distro.

Change-Id: I492d17169538ad2768e28f7c48314bdec407ab36
Closes-Bug: #1964535
2022-06-29 15:37:02 +00:00
Dmitriy Rabotyagov 04f5847349 Switch sphinx language to en
With sphinx release of 5.0.0, they changed default for language variable
to 'en' from None. With that current None valuable is not valid and should
not be used.


Change-Id: I693a7be59720ab2e00088e8f0dfbfd646316afb7
2022-05-30 16:01:09 +02:00
Dmitriy Rabotyagov 5051b52275 Split venv_rebuild functionality
This patch aims to split functionality of ``venv_rebuild`` into 2
separate parts - rebuilding venv and rebuilding wheels. That will give
more control over what needs to be done.

Change-Id: Ie14f12c6756cd1f866b660acc8fd6aa5695f6c33
Related-Bug: #1914301
2022-05-11 10:07:48 +00:00
Jonathan Rosser 43d785eff2 Improve python version detection when symlinking libraries
The previous code assumed that the major version ('python3') could be
obtained by removing the last two characters from 'python3.X. This
does not work for pyhton releases 3.10 and onward, so this patch
changes the code to split the string on '.' and take the first portion.

Change-Id: I771cac2fc9badb61c22cfde65775aee97c31f89c
2022-04-21 07:52:16 +01:00
OpenStack Proposal Bot 908e3ac7b1 Updated from OpenStack Ansible Tests
Change-Id: Ibae2fc88c787f68e979265dffa4bb91f9aee0a98
2022-04-01 12:13:22 +00:00
Marc Gariépy 88cb4d60fb Revert "Cleanup setup.py config"
This reverts commit 7166e396d1.

Reason for revert: unbreak tripleo-quickstart

Change-Id: I91a21138a20331e2123f878ac8fb51a6552e2cef
Disable setuptools auto discovery

Jobs are broken due to a release of setuptools 61.0 introducing
non-backwards compatible breaking changes [1]

Setting py_modules to an empty string here will disable autodiscovery
and should permit jobs to run as before.

[1] https://github.com/pypa/setuptools/issues/3197

Signed-off-by: Neil Hanlon <neil@shrug.pw>
Change-Id: Ie0215582fe630f1897a85c1e88fd578d100bc3cf
2022-03-31 17:08:13 -04:00
Marc Gariepy 7166e396d1 Cleanup setup.py config
Change-Id: Iaa3f4de1b04e96421cd3ebf4f7e60588c73f20aa
2022-03-31 10:33:56 -04:00
Zuul 3dddb491a9 Merge "Slurp constraints.txt separately for each host in a batch" 2022-02-22 19:39:25 +00:00
Damian Dabrowski 28f89b80a8 Slurp constraints.txt separately for each host in a batch
Currently playbook slurps constraints.txt valid for a first host in a
batch and then uses it for each other host.

It saves time but batch may consists of hosts with different operating
systems or even OSA versions and current mechanism doesn't take this
into account.

In my opinion we should slurp constraints.txt separately for each host.

Change-Id: I9ba1d342af13e9c923151f735940bda29bf1b262
2022-02-15 15:10:24 +01:00
Chandan Kumar (raukadah) 0220a8405e Move TripleO zuul jobs layout to centos9 only for master branch
See topic branch [1] for related reviews.


[1] https://review.opendev.org/q/topic:c8_teardown_master

Depends-On: https://review.opendev.org/c/openstack/tripleo-ci/+/829236

Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
Change-Id: Iddb33f1b842b0844ce2cdaaf6fa0fb24d9553beb
2022-02-15 13:27:46 +00:00
Zuul a57336728f Merge "Remove legacy comment" 2022-02-03 20:12:24 +00:00
Jonathan Rosser 4c0fe473fc Remove legacy comment
The repo-build process is removed long ago so this comment is no
longer required.

Change-Id: I8ac4d9e45708d17bf4e3af99249b4cb204da29ea
2022-02-01 04:26:03 -05:00
Zuul 4a1490377c Merge "Add per-distro vars files" 2022-01-14 13:14:51 +00:00
Dmitriy Rabotyagov c42eb3c131 Add per-distro vars files
The conditionals for packge installation are getting more complex
than can be handled with the ternary operator, so create per distro
vars files to describe these differences.

Change-Id: I3c2164ca8f610fbef88744d9acfca4e926059c81
2022-01-14 08:50:03 +00:00
Jonathan Rosser c46feec5c6 Fix conditional for installing required wheel build packages
Previously the build base package list was ignored, and the
condition included the install package list which was not relevant.

Change-Id: Iadedc5b35f1919058c9971b3ef03d403d153ed62
2022-01-11 14:28:05 +00:00
Dmitriy Rabotyagov 4d826ad133 Fix wheel build alert condition
Currently alert is raised when wheels are built while it should be triggered only
when they are not.

Change-Id: I3c3547c3fa6df2bef6834e0cec4d43ef03b82f5f
Closes-Bug: #1956026
2021-12-30 13:28:01 +02:00
Dmitriy Rabotyagov 8701591120 Replace virtualenv with exacutable for pip
We create virtualenv with a separate command since we need to create
constraints before running pip. In the meanwhile when using pyenv
it becomes more messy to use virtualenv, as it would require
setting virtualenv_command and you can't define virtualenv_python then.

Using exacutable requires setuptools to be present
for ansible_python_interpreter

Change-Id: I5bf617ad0eca3dd5e58e25af7b44d536dc4579d3
2021-12-27 10:17:28 +02:00
Zuul a70aba465e Merge "Switch to LXC jobs" 2021-12-25 00:30:19 +00:00
Zuul 775091546d Merge "Install python3-venv on destination hosts" 2021-12-25 00:30:18 +00:00
Zuul aa39e09529 Merge "Verify that wheels are built while running against multiple hosts" 2021-12-25 00:14:30 +00:00
Dmitriy Rabotyagov 9506a8d1a7 Switch to LXC jobs
This role might fail with LXC scenario and metl jobs may not catch these
scenarios as we need to have separate build and install hosts.

Change-Id: I089a42fd06dc3874abd050e7556d2ce60ca0ce00
2021-12-24 12:07:46 +00:00