Closed jamescowie closed 4 years ago
@jamescowie Interesting. I've never tried to use that flag before. It does appear with minimal research that there is means in SSHKit to detect when dry-run is set. The most interesting thing though is, with the purpose of --dry-run
being to print out all the commands run during execution, I'm coming up empty on how to make this work correctly without simply dropping support for older versions of M2. I'm open to suggestions. The magento_version
method exists because it's used to determine which code path is different, as determined by the Magento version. An example would be SCD where it's output has to be parsed vs just running the command, or where SCD supports deploy strategies on 2.2.x but not 2.1.x.
I'll have to have a look at this, but I suspect it might work to just drop 2.1 support given it is pending EOL and issue a new minor version bump as most of (if not all) the version differences are between 2.1 and 2.2 IIRC. Nothing in this gem should be changing for 2.1 at this point, so essentially it would mean those still deploying 2.1.x sites should remain on version 0.8.x of this gem. If I could drop 2.1 support and the check only exists for determining minimal supported version, then it would work to simply ignore the version check on a dry run.
The --dry-run
flag should now work as of version 0.9.0 of this gem.
When running capistrano one of the default options is to
-dry-run
which is especially handy when creating more complex deployments. However when running dry-run with the capistrano-magento2 gem it fails with:Initial investigation is that because the dry-run only looks at the commands being ran and never actually executes them then we are not able to obtain the accurate version of Magento and as such the version_check function fails.
Im not sure on what the "best practice" policy is on validating conditions in functions. I will research more on what is normal for other gems and report back :)