Skip to content

Commit

Permalink
Issue #1633 nox session for tagging (#1649)
Browse files Browse the repository at this point in the history
* WIP tagger session for nox

* First pass tagging nox session

* Formatting fixup

* Adding removal of tmpdir as per discussion

* tag session checks for, and uses, existing ansible checkout if it exists, removes tmpdir if it created one.

* isort fixup

* Working out suggested changes.

* Linting cleanup on changes

* Different approach to noted chagnes

* Reducing tagging session to a bare bones wrapper around the script, leaving all repo management alone

* Staging deletion per discussion

* Adding tag session to dependency update job

* after removing hacking/tagger/requirements.txt moved "gitpython" here for the typing test session requiremnts.

* Adding that here didd not accomplish what I'd expected. Removing it and revisiting how to do that.

* I think this is where the call needed added to get the tags dependencies automatically updated

* remove gitpython, add tag.txt, add blank line

* Comment cleanup per OraNod

* doc README: document nox tag session instead of manual mode

* Update tests/typing.in

Per suggestion from @webnjaz

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>

---------

Co-authored-by: Maxwell G <[email protected]>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent be8bc9f commit be4c725
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pip-compile-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
'pip-compile-3.10(typing)'
'pip-compile-3.10(static)'
'pip-compile-3.10(spelling)'
'pip-compile-3.10(tag)'
reset-branch: "${{ inputs.reset-branch || false }}"
labels: "${{ inputs.labels || 'backport-2.14,backport-2.15,backport-2.16,backport-2.17,tooling' }}"
secrets: inherit
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,30 +141,22 @@ podman run --rm --tty --volume "$(pwd):/mnt:z" --workdir /mnt docker.io/library/

When a tag is created in the [`ansible/ansible`](https://github.com/ansible/ansible) repository for a release or release candidate, a corresponding tag should be created in this `ansible-documentation` repository.

First, install the additional tagging dependencies from this repository as follows, creating or activating a `venv` as needed:

``` bash
python3 -m venv ./venv
source ./venv/bin/activate
pip install -r hacking/tagger/requirements.txt
```

Next, ensure that you have the [`ansible/ansible`](https://github.com/ansible/ansible) and [`ansible/ansible-documentation`](https://github.com/ansible/ansible-documentation) repositories checked out.
First, ensure that you have the [`ansible/ansible`](https://github.com/ansible/ansible) and [`ansible/ansible-documentation`](https://github.com/ansible/ansible-documentation) repositories checked out.
The tool assumes that both checkouts have the same parent directory. You can set different paths to your checkouts with the `--docs` and `--core` options if you have them set up another way.

Lastly, run the tagger script.
Next, run the `tag` `nox` session.

This will determine any missing `ansible-core` tags and create them in `ansible-documentation` if needed, exiting normally otherwise:

``` bash
# The tagger scripts assumes "origin" as the upstream remote.
./hacking/tagger/tag.py tag
nox -s tag

# If you use a different upstream remote, specify the name.
./hacking/tagger/tag.py --remote <name> tag
nox -s tag -- --remote <name> tag

# If your core repo is not in the same filesystem location, specify the path.
./hacking/tagger/tag.py --core <path> tag
nox -s tag -- --core <path> tag
```

See `--help` for extended options.
See `nox -s tag -- --help` for extended options.
15 changes: 15 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,18 @@ def make(session: nox.Session):
*(args.make_args or ("clean", "coredocs")),
]
session.run("make", "-C", "docs/docsite", *make_args, external=True)


@nox.session
def tag(session: nox.Session):
"""
Check the core repo for new releases and create tags in ansible-documentation
"""
install(session, req="tag")
args = list(session.posargs)

# If run without any arguments, default to "tag"
if not any(arg.startswith(("hash", "mantag", "new-tags", "tag")) for arg in args):
args.append("tag")

session.run("python", "hacking/tagger/tag.py", *args)
File renamed without changes.
30 changes: 30 additions & 0 deletions tests/tag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --allow-unsafe --output-file=tests/tag.txt --strip-extras tests/tag.in
#
click==8.1.7
# via typer
gitdb==4.0.11
# via gitpython
gitpython==3.1.43
# via -r tests/tag.in
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
packaging==24.1
# via -r tests/tag.in
pygments==2.18.0
# via rich
rich==13.7.1
# via typer
shellingham==1.5.4
# via typer
smmap==5.0.1
# via gitdb
typer==0.12.3
# via -r tests/tag.in
typing-extensions==4.12.2
# via typer
2 changes: 1 addition & 1 deletion tests/typing.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r ../hacking/pr_labeler/requirements.txt
-r ../hacking/tagger/requirements.txt
-r tag.in
mypy
nox

0 comments on commit be4c725

Please sign in to comment.