Skip to content

Commit

Permalink
Always set ignored_safeties when emergency mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
actgardner committed Mar 10, 2020
1 parent 5f0ef13 commit 0b7668b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/shipit/deploys_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DeploysController < ShipitController
def new
@commit = @stack.commits.by_sha!(params[:sha])
@commit.checks.schedule if @stack.checks?
@deploy = @stack.build_deploy(@commit, current_user)
@deploy = @stack.build_deploy(@commit, current_user, force: params[:force].present?)
end

def show
Expand All @@ -25,7 +25,7 @@ def create
@until_commit,
current_user,
env: deploy_params[:env],
force: params[:force].present?,
force: params[:force].present? || deploy_params[:ignored_safeties].present?,
)
respond_with(@deploy.stack, @deploy)
rescue Task::ConcurrentTaskRunning
Expand Down Expand Up @@ -62,7 +62,7 @@ def load_until_commit
end

def deploy_params
@deploy_params ||= params.require(:deploy).permit(:until_commit_id, env: @stack.deploy_variables.map(&:name))
@deploy_params ||= params.require(:deploy).permit(:until_commit_id, :ignored_safeties, env: @stack.deploy_variables.map(&:name))
end

def previous_successful_deploy_commit(task)
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/shipit/stacks_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Shipit
module StacksHelper
def redeploy_button(deployed_commit)
commit = UndeployedCommit.new(deployed_commit, index: 0)
url = new_stack_deploy_path(commit.stack, sha: commit.sha)
url = new_stack_deploy_path(commit.stack, sha: commit.sha, force: bypass_safeties?)
classes = %W(btn btn--primary deploy-action #{commit.state})

unless commit.stack.deployable?
Expand All @@ -17,7 +17,7 @@ def bypass_safeties?
end

def deploy_button(commit)
url = new_stack_deploy_path(commit.stack, sha: commit.sha)
url = new_stack_deploy_path(commit.stack, sha: commit.sha, force: bypass_safeties?)
classes = %W(btn btn--primary deploy-action #{commit.state})
deploy_state = commit.deploy_state(bypass_safeties?)
data = {}
Expand Down
1 change: 1 addition & 0 deletions app/views/shipit/deploys/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

<section class="submit-section">
<%= f.hidden_field :until_commit_id %>
<%= f.hidden_field :ignored_safeties %>
<%= f.submit class: 'btn btn--primary btn--large trigger-deploy' %>
</section>
<% end %>
Expand Down

0 comments on commit 0b7668b

Please sign in to comment.