-
Notifications
You must be signed in to change notification settings - Fork 508
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
Add support for grouping dependency updates #2714
Add support for grouping dependency updates #2714
Conversation
Codecov ReportBase: 80.62% // Head: 80.28% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2714 +/- ##
==========================================
- Coverage 80.62% 80.28% -0.34%
==========================================
Files 147 149 +2
Lines 2740 2831 +91
Branches 175 191 +16
==========================================
+ Hits 2209 2273 +64
- Misses 531 558 +27
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Great. I like the overall idea since it can cover multiple scenario (1. Grouping to reduce number of PR/CI, 2. Grouping relevant dependencies like Typelevel OSSs). |
@exoego @fthomas this is ready to review now. Even though there are a ton of changes, they should be easy to follow if following the |
…ests Co-authored-by: Terry Hendrix <terryhendrix1990@gmail.com>
Co-authored-by: Terry Hendrix <terryhendrix1990@gmail.com>
…field Important! This is a temporal change to ensure compilation and tests while the subsequent changes are applied. The `oldUpdate` field will be removed once every usage has been changed to `update`.
Since `GroupedUpdate`s will always have the same branch
Since branch is always the same for `GroupedUpdate`s there is no point in looking for obsolete PRs
…t `AnUpdate` For grouped updates we just apply every change for the contained updates.
…g PR For grouped updates we just joined together the list of files of the contained updates.
…just the versions
…pdate's next version
# `filter` properties would have this format: | ||
# | ||
# { | ||
# version = "major" | "minor" | "patch" | "pre-release" | "build-metadata", |
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.
@alejandrohdezma I think it is better to explain the differences of these version
enums.
Specially, I do not get build-metadata
🙇
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.
Maybe it can be a good idea to refer to the semver.org docs on these docs. WDYT?
On build-metadata
from point 10:
Build metadata MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch or pre-release version. Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. Identifiers MUST NOT be empty. Build metadata MUST be ignored when determining version precedence. Thus two versions that differ only in the build metadata, have the same precedence. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700, 1.0.0-beta+exp.sha.5114f85, 1.0.0+21AF26D3—-117B344092BD.
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.
Ah it is sem-ver terms.
Yeah, a link to that sounds enough
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! See f0158c6
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.
Though I think AnUpdate
and GroupedUpdate
is a confusing name since there are already Update.Single
and Update.Group
, the feature itself looks great to me.
We may consider refactoring later.
I left a comment to improve document.
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
@exoego Do you think we can merge this so we can test it thoroughly with a snapshot version? |
Yes. Let's do |
Hi, love this feature! Does it only perform creation of grouped pull requests, or is it capable of dealing with updating existing pull requests when additional updates for the group come along? For instance, given this config, grouping
...should we expect the first PR raised in our repo (PR 4629, for If it's of interest, you can see the GitHub Action runs of Scala Steward that are happening here: https://github.com/guardian/scala-steward-public-repos/actions/workflows/public-repos-scala-steward.yml |
Hey @rtyley. No, the grouping functionality just creates grouped PRs with all the updates that fall into the group. So in your case, it should have created a new PR titled |
Thanks @alejandrohdezma - I ran the job again with debug enabled: https://github.com/guardian/scala-steward-public-repos/actions/runs/3901103941/jobs/6662904571 Hyperlinks to particular points of this large log file don't seem to work in the GitHub UI, but I think you could find the relevant bit by searching for Unfortunately I don't think it's printed out the aggregate config, and also at that moment in time I don't think there were any new AWS PRs to open. |
Not sure if this will fully resolve the problems with Scala Steward not respecting the `pullRequests.grouping` setting, but from testing on another repo (https://github.com/guardian/play-secret-rotation), I did find that the full group name must be specified (so `software.amazon.awssdk`, not `software.amazon`). * guardian/play-secret-rotation#381 - incorrectly grouped, Scala Steward conf was `"group" = "software.amazon"` * guardian/play-secret-rotation#382 - correctly grouped, Scala Steward conf was `"group" = "software.amazon.awssdk"` See also the discussion in scala-steward-org/scala-steward#2714 (comment)
Hey @rtyley, if it isn't fixed, do you mind opening a new issue and cc-ing me? So we can properly track it |
In October 2022 scala-steward-org/scala-steward#2714 introduced the capability to group together pull requests. If you want, you can have all updates go into one single PR, or you can also group by criteria, so that noisy releasers (like AWS SDK) are grouped into one PR, while everything else goes into another PR (these might be more significant updates that people would want to consider more urgently). The behaviour (I _think_) appears to be that once a grouped PR is created, it's _not_ updated with new updates, so you have to merge it before you get another round of updates - but I don't think that's so bad. It certainly dramatically reduces update noise. I've been using it on https://github.com/guardian/play-secret-rotation and I'd say it behaves well. This department-wide config change was discussed at the P&E Server-side meetup on 1st February 2023, to positive assent (I just never got around to making the PR until now!). https://docs.google.com/document/d/1wtZPwICuEeMQ8Ga7ErUIMZsWalnsI0DpnvnkNI3Qy5U/edit#heading=h.vjxmdl6a7ue3 https://github.com/scala-steward-org/scala-steward/blob/dc85945c95c69cb8dce3d4b5f862e41ecd692417/docs/repo-specific-configuration.md?plain=1#L37-L72
💻 How to review this PR?
This PR was created with the idea of being reviewed commit by commit.
Each commit contains an incremental change (and its tests, if applicable) that makes it easier to review. Also some of the commits contain additional information in their description to help understand why the change was made.
I also recommend checking "Hide whitespace" when reviewing this PR!
🎯 What's the goal of this PR?
This PR adds support for a long-requested feature of Scala Steward, the ability to group pull-request updates.
❓ How this will be done?
A new configuration value (
pullRequests.grouping
) can be added to the.scala-steward.conf
file. This config will represent the desired PR groups.A group will be an object with:
name
(mandatory): the name of the group, can be used for things like naming the branch.title
(optional): if provided it will be used as the title for the PR.filter
(mandatory): a non-empty list containing the filters to use to know if an update falls into this group. Filters would have this format:{version = "major" | "minor" | "patch" | "pre-release" | "build-metadata"}, group = "{group}", artifact = "{artifact}"}
.For filters every component is optional but at least one must be provided. For grouping every update a filter like
{group = "*"}
can be provided.Examples
☝🏼 This configuration will group updates in two PRs: one titled "Patch updates" that will contain patch version updates and another one titled "Minor/major updates" with the rest of them.
☝🏼 This configuration will group Typelevel and Http4s updates into one PR. Since there is no other group, any update not falling into this group will follow normal behavior.
☝🏼 This configuration will group updates whose artifact is named
my-library
ormy-org:my-other-library
in one PR titledmy_libraries
(no title provided, so it will usename
) and any other update under one PR titled "Not my libraries"🔖 Summary of changes made
Update
objects based on configuration.