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

Unify changelog handling for rubygems & bundler #3848

Merged
merged 23 commits into from Sep 16, 2020

Conversation

deivid-rodriguez
Copy link
Member

Description:

This PR refactors the code to manage the rubygems changelog to reuse the same code bundler uses so that the way of handling both is consistent.

The workflow should now be the same for both, namely, make sure to use a proper label for PRs if they include user visible changes, and as long as we do that, we should be able to autogenerate the changelog without any user intervention.

Rubygems actually had some code to generate the changelog automatically, but had two problems:

  • All PRs were included in the changelog, whether they included user visible changes or not.
  • Changes were generated to a separate file that had to be copied manually to the actual changelog.

Now you can generate the changelog to include all relevante PRs before a release by using rake generate_changelog.

As a followup PR, I'll unify the release tasks for both libraries, not only the changelog.

Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

We're using whatever `rake` comes with ruby anyways when we run `rake
setup` in CI or our local machine. So let's not lock `rake`.
Since our changelog is generated only at release time, and not after
each PR, it doesn't make sense to keep an "Unreleased" section.
It's UTF-8 by default these days.
It's more handy if we always deal with arrays of lines inside.
The target release can be inferred.
So that it can replace the `util/update_changelog.rb` script.
So that they can be used for any target version.
@deivid-rodriguez
Copy link
Member Author

I'm reasonably happy with this as a first version now. Automatic changelog management is now integrated in both rubygems & bundler.

Release scripts now automatically generate the changelog including all merged but unreleased PRs since the latest release that make sense according to the "release level". I chose the following mapping for this (and the equivalent for bundler):

rubygems/.changelog.yml

Lines 23 to 34 in 6b382f4

patch_level_labels:
- "rubygems: security fix"
- "rubygems: minor enhancement"
- "rubygems: bug fix"
- "rubygems: backport"
minor_level_labels:
- "rubygems: major enhancement"
- "rubygems: deprecation"
- "rubygems: feature"
- "rubygems: performance"
- "rubygems: documentation"

That means:

  • Patch level releases automatically get all "bug fixes", "security fixes", "minor enhancements", and PRs specifically tagged as "backport" (those are meant to be tagged manually when backporting PRs cause cherry-pick errors because they depend on other PRs without user-facing changes).

  • Minor releases get everything patch level releases get, plus PRs tagged as "deprecation", "feature", "performance", and "documentation".

  • Major releases get every merged but unreleased PR.

Additionally, I created generate_changelog[<version>} rake tasks to test this. Running rake generate_changelog[3.2.0.rc.2] in the root folder would generate the changelog for rubygems 3.2.0.rc.2, which is currently:

+=== 3.2.0.rc.2 / 2020-09-15
+
+Minor enhancements:
+
+* Make --dry-run flag consistent across rubygems commands. Pull request
+  #3867 by bronzdoc
+
+Bug fixes:
+
+* Make `--default` and `--install-dir` options to `gem install` play nice
+  together. Pull request #3906 by deivid-rodriguez
+* Add missing fileutils require. Pull request #3911 by deivid-rodriguez
+* Fix false positive warning on Windows when PATH has
+  `File::ALT_SEPARATOR`. Pull request #3829 by deivid-rodriguez
+* `gem install --user` fails with `Gem::FilePermissionError` on the system
+  plugins directory. Pull request #3804 by nobu
+
+Performance:
+
+* Avoid duplicated generation of APISpecification objects. Pull request
+  #3940 by mame
+* Eval defaults with frozen_string_literal: true. Pull request #3847 by
+  casperisfine
+* Deduplicate the requirement operators in memory. Pull request #3846 by
+  casperisfine

Similarly, running rake generate_changelog[2.2.0.rc.2] inside bundler's root generates the current changelog for bundler 2.2.0.rc.2, which is:

+# 2.2.0.rc.2 (September 15, 2020)
+
+## Minor enhancements:
+
+  - Fix ls-files matching regexp [#3845](https://github.com/rubygems/rubygems/pull/3845)
+  - Remove redundant `bundler/setup` require from `spec_helper.rb` generated by `bundle gem` [#3791](https://github.com/rubygems/rubygems/pull/3791)
+
+## Bug fixes:
+
+  - Make `bundle clean --force` leave default gem executables untouched [#3907](https://github.com/rubygems/rubygems/pull/3907)
+  - Prioritize `path.system` over `path` when it makes sense [#3933](https://github.com/rubygems/rubygems/pull/3933)
+  - Sort requirements in Gem::Requirement to succeed comparison with different order [#3889](https://github.com/rubygems/rubygems/pull/3889)
+  - Print bug report template to standard error [#3924](https://github.com/rubygems/rubygems/pull/3924)
+  - Restore `bundle cache --all` in all cases [#3914](https://github.com/rubygems/rubygems/pull/3914)
+  - Move shebang to the top of `bin/console` template [#3927](https://github.com/rubygems/rubygems/pull/3927)
+  - Fix platform issues when running under a frozen bundle [#3909](https://github.com/rubygems/rubygems/pull/3909)
+  - Fix deprecation messages for `bundle install` flags, the config should be --local as before [#3917](https://github.com/rubygems/rubygems/pull/3917)
+  - Look for absolute path when removing bundler/setup from RUBYOPT in Bundler.unbundled_env method [#3877](https://github.com/rubygems/rubygems/pull/3877)
+  - Fix incorrect re-resolution when path gem excluded and not available [#3902](https://github.com/rubygems/rubygems/pull/3902)
+  - Fix error when building error message in `bundler/inline` [#3901](https://github.com/rubygems/rubygems/pull/3901)
+  - Fix regression related to locked ruby [#3900](https://github.com/rubygems/rubygems/pull/3900)
+  - Expand load paths in standalone setup.rb file [#3522](https://github.com/rubygems/rubygems/pull/3522)
+  - Fix broken exception recovery code when installing plugins [#3487](https://github.com/rubygems/rubygems/pull/3487)
+  - Fix incorrect build info on development versions of bundler, and on bundler versions installed as a default gem [#3778](https://github.com/rubygems/rubygems/pull/3778)
+  - Avoid autoloading `openssl` to try help with jruby load service issues [#3809](https://github.com/rubygems/rubygems/pull/3809)
+  - Fix `rake release` pushing all local tags instead of only the release tag [#3785](https://github.com/rubygems/rubygems/pull/3785)
+  - Fix `rake release` aborting when credentials file is missing, even if properly configured through XDG [#3783](https://github.com/rubygems/rubygems/pull/3783)
+
+## Deprecations:
+
+  - Deprecate `bundle cache --all` flag [#3932](https://github.com/rubygems/rubygems/pull/3932)
+
+## Documentation:
+
+  - Improve human readable fallback version of CLI help messages [#3921](https://github.com/rubygems/rubygems/pull/3921)
+  - Note CLI flag deprecations in documentation [#3915](https://github.com/rubygems/rubygems/pull/3915)
+  - Update man page and deprecation warning for binstubs --all [#3872](https://github.com/rubygems/rubygems/pull/3872)
+

Copy link
Member

@simi simi left a comment

Choose a reason for hiding this comment

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

Looks good!

One small note, what about to add @ before GH handle in Rubygems changelog?

+* Make `--default` and `--install-dir` options to `gem install` play nice
+  together. Pull request #3906 by deivid-rodriguez
+* Make `--default` and `--install-dir` options to `gem install` play nice
+  together. Pull request #3906 by @deivid-rodriguez

@deivid-rodriguez
Copy link
Member Author

My intention was to make the tasks configurable enough so that I could respect the current format each library use.

I agree with your suggestion though, but I'd rather do it separately since we should probably update the whole Rubygems changelog in that case.

@deivid-rodriguez
Copy link
Member Author

Let's do it!

@deivid-rodriguez deivid-rodriguez merged commit 5294c86 into master Sep 16, 2020
@deivid-rodriguez deivid-rodriguez deleted the rubygems_changelog branch September 16, 2020 12:58
@simi
Copy link
Member

simi commented Sep 16, 2020

🥳 🎉

deivid-rodriguez added a commit that referenced this pull request Oct 5, 2020
Unify changelog handling for rubygems & bundler

(cherry picked from commit 5294c86)
deivid-rodriguez added a commit that referenced this pull request Oct 6, 2020
Unify changelog handling for rubygems & bundler

(cherry picked from commit 5294c86)
deivid-rodriguez added a commit that referenced this pull request Oct 6, 2020
Unify changelog handling for rubygems & bundler

(cherry picked from commit 5294c86)
deivid-rodriguez added a commit that referenced this pull request Oct 6, 2020
Unify changelog handling for rubygems & bundler

(cherry picked from commit 5294c86)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants