Nick Charney Kaye
Nick Charney Kaye

Reputation: 4381

How to configure Capistrano to abort deployment when running a local script fails?

Given a simple web application deployed via Capistrano. There's a build process in a script build.sh called from deploy/deploy.rb:

namespace :deploy do
  task :build do
    system "cd web && ./build.sh"
  end
  before :starting, :build
  ...
end

How would I configure Capistrano to abort my cap prd deploy immediately upon receiving an exit code 1 from the system command inside of the block?

Upvotes: 1

Views: 470

Answers (1)

Nick Charney Kaye
Nick Charney Kaye

Reputation: 4381

system is the wrong choice of command.

Inside of the task :build block, use the sh method instead of system.

sh "cd web && ./build.sh"

Upvotes: 1

Related Questions