diff --git a/app/controllers/shipit/deploys_controller.rb b/app/controllers/shipit/deploys_controller.rb index e92d8c5be..7c4049cbd 100644 --- a/app/controllers/shipit/deploys_controller.rb +++ b/app/controllers/shipit/deploys_controller.rb @@ -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 @@ -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 @@ -62,7 +62,11 @@ 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) diff --git a/app/helpers/shipit/stacks_helper.rb b/app/helpers/shipit/stacks_helper.rb index 2d96adf76..b82d10cf3 100644 --- a/app/helpers/shipit/stacks_helper.rb +++ b/app/helpers/shipit/stacks_helper.rb @@ -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? @@ -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 = {} diff --git a/app/views/shipit/deploys/new.html.erb b/app/views/shipit/deploys/new.html.erb index 6de49c71b..a04d09580 100644 --- a/app/views/shipit/deploys/new.html.erb +++ b/app/views/shipit/deploys/new.html.erb @@ -22,6 +22,7 @@
<%= f.hidden_field :until_commit_id %> + <%= f.hidden_field :ignored_safeties %> <%= f.submit class: 'btn btn--primary btn--large trigger-deploy' %>
<% end %>