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

Remove grouped updates feature flags #8123

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions updater/lib/dependabot/dependency_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,13 @@ def job_dependencies
# Returns just the group that is specifically requested to be updated by
# the job definition
def job_group
return nil unless Dependabot::Experiments.enabled?(:grouped_updates_prototype)
return nil unless job.dependency_group_to_refresh
return @job_group if defined?(@job_group)

@job_group = @dependency_group_engine.find_group(name: job.dependency_group_to_refresh)
end

def groups
return [] unless Dependabot::Experiments.enabled?(:grouped_updates_prototype)

@dependency_group_engine.dependency_groups
end

Expand All @@ -92,8 +89,6 @@ def initialize(job:, base_commit_sha:, dependency_files:)

@dependencies = parse_files!

return unless Dependabot::Experiments.enabled?(:grouped_updates_prototype)

@dependency_group_engine = DependencyGroupEngine.from_job_config(job: job)
@dependency_group_engine.assign_to_groups!(dependencies: allowed_dependencies)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.applies_to?(job:)
return false if job.updating_a_pull_request?
return false if job.dependencies&.any?

job.dependency_groups&.any? && Dependabot::Experiments.enabled?(:grouped_updates_prototype)
job.dependency_groups&.any?
end

def self.tag_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.applies_to?(job:)
return false unless job.dependencies&.any?
return false unless job.dependency_group_to_refresh

job.updating_a_pull_request? && Dependabot::Experiments.enabled?(:grouped_updates_prototype)
job.updating_a_pull_request?
end

def self.tag_name
Expand Down
8 changes: 0 additions & 8 deletions updater/spec/dependabot/dependency_snapshot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@
end

it "correctly instantiates any configured dependency groups" do
Dependabot::Experiments.register("grouped_updates_prototype", true)

snapshot = create_dependency_snapshot

expect(snapshot.groups.length).to eql(1)
Expand All @@ -125,12 +123,6 @@

Dependabot::Experiments.reset!
end

it "ignores any configured dependency groups when the experiment is disabled" do
snapshot = create_dependency_snapshot

expect(snapshot.groups.length).to eql(0)
end
end

context "when there is a parser error" do
Expand Down
58 changes: 26 additions & 32 deletions updater/spec/dependabot/updater/operations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,32 @@
expect(described_class.class_for(job: job)).to be(Dependabot::Updater::Operations::UpdateAllVersions)
end

context "the grouped update experiment is enabled" do
it "returns the GroupUpdateAllVersions class when the Job is for a fresh, version update with no dependencies" do
Dependabot::Experiments.register("grouped_updates_prototype", true)

job = instance_double(Dependabot::Job,
security_updates_only?: false,
updating_a_pull_request?: false,
dependencies: [],
dependency_groups: [anything],
is_a?: true)

expect(described_class.class_for(job: job)).to be(Dependabot::Updater::Operations::GroupUpdateAllVersions)

Dependabot::Experiments.reset!
end

it "returns the RefreshGroupUpdatePullRequest class when the Job is for an existing group update" do
Dependabot::Experiments.register("grouped_updates_prototype", true)

job = instance_double(Dependabot::Job,
security_updates_only?: false,
updating_a_pull_request?: true,
dependencies: [anything],
dependency_group_to_refresh: anything,
dependency_groups: [anything],
is_a?: true)

expect(described_class.class_for(job: job))
.to be(Dependabot::Updater::Operations::RefreshGroupUpdatePullRequest)

Dependabot::Experiments.reset!
end
it "returns the GroupUpdateAllVersions class when the Job is for a fresh, version update with no dependencies" do
job = instance_double(Dependabot::Job,
security_updates_only?: false,
updating_a_pull_request?: false,
dependencies: [],
dependency_groups: [anything],
is_a?: true)

expect(described_class.class_for(job: job)).to be(Dependabot::Updater::Operations::GroupUpdateAllVersions)

Dependabot::Experiments.reset!
end

it "returns the RefreshGroupUpdatePullRequest class when the Job is for an existing group update" do
job = instance_double(Dependabot::Job,
security_updates_only?: false,
updating_a_pull_request?: true,
dependencies: [anything],
dependency_group_to_refresh: anything,
dependency_groups: [anything],
is_a?: true)

expect(described_class.class_for(job: job))
.to be(Dependabot::Updater::Operations::RefreshGroupUpdatePullRequest)

Dependabot::Experiments.reset!
end

it "returns the RefreshVersionUpdatePullRequest class when the Job is for an existing dependency version update" do
Expand Down