-
Notifications
You must be signed in to change notification settings - Fork 15
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
Tools transition prepare release #91
Conversation
…into tools-transition
Move changelog into test dir
….9 features but GithubActions environment is 3.8.5
…ameters from pipeline parameters
Add checks to prevent Add checks and test cases to prevent multiple changelog add
…into tools-transition
Add trigger to run on all branches and pr requests
@@ -2,6 +2,9 @@ name: Tool Tests | |||
|
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.
Sharing some additional comments from my manual testing:
-
Minor release flow seems pretty fine.
-
Major release flow:
Release branch creation works fine.
But the changes made for master branch doesn't seem to be correct. Please check with the commit that I shared before -
Getting some errors after running the script for the second time:
....
....
subprocess.CalledProcessError: Command 'git checkout -b release-10.2-test' returned non-zero exit status 128.
-
For the missing/incorrect parameters, I would expect throwing errors beforehand, but for the most, we throw the error in very deeper levels (like when using github api or when splitting a string etc.).
Let's make some correctness checks for them at the very beginning of our main entrypoint.
I think we can have a function to do those checks such ascheck_args
or something. -
In
initialize_env
function, we should decide which repo to clone according toprj_name
arg.
It can be either "citus" or "citus-enterprise". So I think we can useadd_arg(..choices=..)
for that. -
For
--is_test
&cherry_pick_enabled
params, I think we can useadd_arg(..action='store_true'..
, instead of requiring to pass "True" string. -
For
schema_version
, I think we should error if it's passed for major release.
But we should be okay if it is passed or not passed for patch release. -
I think we should set
add_arg(..required=true
..), forprj_ver
,main_branch
&gh_token
. -
We should error if either of
cherry_pick_enabled
orearliest_pr_date
is set for major release.
But we should be okay if it is passed or not passed for patch release. -
We should error if
cherry_pick_enabled
is set to true butearliest_pr_date
is not given. -
Can we simplify
earliest_pr_date
format, like just'%Y.%m.%d
? I don't think we need to know hour, minute etc. ever. -
Seems that we currently don't use
exec_path
arg, can we remove that ?
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 addressed all of them except the action="store_true" parameters because when this parameter is used, it can not be set by user. It sets a constant variable not suitable for user-defined parameters
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 don't actually think it cannot be set by user.
Assuming is_test
arg, using store_true
means:
If user doesn't add --is_test
, then is_test
would automatically evaluate to false
, so we will disable test mode.
If user puts --is_test
into the args (without any additional strings), then argparese
should interpret is_test
as true
.
https://stackoverflow.com/a/8203679/13370386
Is there any reason for not using that ?
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 hadn't totally grasped the parameter. As you referenced, I understood and changed that way thanks 👍
* Fix cloned directory deletion error * Add repo parameter to support citus-enterprise * Add default value for main branch * Use some argparse features to improve UX * Add some more validations
* Add comment for resource_to_be_deleted array
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.
Works fine for community releases, but there are some problems with enterprise releases.
Please fix those problems by comparing the example commits that I shared via Teams chat.
Also, please add a good readme on how to use this script. Sharing an example in below, let's use a nicer wording.
Also please use your reasoning to make our README user-friendly. For example, you can consider a scenario where someone other than me or Hanefi does the prepare release stage:
(file name is something like README-prepare-release / README-prepare-release.txt)
First make sure that you have the dependencies for our script:
< one liner instruction to install dependencies >
For both major & patch release, provide `--prj-name` either as "citus" or "citus-enterprise".
Also provide `--main_branch` as `master` or `enterprise-master` depending on --prj-name` param.
For major release, do:
python3.x something --some params -- other params --an example version
For patch release, do:
python3.x something --some params -- other params --an example version
If you would like to bump the schema version for the patch release, also add X param like:
python3.x something --some params -- other params --an example version
If you would like to cherry pick commits for a patch release, also add Y, X .. params like:
python3.x something --some params -- other params --an example version
return has_match | ||
|
||
|
||
def append_line_in_file(file: str, match_regex: str, append_str: str) -> bool: |
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 couldn't quite understand what we are exactly doing in append_line_in_file
& prepend_line_in_file
.
Can you improve the readability of those two functions, or at least let's comment why do we do anIndex +1
/ anIndex +2
kind of things.
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.
Fixed
commits = pr.get_commits() | ||
for single_commit in commits: | ||
if not is_merge_commit(single_commit): | ||
cp_result = run(f"git cherry-pick {single_commit.commit.sha}") |
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.
We usually use -x
parameter to cherry-pick the commits:
-x
When recording the commit, append a line that says "(cherry picked from commit ...)" to the original
commit message in order to indicate which commit this change was cherry-picked from. ...
cp_result = run(f"git cherry-pick {single_commit.commit.sha}") | |
cp_result = run(f"git cherry-pick -x {single_commit.commit.sha}") |
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.
Fixed
functions * Remove does prefixes from branch check functions * Fix comments on repo references
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.
Looks pretty much fine to me, thank you for all the work & addressing the comments.
Please follow squash
strategy to merge your pr.
Left some minor final notes:
-
I run the script a few times and only in one of them it asked for
sudo
, not in the others.
Might worth to make sure that we fixed that issue. -
Seeing three files like
test1e58b070-b0bb-4f78-9ae4-3672bd131097
, do we ever use them (and why) ? If not, can we remove them ? -
For patch releases, we create two (release) test branches, can we avoid creating the later one (the one with uuid suffix) ?:
release-10.0-test
release-10.0-test_da502a7a-109e-44d5-92c6-d042e095b7e0
``` | ||
#### Patch | ||
``` console | ||
python -m packaging_automation.prepare_release --gh_token <your-personal-token> --prj_name citus-enterprise --prj_ver 10.0.4 --schema_version 10.0-5 |
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.
let's also add here --main-branch enterprise-master
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 is no need to add main-branch because main branch is set by project_name if not given as parameter
tools/packaging_automation/prepare_release.py
Line 563 in 25ff7c1
main_branch = arguments.main_branch if arguments.main_branch else repo_details[arguments.prj_name]["branch"] |
|
No description provided.