-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring/Cleanup/Fixes for Symfony-related Recipes #688
Conversation
7e8c171
to
15813f6
Compare
Perhaps of consequence (is this expected behavior?): prior to fixing the travis build by adding an 5.5: https://travis-ci.org/deployphp/deployer/jobs/135430007 It seems odd that it would pass on 7.0 without |
Nice work! |
* Composer options | ||
*/ | ||
env('composer_action', function () { | ||
return env('env') === 'prod' ? 'install' : 'update'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think using composer update
is good action.
It will update your vendors and composer.lock
file when deploying.
If you want update vendors, i think you should run update on your dev server, test all features and make a commit changed composer.lock
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, install!
6 июня 2016 г., в 17:10, Oanh Nguyen notifications@github.com написал(а):
In recipe/common.php #688 (comment):
@@ -18,13 +18,32 @@
set('clear_paths', []); // Relative path from deploy_path
set('clear_use_sudo', true); // Using sudo in clean commands?
+/**
- * Composer options
- */
+env('composer_action', function () {- return env('env') === 'prod' ? 'install' : 'update';
I don't think using composer update is good action.
It will update your vendors and composer.lock file.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/deployphp/deployer/pull/688/files/0e75d00bdc2acb9126aad9ad104032562aab76f7#r65866588, or mute the thread https://github.com/notifications/unsubscribe/AAInsFlgoFwW79Zt-6aKiyKXGEZcPhe9ks5qI_IngaJpZM4IuZkt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems needlessly restrictive to hard-code the "install" action. Would you be more content to reverse this logic such that update is only called if the environment is set to dev?
return env('env') === 'dev' ? 'update' : 'install';
The update command is a valid use case for deployer. For example, I am setting up a project to automatically deploy to a staging server after a successful travis build automatically. Regardless, the default is still to use install
unless someone changes their environment.
I don't think using composer update is good action. |
@oanhnn The intended use-case is for someone who uses deployer to automatically build a staging environment as part of their CI chain. The default action is still to run |
@Elfet The build works on all platforms now that I defined Prior to that, As for this pull-request, it is fixed, but you may still want to look into why it broke selectively without the |
@robfrawley
https://blog.engineyard.com/2014/composer-its-all-about-the-lock-file Other point
I think it makes users puzzled 😱 |
@@ -17,14 +17,34 @@ | |||
set('http_user', null); | |||
set('clear_paths', []); // Relative path from deploy_path | |||
set('clear_use_sudo', true); // Using sudo in clean commands? | |||
set('composer_allow_update', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oanhnn How is this for a compromise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No update, please. This is not what can be done in recipe by default.
Are you implying that the value of stage should define the env programatically somehow? That seems outside the scope of this pull-request. I'm just using |
Currently, only symfony recipe using |
@oanhnn what do you want to call it? |
What do you think about this code?
|
@oanhnn That code doesn't allow for composer options based on the environment. I changed |
@Elfet Do you have any comments about this pull request and what might need changing for it to be accepted? |
* Composer options | ||
*/ | ||
env('composer_action', function () { | ||
return get('composer_allow_update') && env('build_env') === 'dev' ? 'update' : 'install'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only install allowed.
|
Why?
@Elfet I am agree with you. Users can use |
c74510d
to
4ad8524
Compare
fix double task removed composer.lock from commit fix for styleci fix for styleci fix for https://travis-ci.org/deployphp/deployer/builds/135430111 added option to allow composer update renamed env to build_env removed composer action logic moved env to only symfony-recepes removed allow update cleanup comment
* Composer options | ||
*/ | ||
env('composer_action', 'install'); | ||
env('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Elfet Is this acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still allow users to use update. And this is ban practice. @oanhnn what you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crosses fingers... I understand your gut-reaction against running update ad-hoc, but it can be useful for automated deployments to dev server. compoaser_options
already exists, so it's easy enough to overwrite the whole string, but this just pulls out composer_action
. Give me a heads up if this is okay @oanhnn and @Elfet .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Elfet I think it is ok. Not break BC and users can customize composer_action
easily.
I think in Deployer, composer_options
will not include composer_action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oanhnn Is this what you mentioned breaking into a separate PR?
FYI, I just wanted to confirm what I asserted above about Symfony versions and #!/bin/bash
VERSIONS="2.3 2.7 2.8 3.0 3.1"
TMP_DIR="/tmp/symfony-assetic-check"
rm -fr ${TMP_DIR} && mkdir -p ${TMP_DIR}
curl -LsS https://symfony.com/installer -o ${TMP_DIR}/symfony-installer.phar
for version in ${VERSIONS}; do
echo -n "Symfony v${version}: "
php ${TMP_DIR}/symfony-installer.phar -q new ${TMP_DIR}/v${version} $version
grep assetic ${TMP_DIR}/v${version}/composer.lock > /dev/null
if [[ $? -eq 0 ]]; then
echo "Assetic Installed"
else
echo "Assetic **NOT** Installed"
fi
done The script outputs:
Again, these are just the defaults, and assetic may or may not be installed on any version. |
@Elfet Give me a shout if anything needs to be changed for this to be merge-ready. Otherwise, thanks for such a great tool! |
@robfrawley still need to think and find compromise between no BC break and moving forward. May be this is good for next major v4. |
@oanhnn what you think? |
This needs to also have the "BUG" issue label. (Deployer's Symfony recipes breaks when Symfony version 2.8 is used due to Assetic assumption, and the version 3 recipe calls unrelated commands for "assets:dump" task that it should not.) |
@Elfet Is this pull request particularly controversial for some reason I don't see? The current implementation is broken on Symfony 2.8 and calls incorrect commands on versions greater than 3. The only minor BC break seems very acceptable when the full scope of what this pull requests fixes is taken into account (and I can't figure a way around that BC break that also addresses the issues here). BC Breaks
Bug Fixes
Cleanup/Improvements
|
Sorry, for delay. Will look tonight or tomorrow.
|
@Elfet Any progress? |
@robfrawley This branch has conflicts that must be resolved. Please resolved (I think you should make new PR fix issue #720 ) |
Hi everyone! Sorry for a BIG delay. After a lot of thinking i'm decided not to merge this PR into 3.x, because of BC. So i'm closing this. But all that must be moved into 4.x branch, and i believe that can end up with sooner release on Deployer 4.x. |
@Elfet So, after I spend last night and part of the morning working to re-base this and fix the merge conflicts (due to the thumbs up on moving forward from @oanhnn), that work ends up being a waste of my time? This is due to one extremely minor BC break (that only affects the versions of Symfony most people no longer use), and apparently outweighs the 6 bug fixes and 5 improvements... I'm a bit speechless guys. |
We not going to throw you work away. We a going to merge your changes into 4.x branch. |
I'll open this PR to show what we still really need your work. |
@robfrawley please check 4.x branch. |
👍 |
I'm planning to speed up Deployer development and PR integration (with BC) by increasing speed of major releases. |
deploy:assetic:dump
task insymfony3
recipe, as it implied this command was no longer valid and should be overridden withdeploy:assets:install
command. In reality,deploy:assets:install
should exist in all symfony versions, as shoulddeploy:assetic:dump
(although this is arguable, asdeploy:assetic:dump
isn't a Symfony command, it is a kriswallsmith/assetic command).deploy:assetic:dump
tofalse
(viadump_assets
) as this is not a core Symfony package and should not be assumed to be installed. It relies on kriswallsmith/assetic and symfony/assetic-bundle.deploy:assets:install
task as this is a symfony-core command that is intended to be called prior to other asset compilation commands (such asdeploy:assetic:dump
). Its purpose to is to install any bundle assets (within<bundleName>/Resource/public
) and put them inweb/bundles/<bundleName>
.composer_action
createdSYMFONY_ENV
value inenv_vars
to correctly refer to the configuredenv
value.bin/console
to cleanup calls to Symfony console command (there was a ton of duplicated lines prior)console_options
so the options passed tobin/console
reflect what should be passed per the configured environment (for example, the--no-debug
options cannot be passed for any environment except forprod
and will likely break hard when passed fordev
environment)