Skip to content

Commit 0e448b3

Browse files
committed
Add config to enable/disable backmerge to upcoming release
1 parent 0e2255d commit 0e448b3

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

app/libs/coordinators/finalize_release/almost_trunk.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def call
1414
else
1515
create_tag.then do
1616
create_and_merge_pr(working_branch).then do
17-
create_and_merge_pr(train.upcoming_release.branch_name) if train.upcoming_release
17+
if train.backmerge_to_upcoming_release? && train.upcoming_release
18+
create_and_merge_pr(train.upcoming_release.branch_name)
19+
end
1820
end
1921
end
2022
end

app/libs/triggers/patch_pull_request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def initialize(release, commit)
2222
def call
2323
@pull_request.create_and_merge!
2424

25-
if train.upcoming_release && !bot_commit?
25+
if train.upcoming_release && train.backmerge_to_upcoming_release? && !bot_commit?
2626
upcoming_release_pr = Triggers::PullRequest.new(
2727
release: release,
2828
new_pull_request: (commit.pull_requests.build(release:, phase: :ongoing) if commit.pull_requests.find_by(base_ref: train.upcoming_release.branch_name).blank?),

app/views/trains/_form.html.erb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@
222222
html_options: { disabled: train.backmerge_disabled? }) %>
223223
<% end %>
224224

225+
<%= f.with_advanced_section(heading: "Backmerge to Upcoming Release") do |section| %>
226+
<% section.with_description do %>
227+
When enabled, changes from the current release will be automatically merged into the upcoming release branch.
228+
By default, changes are only merged into the working branch.
229+
<% end %>
230+
231+
<%= render Form::SwitchComponent.new(form: section.F,
232+
field_name: :backmerge_to_upcoming_release,
233+
on_label: "Backmerge to upcoming release enabled",
234+
off_label: "Backmerge to upcoming release disabled") %>
235+
<% end %>
236+
225237
<%= f.with_advanced_section(heading: "Auto-apply patch changes") do |section| %>
226238
<% section.with_description do %>
227239
Disable this if you want to manually apply the commits after the initial rollout has started.
@@ -291,6 +303,7 @@
291303
switch_data: { dependent_disable_target: "secondary", action: "dependent-disable#change" }) %>
292304
<% end %>
293305

306+
294307
<% f.with_action do %>
295308
<%= f.F.authz_submit (train.persisted? ? "Update" : "Create"), (train.persisted? ? "archive.svg" : "plus.svg"), disabled: @edit_not_allowed %>
296309
<% end %>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddBackmergeToUpcomingReleaseToTrain < ActiveRecord::Migration[7.2]
2+
def change
3+
add_column :trains, :backmerge_to_upcoming_release, :boolean, default: false
4+
end
5+
end

0 commit comments

Comments
 (0)