-
Notifications
You must be signed in to change notification settings - Fork 27
Conversation
Can one of the admins verify this patch? |
@user-cont/the-team hey guys, could you please review and reply to Shresth? I'd like to know your opinion before I state mine. |
In setup.py (or setup.cfg), you can specify |
I vote for something simillar to what we have now, so we can easily continue to use this. (Ideally, we can have same format for changelog as well as for git release, so markdown and
It's usefull and it's a common practice. The gitchangelog supports that:
|
+1 for having sections. |
As for distributing the files, you can also put them into python code as multiline strings. |
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.
Very nice progress. I'd personally prefer if the init change was done as a new PR. But never mind now.
release_bot/cli.py
Outdated
@@ -31,6 +31,8 @@ def parse_arguments(): | |||
default='') | |||
parser.add_argument("-v", "--version", help="display program version", action='version', | |||
version=f"%(prog)s {configuration.version}") | |||
parser.add_argument("-i", "--init", help="initializes the repo to be used by the release_bot", |
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.
please do a subcommand, not an option:
$ releasebot init ...
release_bot/init_repo.py
Outdated
""" | ||
Creates template file for the Markdown output | ||
""" | ||
template_string ="""{{#general_title}} |
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.
can we store this in the top of the file?
release_bot/init_repo.py
Outdated
|
||
{{/versions}}""" | ||
# This removes the tabed spaces from the template_string | ||
template_string = template_string.replace(' ','') |
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.
eiwwww, just format the string correctly in the first place
Just a few more suggestions from maintainers.
|
Hey can someone from the maintainers review the PR as I have made all of the changes requested! Thanks |
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.
@TomasTomecek check your requested changes
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.
Just nits, not blocking the merge.
README.md
Outdated
@@ -140,6 +167,13 @@ Here are possible options: | |||
|
|||
Sample config named [release-conf-example.yaml](release-conf-example.yaml) can be found in this repository. | |||
|
|||
## GitChangeLog | |||
|
|||
For using the [gitchangelog](https://github.com/vaab/gitchangelog) you must add the line `gitchanelog = true` to the conf.yaml, and add the files `.gitchangelog.rc` and `markdown.tpl` in the root of your upstream project repository. Sample config files: [.gitchangelog.rc](/gitchangelog/.gitchangelog.rc) and [template.tpl](/gitchangelog/template.tpl). |
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.
gitchanelog = true
-> gitchanelog : true
release_bot/cli.py
Outdated
if not args.configuration.is_file(): | ||
configuration.logger.error( | ||
f"Supplied configuration file is not found: {args.configuration}") | ||
exit(1) |
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.
Would not be better to raise an exception here?
release_bot/init_repo.py
Outdated
""" | ||
self.conf['repository_name'] = input('Please enter the repository name:') | ||
self.conf['repository_owner'] = input('Please enter the repository owner:') | ||
print("""for details on how to get github token checkou |
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.
checkou -> checkout
release_bot/init_repo.py
Outdated
""" | ||
Create the release-conf.yaml and conf.yaml | ||
""" | ||
self.conf['repository_name'] = input('Please enter the repository name:') |
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 like to have some validation of input but could be done in follow-up PRs
f14d5ff
to
72b6b38
Compare
I just tried this and here is my observation:
Edit: figured it out: mustache was not installed, I have a changelog now: packit/ogr#39 And finally, I had to signifiicantly patch release-bot to make it run - the CLI code seems to be pretty borked. diff --git a/release_bot/cli.py b/release_bot/cli.py
index e18e32c..be21d12 100644
--- a/release_bot/cli.py
+++ b/release_bot/cli.py
@@ -37,15 +37,6 @@ class CLI:
"""
Makes the bot to perform normal release tasks
"""
- if args.configuration:
- args.configuration = Path(args.configuration).resolve()
- if not args.configuration.is_file():
- raise ReleaseException(
- f"Supplied configuration file is not found: {args.configuration}")
- if args.debug:
- configuration.logger.setLevel(logging.DEBUG)
- for key, value in vars(args).items():
- setattr(configuration, key, value)
parser = argparse.ArgumentParser(description="Automatic releases bot", prog='release-bot')
parser.add_argument("-d", "--debug", help="turn on debugging output",
@@ -62,4 +53,13 @@ class CLI:
parser_init.set_defaults(func=run_init)
args = parser.parse_args()
+ if args.debug:
+ configuration.logger.setLevel(logging.DEBUG)
+ for key, value in vars(args).items():
+ setattr(configuration, key, value)
+ if args.configuration:
+ configuration.configuration = Path(args.configuration).resolve()
+ if not configuration.configuration.is_file():
+ raise ReleaseException(
+ f"Supplied configuration file is not found: {args.configuration}")
args.func(args) I understand that argparse is hard to work with, feel free to get inspired 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.
I understand that argparse is hard to work with, please see my patch above and a link how you can easily do subcommands with argparse.
release_bot/cli.py
Outdated
if not args.configuration.is_file(): | ||
raise ReleaseException( | ||
f"Supplied configuration file is not found: {args.configuration}") | ||
if args.debug: |
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 is deadcode and debug logging is never set.
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.
Hey, I just dont know how and why I did this mistake, will correct it!
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.
Okay while I created the function run_bot the indentation was mistakened while copying! Really sorry for it
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 just found a bug in Atom, if you move lines up or down using ctrl it just automatically changes the indentation :(
release_bot/cli.py
Outdated
f"Supplied configuration file is not found: {args.configuration}") | ||
if args.debug: | ||
configuration.logger.setLevel(logging.DEBUG) | ||
for key, value in vars(args).items(): |
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 should not be in the if debug
branch.
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 understand that argparse is hard to work with, please see my patch above and a link how you can easily do subcommands with argparse.
Hey did you remove the patch?? When I first saw your review there was some code edits ?
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.
Thanks @TomasTomecek will work on it
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.
By patch I meant the diff in the big comment above.
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.
@TomasTomecek, I think this is better!
needs rebase |
Hey, Sorry I was really busy on some other project! how should I go forward with this pull request? Should I rebase? |
That would be a good (re-)start, yes, please. |
6dbf869
to
2029187
Compare
Is this better? I am not a pro at git rebase so it might be that I would have messed up something! Let me know if any further changes are required! |
As github says, there are still conflicts which need to be addressed. You first need to fetch latest changes from upstream master and then do The rebase procedure is explained really well here: https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request |
2029187
to
e098d2d
Compare
Sorry for a lack of response, but most of the team was busy with various tasks lately. I just tried this locally and sadly it doesn't work:
Seems like you made a small mistake when rebasing, can be easily solved, see mu suggest. Otherwise this works fine. LGTM |
Co-Authored-By: Tomas Tomecek <[email protected]>
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.
LGTM, thank you!
This PR is still incomplete!
Solves #91
To test this, copy gitchangelog/.gitchangelog.rc and gitchangelog/markdown.tpl into the the root dir of the project.
I need some help from maintainers regarding the following points to complete this pr:
How should I include the the not python files (.gitchangelog.rc and template.tpl) into the package and automatically copy it using python to the repo. (This would help in solving release-bot init #168 also)
How should the change log look like by default? This would help me create the template for the gitchangelog and also currently the changelogs are divided into parts(New, Changes, Fix, Others) Do we need that?
sidenote: I have also included the commits from my previous PR because that bug was creating a problem in GitChangeLog implementation.