Skip to content

Commit dd4a22e

Browse files
committed
Always set ignored_safeties when emergency mode is enabled
1 parent 5f0ef13 commit dd4a22e

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

app/controllers/shipit/deploys_controller.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class DeploysController < ShipitController
1010
def new
1111
@commit = @stack.commits.by_sha!(params[:sha])
1212
@commit.checks.schedule if @stack.checks?
13-
@deploy = @stack.build_deploy(@commit, current_user)
13+
@deploy = @stack.build_deploy(@commit, current_user, force: params[:force].present?)
1414
end
1515

1616
def show
@@ -25,7 +25,7 @@ def create
2525
@until_commit,
2626
current_user,
2727
env: deploy_params[:env],
28-
force: params[:force].present?,
28+
force: params[:force].present? || deploy_params[:ignored_safeties].present?,
2929
)
3030
respond_with(@deploy.stack, @deploy)
3131
rescue Task::ConcurrentTaskRunning
@@ -62,7 +62,11 @@ def load_until_commit
6262
end
6363

6464
def deploy_params
65-
@deploy_params ||= params.require(:deploy).permit(:until_commit_id, env: @stack.deploy_variables.map(&:name))
65+
@deploy_params ||= params.require(:deploy).permit(
66+
:until_commit_id,
67+
:ignored_safeties,
68+
env: @stack.deploy_variables.map(&:name),
69+
)
6670
end
6771

6872
def previous_successful_deploy_commit(task)

app/helpers/shipit/stacks_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Shipit
22
module StacksHelper
33
def redeploy_button(deployed_commit)
44
commit = UndeployedCommit.new(deployed_commit, index: 0)
5-
url = new_stack_deploy_path(commit.stack, sha: commit.sha)
5+
url = new_stack_deploy_path(commit.stack, sha: commit.sha, force: bypass_safeties?)
66
classes = %W(btn btn--primary deploy-action #{commit.state})
77

88
unless commit.stack.deployable?
@@ -17,7 +17,7 @@ def bypass_safeties?
1717
end
1818

1919
def deploy_button(commit)
20-
url = new_stack_deploy_path(commit.stack, sha: commit.sha)
20+
url = new_stack_deploy_path(commit.stack, sha: commit.sha, force: bypass_safeties?)
2121
classes = %W(btn btn--primary deploy-action #{commit.state})
2222
deploy_state = commit.deploy_state(bypass_safeties?)
2323
data = {}

app/views/shipit/deploys/new.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<section class="submit-section">
2424
<%= f.hidden_field :until_commit_id %>
25+
<%= f.hidden_field :ignored_safeties %>
2526
<%= f.submit class: 'btn btn--primary btn--large trigger-deploy' %>
2627
</section>
2728
<% end %>

0 commit comments

Comments
 (0)