-
Notifications
You must be signed in to change notification settings - Fork 272
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
Release Notes tracker for component repos #2438
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2438 +/- ##
============================================
- Coverage 94.63% 94.35% -0.28%
Complexity 27 27
============================================
Files 213 218 +5
Lines 4324 4449 +125
Branches 29 29
============================================
+ Hits 4092 4198 +106
- Misses 226 245 +19
Partials 6 6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is a good start, but breaks several patterns in the python code in this repo.
- Arguments are passed as ENV variables, where they should be passed as
--arguments
. Create an arguments class. - It's not object oriented, mixes many concerns, making it quite messy and difficult to extend. Follow the workflow pattern we have, start by adding a class that encapsulates the concept of release notes, another to get a collection of commits (each an instance of a class) after a date, etc.
- Python has nice OO ways to manipulate git, I googled https://gitpython.readthedocs.io/en/stable/tutorial.html, get rid of all command shell calls to git.
I don't think this needs to be a Jenkins workflow, consider GHA? The commenting on a GitHub issue can be done in 2 lines with an existing GitHub action.
Hey @dblock
|
This will fail with our code setup, which I have tried initially as once we |
This is not a good reason, you're just acquiring technical debt.
Ok
I don't understand this. All our scripts use command line arguments. You're creating something that doesn't. There's no good reason for it. |
Use |
Thanks for the suggestions @dblock |
8e69a6c
to
8788a3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's quite a bit more work to do to make this well organized.
You have a list of components (already implemented). Each is checked out into a folder (needs to be implemented). Each may have release notes (to be implemented). Don't put all this unrelated logic into a script. If all these are properties of classes then you'll end up with a very simple runner and an easy to test and extend implementation. Give it a try.
db0eb8c
to
32f8278
Compare
Hey @dblock I have modified the code to make sure its separated with classes, methods and using separate args. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below for next steps.
Hi, This is just a list of improvements for later:
Thanks. |
Hey @peterzhuamazon |
Part (3) is probably indicative of us trying to over-engineer something. There's already a tool for adding or editing a comment on GitHub called |
Hey @dblock, for creation of comment we need a right github repo URL, issue number and token to authenticate the repo, Initially I have passed via environmental values but inclining with our workflows I have created a new args class |
I propose not to do this in this tool, not to add |
765352e
to
3749ba3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
The major pieces of feedback is in tests that need to stub execution of git commands instead of doing actual git commands.
|
||
gitLogDate = '2022-07-26' | ||
|
||
gitLogDateAssert = datetime.datetime.strptime(gitLogDate, "%Y-%m-%d").date() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're not reusing variables, don't declare them as globals. Also camelCase is not Python.
) | ||
) | ||
|
||
gitLogDate = '2022-07-26' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just hard-code it in each of the tests, just like the word "check" for example. The value only matters in 1 of the tests and it's easier to read the tests individually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you resolved this, but 1) it makes tests hard to read 2) it's still camelCase which is not Python. Change gitLogDate
below to the actual date "2022-07-26", there's no need for this variable.
b6b1498
to
a31b93f
Compare
01e787c
to
b1b6744
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting closer. The big missing piece is that tests lump multiple parts under test in basically two tests in test_releasenotes_check_function
. That needs to be broken up and unit tests written for each separate class that was added or changed.
) | ||
) | ||
|
||
gitLogDate = '2022-07-26' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you resolved this, but 1) it makes tests hard to read 2) it's still camelCase which is not Python. Change gitLogDate
below to the actual date "2022-07-26", there's no need for this variable.
tests/tests_release_notes_workflow/test_releasenotes_check_args.py
Outdated
Show resolved
Hide resolved
tests/tests_release_notes_workflow/test_releasenotes_check_functions.py
Outdated
Show resolved
Hide resolved
tests/tests_release_notes_workflow/test_releasenotes_check_functions.py
Outdated
Show resolved
Hide resolved
4678b5e
to
8102105
Compare
Hey @dblock I have addressed the suggested changes, can you review back again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's quite a bit of work to get the tests to actually test what is intended in this code.
tests/tests_release_notes_workflow/test_component_release_notes.py
Outdated
Show resolved
Hide resolved
tests/tests_release_notes_workflow/test_component_release_notes.py
Outdated
Show resolved
Hide resolved
tests/tests_release_notes_workflow/test_component_release_notes.py
Outdated
Show resolved
Hide resolved
tests/tests_release_notes_workflow/test_releasenotes_check_args.py
Outdated
Show resolved
Hide resolved
105bbfb
to
9415fa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Fix CI on Windows, needs an
os.path.join
instead of a hard-coded/
. - See below.
tests/tests_release_notes_workflow/test_component_release_notes.py
Outdated
Show resolved
Hide resolved
tests/tests_release_notes_workflow/test_releasenotes_check_args.py
Outdated
Show resolved
Hide resolved
4bcf433
to
cf63008
Compare
Signed-off-by: prudhvigodithi <[email protected]>
Description
Expected inputs:
GIT_LOG_DATE
: To check if commit exists after a specific dateADD_COMMENT
: true/falseGIT_ISSUE_NUMBER
: release issue to add the generated table as comment.GITHUB_TOKEN
: token used to add the commentThis PR adds code that adheres to existing workflows
Execution command:
./run_releasenotes_check.sh manifests/2.2.0/opensearch-2.2.0.yml
Create a mark-down table as follows, adding the latest commitID after a certain date, and if contains a release notes with YES/NO/NULL
Issues Resolved
#2345
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.