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 4 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
24 changes: 24 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,27 @@ 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):
"""
Determine the missinlg ansible-core releases,
create corresponding tags for each release in the ansible-documentation repo,
and then push them
"""
install(session, req="tag")

DEFAULT_REPO = "https://github.com/ansible/ansible"

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 not any(arg.startswith("--core") for arg in args):
tmpdir = session.create_tmp()
session.run("git", "clone", "--quiet", DEFAULT_REPO, tmpdir, external=True)
args.extend(["--core", tmpdir])
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about cloning the core repo as part of this session. The tagger script already determines the default core checkout and an extra clone feels wasteful.

This also requires you to set the --core argument when running the tagger if you want to use the existing core checkout, which seems a bit less convenient than using the tagger directly.

Maybe we could call tag.py to catch when the ansible repo doesn't exist and then do the clone?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Now I'm on the fence. I guess the clone here resolves the need to set the --remote arg if it's not origin as well as making sure that the repo is up to date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I had a lot of the same thoughts.

What I landed on for a first pass was designing around the idea of

"running nox -s tag should require little/no knowledge of how the tagging tool works under the hood, and should 'just work'"

Based on running the tag tool multiple times, I'm fairly confident I know (relative to the docs directory) where it expects core to be. I can add in a test for if it already exists either there or in the tmp location, and potentially some other checks to confirm branches etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

@x1101 that makes sense and maybe I'm coming around to the idea of doing the clone here. One thing I think it's important to avoid is making the nox session too complex and my suggestions could be pushing things down the wrong path. The nox session should only be a light wrapper to the tagger script.


# If run without any commands, default to "tag"
x1101 marked this conversation as resolved.
Show resolved Hide resolved
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
x1101 marked this conversation as resolved.
Show resolved Hide resolved

session.run("python", "hacking/tagger/tag.py", *args)
3 changes: 3 additions & 0 deletions tests/tag.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gitpython
packaging
typer
x1101 marked this conversation as resolved.
Show resolved Hide resolved
30 changes: 30 additions & 0 deletions tests/tag.txt
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to be integrated into the automatic dependency update job.

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