Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
feat: Added GIT_SSH support for bundle install
Browse files Browse the repository at this point in the history
When installing an app, there might be failures during the deploy when trying to bundle. This
happens, when private repositories are included in a Gemfile. To resolve this issue, if SCM::Git
driver is used, the GIT_SSH env variable is also passed to bundle install phase.

Resolves #37
  • Loading branch information
Igor Rzegocki committed Sep 1, 2016
1 parent f13e4d1 commit 232e8ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion libraries/helpers.rb
Expand Up @@ -58,11 +58,12 @@ def every_enabled_rds
end
end

def perform_bundle_install(shared_path)
def perform_bundle_install(shared_path, envs = {})
bundle_path = "#{shared_path}/vendor/bundle"

execute 'bundle_install' do
command "/usr/local/bin/bundle install --deployment --without development test --path #{bundle_path}"
environment envs
cwd release_path
end
end
Expand Down
5 changes: 3 additions & 2 deletions recipes/deploy.rb
Expand Up @@ -17,6 +17,7 @@
appserver = Drivers::Appserver::Factory.build(application, node)
worker = Drivers::Worker::Factory.build(application, node)
webserver = Drivers::Webserver::Factory.build(application, node)
bundle_env = scm.class.adapter.to_s == 'Chef::Provider::Git' ? { 'GIT_SSH' => scm.out[:ssh_wrapper] } : {}

fire_hook(:before_deploy, context: self, items: databases + [scm, framework, appserver, worker, webserver])

Expand Down Expand Up @@ -52,7 +53,7 @@
migration_command(framework.out[:migration_command])
migrate framework.out[:migrate]
before_migrate do
perform_bundle_install(shared_path)
perform_bundle_install(shared_path, bundle_env)

fire_hook(:deploy_before_migrate, context: self,
items: databases + [scm, framework, appserver, worker, webserver])
Expand All @@ -61,7 +62,7 @@
end

before_symlink do
perform_bundle_install(shared_path) unless framework.out[:migrate]
perform_bundle_install(shared_path, bundle_env) unless framework.out[:migrate]

fire_hook(:deploy_before_symlink, context: self,
items: databases + [scm, framework, appserver, worker, webserver])
Expand Down

0 comments on commit 232e8ac

Please sign in to comment.