Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1633 nox session for tagging #1649

Merged
merged 21 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2472bdc
WIP tagger session for nox
x1101 Jun 25, 2024
bf5a851
First pass tagging nox session
x1101 Jun 25, 2024
4710cb6
Merge branch 'ansible:devel' into issue1633_nox_session_for_tagging
x1101 Jun 25, 2024
79f8142
Formatting fixup
x1101 Jun 25, 2024
d57278c
Adding removal of tmpdir as per discussion
x1101 Jun 27, 2024
bc411d7
Merge branch 'issue1633_nox_session_for_tagging' of https://github.co…
x1101 Jun 27, 2024
50d0694
tag session checks for, and uses, existing ansible checkout if it exi…
x1101 Jun 29, 2024
7694050
isort fixup
x1101 Jun 29, 2024
fcee50f
Working out suggested changes.
x1101 Jul 2, 2024
e7e2884
Linting cleanup on changes
x1101 Jul 2, 2024
8a81a59
Different approach to noted chagnes
x1101 Jul 2, 2024
9651682
Reducing tagging session to a bare bones wrapper around the script, l…
x1101 Jul 8, 2024
90a1ea7
Staging deletion per discussion
x1101 Jul 9, 2024
8ee0016
Adding tag session to dependency update job
x1101 Jul 9, 2024
38585f9
after removing hacking/tagger/requirements.txt moved "gitpython" here…
x1101 Jul 9, 2024
9ca0b2b
Adding that here didd not accomplish what I'd expected. Removing it a…
x1101 Jul 9, 2024
81db0a1
I think this is where the call needed added to get the tags dependenc…
x1101 Jul 9, 2024
418f5da
remove gitpython, add tag.txt, add blank line
x1101 Jul 11, 2024
7579072
Comment cleanup per OraNod
x1101 Jul 11, 2024
6d5af07
doc README: document nox tag session instead of manual mode
gotmax23 Jul 19, 2024
5536dad
Update tests/typing.in
x1101 Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
oraNod marked this conversation as resolved.
Show resolved Hide resolved
x1101 marked this conversation as resolved.
Show resolved Hide resolved

# 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")
oraNod marked this conversation as resolved.
Show resolved Hide resolved
oraNod marked this conversation as resolved.
Show resolved Hide resolved

session.run("python", "hacking/tagger/tag.py", *args)
Comment on lines +191 to +197
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making a list and mutating it, why not make an additional var just for those extra args?

Suggested change
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)
known_cli_args_present = any(arg.startswith(("hash", "mantag", "new-tags", "tag")) for arg in session.posargs)
extra_cli_args = () if known_cli_args_present else ("tag",)
session.run("python", "hacking/tagger/tag.py", *session.posargs, *extra_cli_args)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was matching the existing pip-compile session that does the same args.append(). I'm personally in favor of keeping things consistent. If we want to change it, we should change both, possibly as a separate effort from this.

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
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
-r tag.in
mypy
nox