diff --git a/updater/lib/dependabot/updater/operations/group_update_all_versions.rb b/updater/lib/dependabot/updater/operations/group_update_all_versions.rb index e07264059d..87e86d738f 100644 --- a/updater/lib/dependabot/updater/operations/group_update_all_versions.rb +++ b/updater/lib/dependabot/updater/operations/group_update_all_versions.rb @@ -71,6 +71,8 @@ def perform def run_grouped_dependency_updates Dependabot.logger.info("Starting grouped update job for #{job.source.repo}") + Dependabot.logger.info("Found #{dependency_snapshot.groups.count} group(s).") + dependency_snapshot.groups.each do |_group_hash, group| Dependabot.logger.info("Starting update group for '#{group.name}'") diff --git a/updater/spec/dependabot/updater/operations/group_update_all_versions_spec.rb b/updater/spec/dependabot/updater/operations/group_update_all_versions_spec.rb index c336ea85c3..79c67f6490 100644 --- a/updater/spec/dependabot/updater/operations/group_update_all_versions_spec.rb +++ b/updater/spec/dependabot/updater/operations/group_update_all_versions_spec.rb @@ -128,6 +128,40 @@ end end + context "when there are two overlapping groups" do + let(:job_definition) do + job_definition_fixture("bundler/version_updates/group_update_all_overlapping_groups") + end + + let(:dependency_files) do + original_bundler_files + end + + before do + stub_rubygems_calls + end + + it "creates a pull request for each containing the same dependencies" do + allow(Dependabot.logger).to receive(:info) + expect(Dependabot.logger).to receive(:info).with( + "Found 2 group(s)." + ) + + expect(mock_error_handler).not_to receive(:handle_dependabot_error) + expect(mock_service).to receive(:create_pull_request) do |dependency_change| + expect(dependency_change.dependency_group.name).to eql("my-group") + expect(dependency_change.updated_dependency_files_hash).to eql(updated_bundler_files_hash) + end + + expect(mock_service).to receive(:create_pull_request) do |dependency_change| + expect(dependency_change.dependency_group.name).to eql("my-overlapping-group") + expect(dependency_change.updated_dependency_files_hash).to eql(updated_bundler_files_hash) + end + + group_update_all.perform + end + end + context "when nothing in the group needs to be updated" do let(:job_definition) do job_definition_fixture("bundler/version_updates/group_update_all") diff --git a/updater/spec/fixtures/job_definitions/bundler/version_updates/group_update_all_overlapping_groups.yaml b/updater/spec/fixtures/job_definitions/bundler/version_updates/group_update_all_overlapping_groups.yaml new file mode 100644 index 0000000000..1977d2cd94 --- /dev/null +++ b/updater/spec/fixtures/job_definitions/bundler/version_updates/group_update_all_overlapping_groups.yaml @@ -0,0 +1,42 @@ +job: + package-manager: bundler + source: + provider: github + repo: dependabot/smoke-tests + directory: "/bundler" + branch: + api-endpoint: https://api.github.com/ + hostname: github.com + dependencies: + existing-pull-requests: [] + updating-a-pull-request: false + lockfile-only: false + update-subdependencies: false + ignore-conditions: [] + requirements-update-strategy: + allowed-updates: + - dependency-type: direct + update-type: all + credentials-metadata: + - type: git_source + host: github.com + security-advisories: [] + max-updater-run-time: 2700 + vendor-dependencies: false + experiments: + grouped-updates-prototype: true + reject-external-code: false + commit-message-options: + prefix: + prefix-development: + include-scope: + security-updates-only: false + dependency-groups: + - name: my-group + rules: + patterns: + - "dummy-pkg-*" + - name: my-overlapping-group + rules: + patterns: + - "dummy-pkg-*"