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

Always set ignored_safeties when emergency mode is enabled #1036

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 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,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)
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