Skip to content

Commit

Permalink
remove implicit group behavior from the Updater (#9506)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakecoffman committed Apr 16, 2024
1 parent 0d69708 commit 94df76f
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 404 deletions.
84 changes: 0 additions & 84 deletions silent/tests/testdata/su-group-default-multidir.txt

This file was deleted.

57 changes: 0 additions & 57 deletions silent/tests/testdata/su-group-default-onedir.txt

This file was deleted.

85 changes: 0 additions & 85 deletions silent/tests/testdata/su-group-default-rebase-multidir.txt

This file was deleted.

61 changes: 0 additions & 61 deletions silent/tests/testdata/su-group-default.txt

This file was deleted.

61 changes: 0 additions & 61 deletions silent/tests/testdata/su-group-rebase-default.txt

This file was deleted.

26 changes: 1 addition & 25 deletions updater/lib/dependabot/dependency_group_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,7 @@ class DependencyGroupEngine
class ConfigurationError < StandardError; end

sig { params(job: Dependabot::Job).returns(Dependabot::DependencyGroupEngine) }
def self.from_job_config(job:) # rubocop:disable Metrics/PerceivedComplexity
if job.security_updates_only? && T.must(job.dependencies).count > 1 && job.dependency_groups.none? do |group|
group["applies-to"] == "security-updates"
end
# The indication that this should be a grouped update is:
# - We're using the DependencyGroupEngine which means this is a grouped update
# - This is a security update and there are multiple dependencies passed in
# Since there are no groups, the default behavior is to group all dependencies, so create a fake group.
#
# The service doesn't have record of this group, but makes similar assumptions.
# If we change this, we need to update the service to match.
#
# See: https://github.com/dependabot/dependabot-core/issues/9426
job.dependency_groups << {
"name" => job.package_manager,
"rules" => { "patterns" => ["*"] },
"applies-to" => "security-updates"
}

# This ensures refreshes work for these dynamic groups.
if job.updating_a_pull_request?
job.override_group_to_refresh_due_to_old_defaults(job.dependency_groups.first["name"])
end
end

def self.from_job_config(job:)
groups = job.dependency_groups.map do |group|
Dependabot::DependencyGroup.new(name: group["name"], rules: group["rules"], applies_to: group["applies-to"])
end
Expand Down
6 changes: 0 additions & 6 deletions updater/lib/dependabot/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,6 @@ def log_ignore_conditions_for(dependency)
end
end

# Remove this once the API always sends groups for grouped refresh jobs
sig { params(group: String).void }
def override_group_to_refresh_due_to_old_defaults(group)
@dependency_group_to_refresh = group
end

private

sig { returns(Dependabot::Config::UpdateConfig) }
Expand Down
Loading

0 comments on commit 94df76f

Please sign in to comment.