Giter VIP home page Giter VIP logo

Comments (4)

davidalger avatar davidalger commented on May 31, 2024

Very good findings, thanks for sharing! Your notes about it being related to the :db role not being defined definitely got me on the right track.

The capistrano-pending gem looks to :capistrano_pending_role for the role to lookup the current revision on. If that var is unset, it defaults to :db. So technically not a bug in this gem, certainly not playing nice in all cases, as it would require configuring that gem as well.

I've made changes in the above commit to remedy the issue. In short, I'm setting that role to match the :magento_deploy_setup_role by default, but still allowing it to be overridden.

Now all of this said… I've been refactoring this code some more, as I was unraveling more issues with how the underlying functionality works (this is why back when you initially PR'd it I didn't want it enabled by default…I feared it would work inconsistently). For example:

  • If REVISION on the server is ahead of the commit being deployed, nothing is reported as being deployed, and the current implementation actually tells the user that the from and to are the same when they are in-fact, definitively NOT the same.

  • Oddities in how the revisions are reported, as the current revision is using the lengthy hash, but the deployed ref is using the symbolic name

  • Potential to incorrectly report pending changes on a multiple node deployment

In my refactoring, I'm discovering there really is very little in the 3rd-party gem which is not being done natively, so very well may remove it as a dependency by the time I'm finished ;)

from capistrano-magento2.

erikhansen avatar erikhansen commented on May 31, 2024

Thanks for spending the time to make fix those issues.

from capistrano-magento2.

davidalger avatar davidalger commented on May 31, 2024

Deploying to multiple hosts which no current deployment:
cap -bash bash 182x80 2017-02-24 14-56-49

Deploying even changes to multiple hosts:
cap -bash bash 182x80 2017-02-24 14-55-48

Deploying a revision behind what's currently deployed:
cap -bash bash 182x80 2017-02-24 14-57-16

Deploying a revision behind what's currently deployed (on single host to create disparity for future test run):
cap -bash bash 182x80 2017-02-24 14-57-47

Deploying to multiple hosts which with divergent revisions:
cap -bash bash 182x80 2017-02-24 14-58-29

No change deployment with the warning; stopped via 'n' input:
cap -bash bash 182x80 2017-02-24 14-59-56

Test with one host having nothing to deploy (warning should not show, with deployment continuing automatically):
cap -bash bash 182x80 2017-02-24 15-01-26

No change deployment with warning; proceeding via 'y' input:
cap -bash bash 182x80 2017-02-24 15-02-19

Just a simple deploy:pending to check on system works (with no warning since it's not a deploy):
cap -bash bash 182x80 2017-02-24 15-03-15

Adding the following to project configuration will disable warning that will show on deployments with no pending changes:

set :magento_deploy_pending_warn, false

There are a couple other default values such as the log format and default role to use set in the defaults.rb as well.

One fringe case which I have not accounted for (and I'm not sure this is a way to account for it very readily): If one is deploying to a different branch than currently deployed, the change log won't show what changes on the current branch are being removed from the server, which could affect deployments where users dynamically change the feature branch being deployed to the same target. An example is the following where the latest commit on the 2.1 branch is currently deployed and cap is asked to deploy from a tag on the 2.0 branch. In that case, the commits from the 2.0 branch will be printed, but the fact that whats currently on the server from the 2.1 branch is ignored:
cap -bash bash 182x80 2017-02-24 15-09-51

This should all be rolled out in the next release.

from capistrano-magento2.

erikhansen avatar erikhansen commented on May 31, 2024

Wow, this looks fantastic! Good work on accounting for all of those scenarios.

In regards to the fringe case you mentioned: if the 2nd point in this issue were to be implemented, it seems like it would solve for that use case, as it would warn the user that the deployed branch was being changed and they could do their due diligence to determine the impact of switching branches. I agree with your latest comment on that issue that creating the functionality as a separate Gem might make more sense. My team is managing an M1 project right now and they're frequently deploying different branches and it would be great to be able to pull that functionality into that project.

from capistrano-magento2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.