Search code examples
ubunturubygemscapistranobitbucket-pipelinesrubber

Bitbucket pipeline: bash: cap: command not found


I am using rubber to deploy my Symfony project to Digital Ocean. The project is hosted on bitbucket.

This is my Capfile.

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/symfony'
require 'capistrano/scm/git'
install_plugin Capistrano::SCM::Git
Dir.glob('deploy/tasks/*.rake').each { |r| import r }

The pipeline was working well, but suddenly stopped working raising this error.

cap staging deploy
+ cap staging deploy
bash: cap: command not found

I tried reverting the commits, but it didn't help. Tried removing capistrano from the server, but it also didn't work.

The previous steps of capistrano - gem install bundler, and bundle install works without error.

I am new to rubber and bitbucket pipeline, so maybe I missed something here?

Just got to know that the bitbucket pipeline is being executed on a docker image. Then is this the problem with the bitbucket?


Solution

  • Okay. I managed to solve this problem by changing cap staging deploy to bundle exec cap staging deploy. Not sure why this could solve the problem, but anyway it works now.