Skip to content

Commit be4c725

Browse files
x1101gotmax23webknjaz
authored
Issue ansible#1633 nox session for tagging (ansible#1649)
* 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]>
1 parent be8bc9f commit be4c725

File tree

6 files changed

+53
-15
lines changed

6 files changed

+53
-15
lines changed

.github/workflows/pip-compile-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
'pip-compile-3.10(typing)'
4040
'pip-compile-3.10(static)'
4141
'pip-compile-3.10(spelling)'
42+
'pip-compile-3.10(tag)'
4243
reset-branch: "${{ inputs.reset-branch || false }}"
4344
labels: "${{ inputs.labels || 'backport-2.14,backport-2.15,backport-2.16,backport-2.17,tooling' }}"
4445
secrets: inherit

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,30 +141,22 @@ podman run --rm --tty --volume "$(pwd):/mnt:z" --workdir /mnt docker.io/library/
141141

142142
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.
143143

144-
First, install the additional tagging dependencies from this repository as follows, creating or activating a `venv` as needed:
145-
146-
``` bash
147-
python3 -m venv ./venv
148-
source ./venv/bin/activate
149-
pip install -r hacking/tagger/requirements.txt
150-
```
151-
152-
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.
144+
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.
153145
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.
154146

155-
Lastly, run the tagger script.
147+
Next, run the `tag` `nox` session.
156148

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

159151
``` bash
160152
# The tagger scripts assumes "origin" as the upstream remote.
161-
./hacking/tagger/tag.py tag
153+
nox -s tag
162154

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

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

170-
See `--help` for extended options.
162+
See `nox -s tag -- --help` for extended options.

noxfile.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,18 @@ def make(session: nox.Session):
180180
*(args.make_args or ("clean", "coredocs")),
181181
]
182182
session.run("make", "-C", "docs/docsite", *make_args, external=True)
183+
184+
185+
@nox.session
186+
def tag(session: nox.Session):
187+
"""
188+
Check the core repo for new releases and create tags in ansible-documentation
189+
"""
190+
install(session, req="tag")
191+
args = list(session.posargs)
192+
193+
# If run without any arguments, default to "tag"
194+
if not any(arg.startswith(("hash", "mantag", "new-tags", "tag")) for arg in args):
195+
args.append("tag")
196+
197+
session.run("python", "hacking/tagger/tag.py", *args)
File renamed without changes.

tests/tag.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --output-file=tests/tag.txt --strip-extras tests/tag.in
6+
#
7+
click==8.1.7
8+
# via typer
9+
gitdb==4.0.11
10+
# via gitpython
11+
gitpython==3.1.43
12+
# via -r tests/tag.in
13+
markdown-it-py==3.0.0
14+
# via rich
15+
mdurl==0.1.2
16+
# via markdown-it-py
17+
packaging==24.1
18+
# via -r tests/tag.in
19+
pygments==2.18.0
20+
# via rich
21+
rich==13.7.1
22+
# via typer
23+
shellingham==1.5.4
24+
# via typer
25+
smmap==5.0.1
26+
# via gitdb
27+
typer==0.12.3
28+
# via -r tests/tag.in
29+
typing-extensions==4.12.2
30+
# via typer

tests/typing.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-r ../hacking/pr_labeler/requirements.txt
2-
-r ../hacking/tagger/requirements.txt
2+
-r tag.in
33
mypy
44
nox

0 commit comments

Comments
 (0)