-
Notifications
You must be signed in to change notification settings - Fork 319
Multi-file running changelog strategy #6740
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
Conversation
changelog/unreleased/6540.json
Outdated
| [ | ||
| { | ||
| "type": "Bug fixes and improvements", | ||
| "title": "Fixed approaches list update in `RouteOptionsUpdater`(uses for reroute). It was putting to the origin approach corresponding approach from legacy approach list." |
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.
Will the PR links be added automatically?
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.
Yes
changelog/unreleased/6540.json
Outdated
| @@ -0,0 +1,6 @@ | |||
| [ | |||
| { | |||
| "type": "Bug fixes and improvements", | |||
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 how we can easily make a typo here and get a weird header. Can we make it fool-proof? For example:
We only have a finite number of headers. Features, Bug fixes and improvements, Known issues.
Can we create directories for them? And then what's left is place a change entry as a plain string.
So for this example it would be:
- find directory "changelog/unreleased/Bug fixes and improvements"
- Create a file "6540.json"
- The file contents:
[
"Fixed approaches list update in `RouteOptionsUpdater`(uses for reroute). It was putting to the origin approach corresponding approach from legacy approach list."
]
If there are multiple entries, we just add a second array item.
What I want to do here is to not use any json keys. Because it creates room for errors as well as typing "Bug fixes and improvements" every time.
I think an array of string would be sufficient, WDYT?
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 the only field that left in file is title, maybe we can replace json with md?
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 think it's a good point. In our case we have only 2 main parts: features and bugfixes, we can move type to path and make changelog file as md file
| @@ -0,0 +1,59 @@ | |||
| # Multi-file running changelog | |||
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 should definitely adapt changelog verification script... But first we have to agree on a format. I've left some suggestions.
I think we will have to check then:
- A file (at least one) has been added to "changelog/unreleased";
- The file is called PR_NUMBER.json;
- It's a valid json array of strings;
- Maybe something else, I'll have to look at the current checks.
|
Few things to keep in mind. Changelog entries may have:
|
|
Spent some time thinking/discussing and am sharing that I'm in favor. Great idea, and I like how it is something that GitLab had an issue with and came to a similar conclusion. They liked the solution enough to write a blog post https://about.gitlab.com/blog/2018/07/03/solving-gitlabs-changelog-conflict-crisis/ I have some minor opinions on the details, but overall I'm in favor. Cleaner solution than what we're doing now, the issue will be fixed, and it can be expanded for more improvements 👍 |
changelog/README.md
Outdated
| - Mapbox Java `v6.8.0` ([release notes](https://github.com/mapbox/mapbox-java/releases/tag/v6.8.0)) | ||
| - Mapbox Android Core `v5.0.2` ([release notes](https://github.com/mapbox/mapbox-events-android/releases/tag/core-5.0.2)) | ||
| ``` | ||
| * write the changelog to the `CHANGELOG.md` file |
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.
capturing @tomaszrybakiewicz comment: Instead of generating CHANGELOG during release, do this on PR merge.
I'm also +1'ing that. It is nice to see a running changelog, instead of needing to dig through each new file created.
Considering that may re-introduce the merge conflict issue, maybe it could be part of a script where we can say sh scripts/show-unreleased-changelog.sh? Preferably, there is a way to make it so we can have a running changelog
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.
an idea is to have a file that represent the latest. every time a new pull request is merged the other one is deleted.
pr 01 is merged
01-changelog.md is created
pr 02 is merged
01-changelog.md is deleted
02-changelog.md is created
not the best solution considering that the unreleased changelog link would have a short life https://github.com/mapbox/mapbox-navigation-android/blob/main/unreleased/01-changelog.md
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.
Considering that may re-introduce the merge conflict issue,...
After merging a PR, the automation would append a new entry to the latest CHANGELOG.md file on the main branch. How would that create a conflict?
(main)
* PR 1 merged
* CHANGELOG.md update: PR 1 entry
* PR 2 merged
* CHANGELOG.md update: PR 2 entry
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.
Do we want to keep current not released version of running changelog publicly available?
If no, maybe we can generate current changelog by request inside the release train app?
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.
After merging a PR,
it means that changelog must be merged separately, in another commit, out of PR merge. It seems risky: make it in 1 step (aka transaction) safer, than drop to a few
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.
also, this way we will have 2x commits in the branch (1 is changed + 1 changelog)
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.
Do we really need unreleased changelog in one file before release?
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.
it means that changelog must be merged separately, in another commit, out of PR merge. It seems risky: make it in 1 step (aka transaction) safer, than drop to a few
@RingerJK It's as risky as Release Train or CI release workflows making additional commits.
also, this way we will have 2x commits in the branch (1 is changed + 1 changelog)
And why is that a problem?
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 think we can add one more job for the main branch to generate a running changelog file. This job will be executed after every merge
changelog/README.md
Outdated
| [ | ||
| { | ||
| "type": "Features", | ||
| "title": "Description of 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.
is title a string that contains markdown?
changelog/README.md
Outdated
|
|
||
| To avoid merge conflicts in the CHANGELOG.md file we accepted the multi-file running changelog strategy. | ||
|
|
||
| To follow this strategy you should create a `changelog/unreleased/${PR_NUMBER}.json` file for every PR like: |
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 add many lines during bump of NN and common dependencies. Does it mean that we will have to add as many files as many line we want to add during update of NN?
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.
yeah, if we move features/bugfixes type to the path we can add files with additional info like this in the unreleased directory and structure will be like:
changelog
--unreleased
----features
------feature_1.md
----bugfixes
------bugfix_1.md
----other_change_1.md
----other_change_2.md
|
Should we let to insert sections like this or it should be done manually during release? |
changelog/README.md
Outdated
|
|
||
| To avoid merge conflicts in the CHANGELOG.md file we accepted the multi-file running changelog strategy. | ||
|
|
||
| To follow this strategy you should create a `changelog/unreleased/${PR_NUMBER}.json` file for every PR like: |
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.
for that approach, we have to add a changelog in another commit (first create PR, get the PR number, and put the changelog and PR number into the branch).
Can it be modified so that we don't add the PR number manually? Can it be added under the hood when PR has been created?
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.
for that approach, we have to add a changelog in another commit
I like to use the -f option but yes, I agree that it can get annoying.
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 it's not comfortable to write a changelog only after creating PR. I can propose creating an action that will rename the changelog file to ${PR_NUMBER}.md:
- You create a PR (with changelog file feature_1.md)
- The action executes and rename the changelog file to ${PR_NUMBER}.md
Action will be executed only on open/reopen/redy for review moments
WDYT
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 👍
how does it works for release branches where we mostly cherry-pick changes (sometimes already released)? ref #6740 (comment)
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.
oh it's a good moment, I think we can create a PR to the release branch first. Then, the action will rename the changelog file. Then, we can cherry-pick commits (changes + renaming commit) to the main 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.
oh it's a good moment, I think we can create a PR to the release branch first. Then, the action will rename the changelog file. Then, we can cherry-pick commits (changes + renaming commit) to the main branch
Typically we merge into main branch, and then cherry-pick into the release branch(es). Maybe minor detail but I don't think we want it to require release commits first.
|
@SevaZhukov would be any corner cases for release branches? Could you mention if any in |
Good point, I have added this section |
Codecov Report
@@ Coverage Diff @@
## main #6740 +/- ##
=========================================
Coverage 72.51% 72.51%
Complexity 5551 5551
=========================================
Files 779 779
Lines 30072 30072
Branches 3548 3548
=========================================
Hits 21806 21806
Misses 6841 6841
Partials 1425 1425 |
| ``` | ||
|
|
||
| You can choose any name for your changelog files because the GitHub action will rename files in | ||
| `changelog/unreleased/features` and `changelog/unreleased/bugfixes` directories to `${PR_NUMBER}.md` when you open a PR. |
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.
What about the issues directory and just changelog/unreleased?
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 need PR's links only for bugfixes and features
changelog/README.md
Outdated
| ``` | ||
|
|
||
| * write the changelog to the `CHANGELOG.md` file | ||
| * delete all files from `changelog/unreleased` |
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 make sure patch releases won't erase all main changelog entries...
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.
Releases since rc.1 will erase changelog/unreleased dir only in release branches
| @@ -0,0 +1 @@ | |||
| Fixed approaches list update in `RouteOptionsUpdater`(uses for reroute). It was putting to the origin approach corresponding approach from legacy approach list. No newline at end of file | |||
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.
Shouldn't there be a - in the beginning?
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 think the script will add - during assembling
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.
It's not a very good idea. If the entry is multi-line, how will the script understand where to add the -?
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 have only one feture/bugfix you can don't use - before, if you have more you should
| @@ -0,0 +1 @@ | |||
| Updated the `MapboxRestAreaApi` logic to load a SAPA map only if the upcoming rest stop is at the current step of the route leg. No newline at end of file | |||
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.
Shouldn't there be a - in the beginning?
| @@ -0,0 +1 @@ | |||
| It is an example of known issues No newline at end of file | |||
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.
Shouldn't there be a - in the beginning?
| diff_file_start_regex = "^([\s]*)\@\@(.*)\@\@" | ||
| pr_link_regex = "\[#\d+]\(https:\/\/github\.com\/mapbox\/mapbox-navigation-android\/pull\/\d+\)" | ||
|
|
||
|
|
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.
That's not what I meant when saying we should adapt the checks...
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 didn't do anything with 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.
But there are changes in the diff...
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.
only autoformating
| - Description of changes in md format also | ||
| ``` | ||
|
|
||
| You can choose any name for your changelog files because the GitHub action will rename files in |
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 think it's worth mentioning that you can't create 2 files in 1 directory in 1 PR. I don't think we someone would want that (I don't see any cases for that) but still we should note 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.
but I mentioned 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.
It doesn't say you can't create mmultiple files.
8245f2b to
9d325a2
Compare
|
hey team, I added two GitHub actions
After it commits and pushes to the current branch. Commit name contains @tomaszrybakiewicz @kmadsen @VysotskiVadim @RingerJK @dzinad |
changelog/README.md
Outdated
|
|
||
| You can use anything that allow .md format in changelog files. | ||
|
|
||
| If you have implemented some features or bugfixes you should describe all of them: |
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.
some -> several/multiple
changelog/README.md
Outdated
| You can choose any name for your changelog files because the GitHub action will rename files in | ||
| `changelog/unreleased/features` and `changelog/unreleased/bugfixes` directories to `${PR_NUMBER}.md` when you open a PR. | ||
|
|
||
| Every release the release train app will: |
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.
It's not only on every release, right? It will happen after every merge? Can you actualize README? Because that's all I'm reviewing actually: this file and the examples. :)
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.
updated
changelog/unreleased/CHANGELOG.md
Outdated
| @@ -0,0 +1,11 @@ | |||
| #### Features | |||
| - Test changes to check renaming | |||
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.
What about the PR links? They should be here because we've lost all the info about where this entry came from at this point, right?
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 added links to assembled changelog, thanks
| Some other changes | ||
| ``` | ||
|
|
||
| * write the changelog to the `changelog/unreleased/CHANGELOG.md` file |
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.
What about the release process? Shouldn't we move the changelog from unreleased directory to the project root and delete the unreleased one?
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.
Added more information
| You can choose any name for your changelog files because the GitHub action will rename files in | ||
| `changelog/unreleased/features` and `changelog/unreleased/bugfixes` directories to `${PR_NUMBER}.md` when you open a PR. | ||
|
|
||
| Every push to the main or release branch Assemble changelog GitHub action will be executed: |
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.
The temporary files will be deleted, right?
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.
no, let's keep they before the release
54394ac to
11ae8c3
Compare
|
The docs and the examples look good. And I believe you know what you're doing with the scripts. :) |
17e22ac to
17bda6f
Compare
| - Mapbox Android Core `v5.0.2` ([release notes](https://github.com/mapbox/mapbox-events-android/releases/tag/core-5.0.2)) | ||
| ``` | ||
| * add compiled changelog to `CHANGELOG.md` file | ||
| * delete all files in `changelog/unreleased` dir |
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.
@SevaZhukov will this system work with the android auto changelog https://github.com/mapbox/mapbox-navigation-android/blob/main/libnavui-androidauto/CHANGELOG.md
All good to consider it out of scope but it would be nice if it supported multiple release channels
| You can choose any name for your changelog files because the GitHub action will rename files in | ||
| `changelog/unreleased/features` and `changelog/unreleased/bugfixes` directories to `${PR_NUMBER}.md` when you open a PR. | ||
|
|
||
| Every push to the main or release branch Assemble changelog GitHub action will be executed: |
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.
Will those commit trigger metrics run? For now it seems so, because each PR merge produces 2 commits in the main 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.
[skip ci] tag allows skipping CircleCI jobs and GitHub Actions
| import git | ||
|
|
||
|
|
||
| def get_changes(path): |
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.
What is the testing strategy for the changelog logic? Do I understand correctly that after each change I need to manually run script locally simulating different scenarios that my change may affect? Do you think it makes sense to add auto tests, so that developers could enhance this logic without being afraid break a different scenario?
I think this question isn't a blocker for this particular PR, but it's worth to discuss 🙂
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.
yeah, good point, let's add tests for this logic
|
|
||
| To follow this strategy you should create a `.md` file for every PR. Choose a directory: | ||
|
|
||
| - `changelog/unreleased/features` for **Features** 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.
IMO would be nice to have a script to add changelog like python add_changelog.py -f "Changelog string", where -f is feature (also should be other flags), "Changelog string" is the entry of changelog
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.
done
(cherry picked from commit b329337)
Our current running changelog strategy is a reason for merge conflicts in every 1-3 PR. The new Multi-file running changelog strategy will solve this problem. How will it work you can read here.
@VysotskiVadim already tried to run Multi-file running changelog strategy in #5354 but he was faced with the need for maintaining a lot of code on CI for assembling changes. Now we can delegate assembling to the release train app.