Commit Graph

609 Commits

Author SHA1 Message Date
Matt Clay
4bbb445c1f Use the new CLI docs generator from ansible-core (#220)
This tool provides a stable interface for generating RST documentation for ansible-core CLI programs.

It avoids having the docs generation process in this repo depending on ansible-core internals that are subject to change.

Relates: https://github.com/ansible/ansible/pull/81395
2023-08-01 23:05:05 +01:00
Maxwell G
feabfb631b labeler: retrieve author_association from event data
The Github Actions API token apparently doesn't have sufficient ACLs to
retrieve this from the API.

Fixes: https://github.com/ansible/ansible-documentation/issues/204
2023-07-31 14:52:56 +01:00
Maxwell G
1f1252d356 labeler: pass Github Action event data to script
This way, the script can take action based on specific events when that
data is available.
2023-07-31 14:52:56 +01:00
Maxwell G
47a86baeb4 labeler: make LabelerCtx un-frozen
This is needed so that the dataclass can have dict and other mutable
types as fields.
2023-07-31 14:52:56 +01:00
Maxwell G
b2ffdfc84f labeler: remove global get_previously_labeled()
Using a @cached_property that's tied to the class instance makes more
sense than a global cache.
2023-07-31 14:52:56 +01:00
Matt Clay
efe9afccc4 Exclude internal options from man pages and docs (#192) 2023-07-29 08:19:17 +02:00
Matt Clay
eb4dc6c59e Fix "Edit on GitHub" links for CLI programs (#188) 2023-07-28 13:07:43 -07:00
Maxwell G
5c48149561 labeler: fix log() type annotations (#165)
print() coerces any object to a str.
2023-07-25 12:15:45 -05:00
Maxwell G
dd27494b8f labeler: add --authed-dry-run flag
Some data such as author_association is only available to authenticated API
users. This helps with testing.
2023-07-25 11:41:17 -05:00
Maxwell G
5c2125dffa labeler: improve logging 2023-07-25 11:41:17 -05:00
Maxwell G
0bb954b18e labeler: welcome new contributors
Fixes: https://github.com/ansible/ansible-documentation/issues/69
2023-07-25 11:41:17 -05:00
Maxwell G
0c56c51999 Add Github Action to label issues and PRs (#118) 2023-07-25 11:20:26 -04:00
Felix Fontein
1a1aa0b880 Remove no longer necessary workaround. (#51) 2023-07-05 09:53:58 +01:00
Matt Clay
b3f1290bcd Remove docs dir dependency from man page build (#81003) 2023-06-08 12:41:45 -07:00
Matt Martz
c1f2a9ea6c No core irc meeting (#80811) 2023-05-16 11:03:42 -05:00
Matt Clay
2cd1744be3 Use ansible.module_utils.common.text.converters (#80704)
Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility.
2023-05-03 08:58:00 -07:00
Matt Clay
4d25e3d54f Set the minimum setuptools to 45.2.0 (#80649)
Also update the package-data sanity test to use the minimum setuptools version.
2023-04-26 16:01:56 -05:00
Matt Clay
9026bc5d76 Remove obsolete pkg_resources usage (#80489) 2023-04-11 19:33:57 -07:00
Sviatoslav Sydorenko
a84b3a4e72 Fix misrendered sections in manpage generation
This change fixes bugs in the manpage generator that existed since it
was first added.

It exposes CLI `ARGUMENTS` value to manpage templates.

Before this change, the code contained a typo, causing the `for`-loop
iterate over individual characters of the `'ARGUMENTS'` string rather
than iterating over a tuple. A missing comma was at fault.

The updated code gets rid of the `for`-loop and conditionals since it
seems to have been a premature complexity increase and no other things
than `'ARGUMENTS'` were ever added into the broken iterable.

The functional change is that `arguments` is now always present in the
Jinja2 context, unlike being missing sometimes because of the previous
design (not that it was ever present, because of the bug! sigh...)

The Jinja2 templates perform an `{% if arguments %}` check, letting
the template engine silently ignore the missing variable. The clause
was always falsy, meaning that the arguments section was not included
in the manpages for at least the last 6 years. With this fix, it will
be.

This patch also deduplicates calling `opt_doc_list` @ generate_man.

It was called late in the execution, more times than necessary. This
patch makes sure it happens once by putting it at the top of the scope.

It fixes rendering library and inventory in manpages.

The corresponding Jinja2 templates have blocks wrapped with
conditionals like `{% if inventory %}` and `{% if library %}` but said
variables were never injected into the context, nor were they even
deduced on the Python side of the generator. This means that the
conditional clauses were always falsy, never showing the portions of
the manpages.

The Python script has hints for how the `inventory` variable was to be
calculated, which is confirmed through the Git paleontology efforts.

The block of code that references to the `inventory` bit was
incorrectly checking a variable with a list of nested objects for the
presence of a string which was never going to work.

This patch fixes this check by verifying the CLI flag against the
correct variable containing a list of options and exposes it to the
Jinja2 templates.
It also exposes the `library` variable in a similar way.

The block displaying other binaries in Sphinx CLI docs has been
synchronized with the manpage template.
Previously, the current binary was displayed also. This patch gets rid
of the unwanted trailing comma there too.

Finally, the CLI executables list in the manpage template now reuses
the same variable as the RST template that doesn't need any
post-processing in Jinja2.
Before, it was already used in the RST template so this patch aligns
both templates to use the same logic as they got out-of-sync over time.

PR #80450.
2023-04-08 14:04:59 +02:00
Matt Clay
163f297d7f Extend bulk issue creator (#80423)
It can now be used to create feature requests, not just deprecation bug reports.
2023-04-05 15:24:21 -07:00
Matt Clay
4f7f7d1c26 Remove old release announcement scripts (#80371)
These have been replaced by `packaging/release.py`
2023-04-04 11:08:44 -07:00
Matt Clay
2e413b74e4 Add work-around for old AZP jobs (#80339) 2023-03-28 11:50:47 -07:00
Matt Clay
f587856beb Remove straight.plugin dependency (#80084) 2023-02-23 15:37:12 -08:00
Matt Clay
e69ef1b249 Clean up unused imports in hacking directory (#79894) 2023-02-02 16:00:50 -08:00
Matt Clay
868d721d8c Flush output in sanity requirements update script. (#79774)
This keeps the subprocess output under the correct heading.
2023-01-19 21:49:04 -08:00
Matt Martz
56d142350d Add support for importlib.resources (#78915)
* Add support for importlib.resources

* Remove the importlib.resources imports

* return the correct data

* Some code comments, and re-order for consistency

* Disallow traversing packages below an individual collection

* Add a traversable class for namespaces

* Re-use variable

* Utilize itertools.chain.from_iterable

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Simplify logic to check for packages from ansible loaders

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Just a generator expression, instead of a generator

* docstrings

* Add comment about find_spec for our namespaces

* Add some initial unit tests for importlib.resources

* normalize

* Utilize importlib.resources for listing collections

* collections_path is already in config, just use config

* install uses a different default for collections_path

* Remove unused import

* Remove duplicate __truediv__

* Bring back TraversableResources

* Apply some small suggestions from code review

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Remove cross contamination between plugin loader code and CLI code

* Remove unused import

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2023-01-10 11:09:57 -06:00
Felix Fontein
9545f2e0de stable docs build: do not use YAML parsing/serialization for .deps files (#79233)
* Do not use YAML parsing/serialization for .deps files.

* Prevent crash.
2022-10-26 14:54:00 -07:00
Johanan Liebermann
fbd828673d Fix distro fact handling for Flatcar (#77635)
* Fix distro fact handling for Flatcar

The existence of the file /etc/flatcar/update.conf depends on
bootstrap configuration typically provided by the user. For that
reason this file is unsuitable for determining distro facts for
Flatcar Container Linux.

The distribution_release fact is meaningless in the case of Flatcar
since Flatcar doesn't have named releases. The distribution_version
fact, however, IS meaningful and should contain a number such as
"3139.2.0".

- Use /etc/os-release instead of /etc/flatcar/update.conf.
- Drop the distribution_release fact.
- Set the distribution_version fact.
- Update distro test fixture for Flatcar
- Generate the fixture using gen_distribution_version_testcase.py.
- Override result.distribution and result.os_family manually as the
  generator script gives wrong values.
- Use a recent Flatcar version.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
2022-09-07 13:14:12 -04:00
Matt Clay
650befed37 Add missing space after keywords. (#78480)
Also remove unnecessary parenthesis.
2022-08-08 13:18:28 -07:00
Martin Krizek
43153c5831 FieldAttributes as descriptors (#73908) 2022-06-29 14:39:23 +02:00
Diana S. Cardona
58b42abede Update README.md (#78139)
Update Python version requirement to >= 3.8.
2022-06-28 11:03:29 -04:00
Matt Martz
a415697d70 Allow result sha to be overriden with local sha (#77832) 2022-05-18 13:19:11 -05:00
Felix Fontein
836683a082 Stop making core docs build talk of (ansible-)'base' when meaning (ansible-)'core'. (#77728) 2022-05-11 14:04:43 -04:00
samccann
7471c036ec shift to ansible_core_version 2022-05-03 10:53:18 -07:00
Matt Clay
b8793fa48d Fix use of deprecated antsibull-docs option. 2022-04-25 12:21:09 -07:00
Felix Fontein
841bdb74eb Replace antsibull with antsibull-docs (#77504) 2022-04-22 09:33:32 -04:00
htol
d7fbde4ea9 Make "~/.ansible" path configurable (#76114)
* replace hardcoded '~/.ansible' to C.ANSIBLE_HOME
* rename previously existing env ANSIBLE_HOME in env-setup script
* modify cache dir monkeypatching in galaxy api unit tests
* update "version_added" to 2.14 for ANSIBLE_HOME
* fix description of collections with proper use of ANSIBLE_HOME

Co-authored-by: htol <github@h-tol.net>
Co-authored-by: stefanwascoding <stefan@syntaxhelden.de>
2022-04-11 14:17:00 -04:00
Matt Clay
353511a900 Add script to handle more deprecations. (#77400)
* Add script to handle more deprecations.

This script currently supports deprecations from the following sanity tests:

* deprecated-config
* update-bundled

* Ignore script in package-data test.
2022-03-29 15:24:30 -07:00
Matt Clay
93d0ea0215 Update core porting guide generation. 2022-03-28 13:16:28 -07:00
Matt Clay
3e491db466 Porting guide fixes. (#77376)
* Update porting guide generation.
* Fix 2.13 porting guide link.
2022-03-28 11:57:10 -07:00
Cindy Park
1bdcb56249 Improve documentation to fix outdated file paths (#77341)
Co-authored-by: njthanhtrang <njthanhtrang@users.noreply.github.com>
2022-03-24 14:18:33 -04:00
Philip Douglass
e6f63be7a4 Honor --quiet parameter properly in fish shell (#77180)
* The `^` stderr redirection is deprecated
* Setting `-q` for `setup.py` in `gen_egg_info` is redundant
2022-03-05 07:04:54 +10:00
Brian Coca
9a4ff01a4f Cleanup of cannned responses (#76689)
* removed those made obsolete by bot
 * tried to rephrase to be more informative and require less updates in the future

Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: John R Barker <john@johnrbarker.com>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
2022-02-04 10:37:53 -05:00
Pascal Höhnel
7cd94dd452 Fix unsafe handling of variable PYTHON_BIN (#76767)
The previous state lead to errors, when cloning the repo to a path with spaces in it.
2022-01-18 16:13:33 +01:00
Matt Clay
bb63c97c16 ansible-test - Update import test and sanity requirements. (#76308)
* Add script to freeze sanity requirements.
* Declare sanity test requirements and freeze
* Use pinned requirements for import.plugin test.
* Expand scope of import test for ansible-core.
* Add ignores for galaxy import errors.
* Update test-constraints sanity test.
2021-11-16 18:16:42 -08:00
Matt Martz
66a83314b9 Modernize install (#76021)
Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <mrd@redhat.com>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2021-10-19 14:24:57 -05:00
Matt Martz
96b221b344 Update vendored copy of distro to 1.6.0 (#75732)
* Update vendored copy of distro to 1.6.0

* copy pasta mistake

* ci_complete
2021-09-22 11:43:25 -05:00
Matt Martz
208014422d Fix markdown links that were errantly formatted as rst (#75697) 2021-09-14 10:15:37 -05:00
Sam Doran
5af0420cab hacking - account for job names that contain separators (#75454)
Some job names contain '/' which causes the download job to fail.

Example job name: `Post-job: Checkout ansible/ansible@refs/pull/75445/merge to ansible.log`
2021-08-11 20:33:23 -07:00
Matt Clay
a5b0626176 Cleanup hacking scripts to prepare for pylint update. (#75474)
* Use generator in get_recent_coverage_runs.py
* Use from import in test-module.py
2021-08-11 13:18:40 -07:00