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

feat(manager/bundler): support groups within source blocks #27424

Merged
merged 5 commits into from Mar 24, 2024

Conversation

mustardnoise
Copy link
Contributor

@mustardnoise mustardnoise commented Feb 19, 2024

Changes

This PR fixes the updating of gems from private sources with groups.

Context

I have a Gemfile with the private source and groups within this source.

source 'https://rubygems.org'

ruby '3.3.0'

gem 'rails', '~> 7.1'

source 'https://PRIVATE' do
  group :test do
    gem 'private_dummy', '~> 0.0.1'
  end

  group :production do
    gem 'another_private_dummy', '~> 0.0.1'
  end
end

It is currently not possible to update gems in the next group(s) within the private source.

Example of a log message BEFORE the fix:

DEBUG: packageFiles with updates (repository=playground/renovate_bug, baseBranch=main)
       "config": {
         "bundler": [
           {
             "registryUrls": ["https://rubygems.org"],
             "deps": [
               {
                 "depName": "ruby",
                 "currentValue": "3.3.0",
                 "datasource": "ruby-version",
                 "registryUrls": null,
                 "updates": [],
                 "packageName": "ruby",
                 "versioning": "ruby",
                 "warnings": [],
                 "sourceUrl": "https://github.com/ruby/ruby",
                 "registryUrl": "https://www.ruby-lang.org/",
                 "homepage": "https://www.ruby-lang.org",
                 "currentVersion": "3.3.0",
                 "fixedVersion": "3.3.0"
               },
               {
                 "depName": "rails",
                 "managerData": {"lineNumber": 4},
                 "currentValue": "'~> 7.1'",
                 "datasource": "rubygems",
                 "lockedVersion": "7.1.3",
                 "updates": [],
                 "packageName": "rails",
                 "versioning": "ruby",
                 "warnings": [],
                 "sourceUrl": "https://github.com/rails/rails",
                 "registryUrl": "https://rubygems.org",
                 "homepage": "https://rubyonrails.org",
                 "changelogUrl": "https://github.com/rails/rails/releases/tag/v7.1.3",
                 "currentVersion": "7.1.3",
                 "fixedVersion": "7.1.3"
               },
               {
                 "depName": "private_dummy",
                 "managerData": {"lineNumber": 8},
                 "currentValue": "'~> 0.0.1'",
                 "datasource": "rubygems",
                 "depTypes": ["test"],
                 "registryUrls": [
                   "https://PRIVATE"
                 ],
                 "lockedVersion": "0.0.1",
                 "updates": [
                   {
                     "bucket": "non-major",
                     "newVersion": "0.0.2",
                     "newValue": "'~> 0.0.1'",
                     "releaseTimestamp": "2024-02-19T15:55:40.834Z",
                     "newMajor": 0,
                     "newMinor": 0,
                     "updateType": "patch",
                     "isRange": true,
                     "isLockfileUpdate": true,
                     "branchName": "renovate/all-minor-patch"
                   }
                 ],
                 "packageName": "private_dummy",
                 "versioning": "ruby",
                 "warnings": [],
                 "sourceUrl": "https://PRIVATE/private_dummy",
                 "registryUrl": "https://PRIVATE",
                 "currentVersion": "0.0.1",
                 "isSingleVersion": true,
                 "fixedVersion": "0.0.1"
               },
               {
                 "depName": "another_private_dummy",
                 "managerData": {"lineNumber": 12},
                 "currentValue": "'~> 0.0.1'",
                 "datasource": "rubygems",
                 "lockedVersion": "0.0.1",
                 "updates": [],
                 "packageName": "another_private_dummy",
                 "versioning": "ruby",
                 "warnings": [
                   {
                     "topic": "another_private_dummy",
                     "message": "Failed to look up rubygems package another_private_dummy"
                   }
                 ]
               }
             ],
             "lockFiles": ["Gemfile.lock"],
             "packageFile": "Gemfile"
           }
         ]
       }

...

 WARN: Package lookup failures (repository=playground/renovate_bug, baseBranch=main, branch=renovate/all-minor-patch)
       "warnings": ["Failed to look up rubygems package another_private_dummy"],
       "files": ["Gemfile"]

...

DEBUG: branches info extended (repository=playground/renovate_bug)
       "branchesInformation": [
         {
           "branchName": "renovate/all-minor-patch",
           "prNo": 2,
           "prTitle": "feat(renovate): Update dependency private_dummy to v0.0.2",
           "result": "done",
           "upgrades": [
             {
               "datasource": "rubygems",
               "depName": "private_dummy",
               "displayPending": "",
               "fixedVersion": "0.0.1",
               "currentVersion": "0.0.1",
               "currentValue": "'~> 0.0.1'",
               "newValue": "'~> 0.0.1'",
               "newVersion": "0.0.2",
               "packageFile": "Gemfile",
               "updateType": "patch",
               "packageName": "private_dummy"
             }
           ]
         }
       ]

Example of a log message AFTER the fix:

DEBUG: packageFiles with updates (repository=playground/renovate_bug, baseBranch=main)
       "config": {
         "bundler": [
           {
             "registryUrls": ["https://rubygems.org"],
             "deps": [
               {
                 "depName": "ruby",
                 "currentValue": "3.3.0",
                 "datasource": "ruby-version",
                 "registryUrls": null,
                 "updates": [],
                 "packageName": "ruby",
                 "versioning": "ruby",
                 "warnings": [],
                 "sourceUrl": "https://github.com/ruby/ruby",
                 "registryUrl": "https://www.ruby-lang.org/",
                 "homepage": "https://www.ruby-lang.org",
                 "currentVersion": "3.3.0",
                 "fixedVersion": "3.3.0"
               },
               {
                 "depName": "rails",
                 "managerData": {"lineNumber": 4},
                 "currentValue": "'~> 7.1'",
                 "datasource": "rubygems",
                 "lockedVersion": "7.1.3",
                 "updates": [],
                 "packageName": "rails",
                 "versioning": "ruby",
                 "warnings": [],
                 "sourceUrl": "https://github.com/rails/rails",
                 "registryUrl": "https://rubygems.org",
                 "homepage": "https://rubyonrails.org",
                 "changelogUrl": "https://github.com/rails/rails/releases/tag/v7.1.3",
                 "currentVersion": "7.1.3",
                 "fixedVersion": "7.1.3"
               },
               {
                 "depName": "private_dummy",
                 "managerData": {"lineNumber": 8},
                 "currentValue": "'~> 0.0.1'",
                 "datasource": "rubygems",
                 "depTypes": ["test"],
                 "registryUrls": [
                   "https://PRIVATE"
                 ],
                 "lockedVersion": "0.0.1",
                 "updates": [
                   {
                     "bucket": "non-major",
                     "newVersion": "0.0.2",
                     "newValue": "'~> 0.0.1'",
                     "releaseTimestamp": "2024-02-19T15:55:40.834Z",
                     "newMajor": 0,
                     "newMinor": 0,
                     "updateType": "patch",
                     "isRange": true,
                     "isLockfileUpdate": true,
                     "branchName": "renovate/all-minor-patch"
                   }
                 ],
                 "packageName": "private_dummy",
                 "versioning": "ruby",
                 "warnings": [],
                 "sourceUrl": "https://PRIVATE/private_dummy",
                 "registryUrl": "https://PRIVATE",
                 "currentVersion": "0.0.1",
                 "isSingleVersion": true,
                 "fixedVersion": "0.0.1"
               },
               {
                 "depName": "another_private_dummy",
                 "managerData": {"lineNumber": 12},
                 "currentValue": "'~> 0.0.1'",
                 "datasource": "rubygems",
                 "depTypes": ["production"],
                 "registryUrls": [
                   "https://PRIVATE"
                 ],
                 "lockedVersion": "0.0.1",
                 "updates": [
                   {
                     "bucket": "non-major",
                     "newVersion": "0.0.2",
                     "newValue": "'~> 0.0.1'",
                     "releaseTimestamp": "2024-02-19T15:55:50.302Z",
                     "newMajor": 0,
                     "newMinor": 0,
                     "updateType": "patch",
                     "isRange": true,
                     "isLockfileUpdate": true,
                     "branchName": "renovate/all-minor-patch"
                   }
                 ],
                 "packageName": "another_private_dummy",
                 "versioning": "ruby",
                 "warnings": [],
                 "sourceUrl": "https://PRIVATE/another_private_dummy",
                 "registryUrl": "https://PRIVATE",
                 "currentVersion": "0.0.1",
                 "isSingleVersion": true,
                 "fixedVersion": "0.0.1"
               }
             ],
             "lockFiles": ["Gemfile.lock"],
             "packageFile": "Gemfile"
           }
         ]
       }

...

DEBUG: branches info extended (repository=playground/renovate_bug)
       "branchesInformation": [
         {
           "branchName": "renovate/all-minor-patch",
           "prNo": 2,
           "prTitle": "feat(renovate): Update all non-major dependencies to v0.0.2",
           "result": "done",
           "upgrades": [
             {
               "datasource": "rubygems",
               "depName": "another_private_dummy",
               "displayPending": "",
               "fixedVersion": "0.0.1",
               "currentVersion": "0.0.1",
               "currentValue": "'~> 0.0.1'",
               "newValue": "'~> 0.0.1'",
               "newVersion": "0.0.2",
               "packageFile": "Gemfile",
               "updateType": "patch",
               "packageName": "another_private_dummy"
             },
             {
               "datasource": "rubygems",
               "depName": "private_dummy",
               "displayPending": "",
               "fixedVersion": "0.0.1",
               "currentVersion": "0.0.1",
               "currentValue": "'~> 0.0.1'",
               "newValue": "'~> 0.0.1'",
               "newVersion": "0.0.2",
               "packageFile": "Gemfile",
               "updateType": "patch",
               "packageName": "private_dummy"
             }
           ]
         }
       ]

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@viceice viceice changed the title fix(manager/bundler): Source with groups feat(manager/bundler): support groups within source blocks Feb 22, 2024
lib/modules/manager/bundler/extract.spec.ts Show resolved Hide resolved
lib/modules/manager/bundler/extract.spec.ts Outdated Show resolved Hide resolved
lib/modules/manager/bundler/extract.ts Outdated Show resolved Hide resolved
@rarkins rarkins requested a review from viceice March 18, 2024 21:40
@rarkins rarkins added this pull request to the merge queue Mar 24, 2024
Merged via the queue into renovatebot:main with commit 58bf6e3 Mar 24, 2024
37 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.268.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants