mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.35k stars 490 forks source link

Different behavior of environment task with 0.3.8 and 1.0.6 #505

Closed gbgdev closed 6 years ago

gbgdev commented 7 years ago

Hi guys,

I'm using mina 0.3.8, mina-sidekiq and mina-unicorn in one of my projects.

Recently i'm trying to update mina version from 0.3.8 to 1.0.6. But after follow each step of the migration guide (https://github.com/mina-deploy/mina/blob/master/docs/migrating.md) and get the deploy task "working", i observed a different behavior with the :environment task.

On version 0.3.8, the :environment task is getting executed once, even when there are many other tasks referencing to it. On 1.0.6, its strangely getting executed twice.

The differences can be clearly observed comparing the trace log of the two versions:

0.3.8 deploy --trace

** Invoke rvm:use (first_time)
** Execute rvm:use
** Execute deploy
** Invoke sidekiq:quiet (first_time)
** Invoke environment
** Execute sidekiq:quiet
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke configuration:link_specific_shared_path (first_time)
** Execute configuration:link_specific_shared_path
** Invoke bundle:install (first_time)
** Execute bundle:install
** Invoke configuration:sync (first_time)
** Execute configuration:sync
** Invoke rails:db_migrate (first_time)
** Execute rails:db_migrate
** Invoke rails:assets_precompile (first_time)
** Execute rails:assets_precompile
** Invoke unicorn:launch (first_time)
** Invoke environment
** Execute unicorn:launch
** Invoke sidekiq:restart (first_time)
** Execute sidekiq:restart
** Invoke sidekiq:stop (first_time)
** Invoke environment
** Execute sidekiq:stop
** Invoke sidekiq:start (first_time)
** Invoke environment
** Execute sidekiq:start
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup

1.0.6 deploy --trace

** Invoke deploy (first_time)
** Execute deploy
** Invoke environment (first_time)
** Execute environment
** Invoke rvm:use (first_time)
** Execute rvm:use
** Invoke git:clone (first_time)
** Execute git:clone
** Invoke deploy:link_shared_paths (first_time)
** Execute deploy:link_shared_paths
** Invoke configuration:link_specific_shared_path (first_time)
** Execute configuration:link_specific_shared_path
** Invoke bundle:install (first_time)
** Execute bundle:install
** Invoke configuration:sync (first_time)
** Execute configuration:sync
** Invoke sidekiq:quiet (first_time)
** Execute sidekiq:quiet
** Invoke rails:db_migrate (first_time)
** Execute rails:db_migrate
** Invoke rails:assets_precompile (first_time)
** Execute rails:assets_precompile
** Invoke sidekiq:restart (first_time)
** Execute sidekiq:restart
** Invoke sidekiq:stop (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke rvm:use (first_time)
** Execute rvm:use
** Execute sidekiq:stop
** Invoke sidekiq:start (first_time)
** Invoke environment
** Execute sidekiq:start
** Invoke unicorn:launch (first_time)
** Invoke environment
** Execute unicorn:launch
** Invoke deploy:cleanup (first_time)
** Execute deploy:cleanup

Note on the last log that the environment is getting executed two times (one time on "default step" and one time on "launch step"), as if it were invoked the first time.

image

Doing several tests I realized that any task that is explicit referred to the environment (example: https://cl.ly/381D0P0m3s18) makes the environment task get invoked and executed again.

I dont know if its a real problem, but the rvm:use and the other environment steps are apparently getting executed two times unnecessarily.

Do you guys also experience this behavior with the new version? Is it expected?

d4be4st commented 7 years ago

Will take a look! Thanks

bdavidxyz commented 6 years ago

Yes, I have also tasks that are randomly ran multiple times.

d4be4st commented 6 years ago

I think i know what the problem is

Are your tasks depending on :environment task?

task deploy: :environment do
...

?