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

Add confirmation check to deploy #225

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,32 @@
execute "cd #{fetch(:release_path)}/ && chmod a+x scripts/* && source scripts/check_ruby.sh"
end
end

namespace :deploy do
task :confirmation do
stage = fetch(:stage).upcase
branch = fetch(:branch)
puts <<-WARN

========================================================================

*** Deploying branch `#{branch}` to #{stage} server ***

WARNING: You're about to perform actions on #{stage} server(s)
Please confirm that all your intentions are kind and friendly

========================================================================

WARN
ask :value, "Sure you want to continue deploying `#{branch}` on #{stage}? (Y or Yes)"

unless fetch(:value).match?(/\A(?i:yes|y)\z/)
puts "\nNo confirmation - deploy cancelled!"
exit
end
end
end

Capistrano::DSL.stages.each do |stage|
after stage, 'deploy:confirmation'
end
5 changes: 5 additions & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
ask(:username, nil)
ask(:password, nil, echo: false)
server 'libapps.libraries.uc.edu', user: fetch(:username), password: fetch(:password), port: 22, roles: %i[web app db]
ask(:value, 'Have you submitted and received an approved Change Management Request? (Y or Yes)')
unless fetch(:value).match?(/\A(?i:yes|y)\z/)
puts "\nNo confirmation - deploy cancelled!"
exit
end
set :deploy_to, '/opt/webapps/aaec'
after 'deploy:updating', 'ruby_update_check'
after 'deploy:updating', 'init_qp'
Expand Down