Skip to content
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

Static asset compilation errors are ignored #35

Closed
erikhansen opened this issue Oct 12, 2016 · 8 comments
Closed

Static asset compilation errors are ignored #35

erikhansen opened this issue Oct 12, 2016 · 8 comments

Comments

@erikhansen
Copy link
Contributor

erikhansen commented Oct 12, 2016

I'm using Magento EE 2.1.1 with Capistrano 0.5.1. Capistrano is ignoring static asset compilation errors. Screenshot demonstrating problem (I changed command_output to true to see all output for the sake of debugging):

16-15-09 new message-wt45z

In this commit, the explicit check for the "Compilation from source" error message was removed. In order to fix this issue, I propose that this check gets added back (and possibly ALSO check for the presence of the "New version of deployed files" success message).

If you'd like me to submit this as a PR, let me know.

@erikhansen
Copy link
Contributor Author

I accidentally created this task without a body. Just updated it with content.

@erikhansen
Copy link
Contributor Author

erikhansen commented Oct 12, 2016

I just did some tests and it actually appears that the bin/magento setup:static-content:deploy command returns a non-zero exit code ("1") when there are compilation errors. Take a look at this code and you'll see it references this issue. Per @davidalger's latest comment, it appears this is now in place in 2.1.0+.

@davidalger In order to fully support 2.0.x, we'll need to do two checks:

For 2.0.x, revert to checking for "Compilation from source"
For 2.1.0+, switch from the current check for "New version of deployed files" to checking the return code of the setup:static-content:deploy command.

I wonder how much longer capistrano-magento2 should continue to support 2.0…

@davidalger
Copy link
Owner

davidalger commented Oct 13, 2016

I wonder how much longer capistrano-magento2 should continue to support 2.0…

For as long as 2.0 is a supported major release ;)

For 2.1.0+, switch from the current check for "New version of deployed files" to checking the return code of the setup:static-content:deploy command.

This is actually supposed to be automatic. If the exit code of a command is non-zero, the deploy fails…I just verified this is the case with capture as well as execute where it's fairly well assumed. How did you check the error codes the console returns when receiving this error? I can't seem to get the command to throw any errors for my immediate testing. Can you run the command on the broken code and then run echo $? on the CLI to see what the return code is?

For 2.0.x, revert to checking for "Compilation from source"

I believe the reason I switched away from this in the first place is because that is only one potential error it could spit out. Whats to say there couldn't be other error related strings in the output? Hence the switch to a positive check, which I assumed? worked when I implemented it having no broken code to test with :) based on the output above, this assumed to be positive message shows regardless of there being errors or not.

I'm considering implementing a check for the number of errors reported. It would iterate over each line and check the errors: 123 text for a number greater than zero. This should catch it regardless of the console exit code.

@davidalger
Copy link
Owner

@erikhansen See above pushed commit for the type of implementation I'm suggesting. Open to any feedback. Want to make sure I get it right this time! ;)

davidalger added a commit that referenced this issue Oct 13, 2016
davidalger added a commit that referenced this issue Oct 13, 2016
@davidalger
Copy link
Owner

@erikhansen I've made some additional changes and submitted a PR to develop. Please review. The positive check for presence of the "New version…" text is necessary, as it won't be there (and neither will the "errors: xyz" text) in the case of an Exception being thrown. This can be easily seen if you (for example) run the console command with an invalid option triggering a RuntimeException.

@erikhansen
Copy link
Contributor Author

@davidalger I look forward to reviewing your PR. I won't be able to review it until early next week, but when I do, I can test it locally to ensure it works with the specific use that prompted me to create this issue.

@erikhansen
Copy link
Contributor Author

@davidalger I checked out your issue-53 branch locally, ran bundle exec rake install to deploy it locally, and went through the same deployment steps that prompted the creation of this task. I'm happy to report that Capistrano did catch the compilation error:

image

FYI, I did not test this on a 2.0.x install.

@davidalger
Copy link
Owner

The changes have been pushed up as part of v0.5.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants