-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[TRAVIS] EZEE-2236: Retry installation after Composer failure #2404
[TRAVIS] EZEE-2236: Retry installation after Composer failure #2404
Conversation
.travis.yml
Outdated
@@ -67,7 +67,7 @@ before_script: | |||
- if [ "$REDIS_ENABLE_IGBINARY" = true ] ; then pecl install igbinary ; fi | |||
- if [ "$REDIS_ENABLE_LZF" = true ] ; then printf "no\n" | pecl install lzf ; fi | |||
# Prepare system | |||
- if [ "$TEST_CONFIG" != "" ] ; then ./bin/.travis/prepare_unittest.sh ; fi | |||
- if [ "$TEST_CONFIG" != "" ] ; then travis_retry ./bin/.travis/prepare_unittest.sh ; fi |
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.
Are you sure this is going to work? It depends on script return code, and prepare_unittest.sh
will always return 0, even if there are errors in subcommands. Error code from subcommand is not propagated.
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.
Good catch, I forgot about the "exit code is the code of last executed command" bit 😞
As I see it, there are two options here:
- use
set -e
in prepare_unittest.sh - check the return value of each composer command and exit with it if it's non-0.
WDYT?
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.
1
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.
BUT, several things in that script should ideally not be done several times. So this might cause some super strange issues down the line...
That's a good point. So we should use it directly for composer install/update @mnocon investigated it further and it looks like we cannot use I think we need to refactor |
Good catch Andre, I haven't thought about it. I'll try the travis_retry inside the script approach (my knowledge is based on https://twitter.com/plexus/status/499194992632811520 - I haven't found anything about both supporting and not supporting it in scripts in official doc, so it's fastest way to check). If it fails I will do the refactoring with moving the composer bits (and the ones after it) into the .travis.yml file. |
I can confirm it does not work inside scripts like @alongosz says, might be a way, but I'm in favor of refactoring it to do it outside, slight problem becomes the install vs update problem, but if we are sure we never have a lock (script can remove it if it is there in case update is needed for instance) then we can always run install. |
@alongosz I've pushed another changes. I've decided to add the travis_retry function and use it directly in the script. I know we've talked about extracting the composer parts - I tried this approach and I didn't like it. This approach is much clearer IMHO - the whole logic of setting up unit tests is still in one place. Script I feel like extracting it just for the purpose of using travis_retry is an overkill (maybe there are other reasons to refactor, but I'm not seeing them) and this new approach is better. What do 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.
I don't want to maintain travis_retry
;)
Current changes with more logic moved to .travis.yml, while maybe make it a little bit "packed", but seem to me like a good approach.
@alongosz do you think we can merge this one? We've decided to wait because of temporary Travis issues, but it's green now |
Fine by me. Final review ping @andrerom |
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.
besides nitpic on possible simpliciation, +1
.travis.yml
Outdated
@@ -74,6 +74,14 @@ before_script: | |||
- TEST_TIMEZONES=("America/New_York" "Asia/Calcutta" "UTC") | |||
- TEST_TIMEZONE=${TEST_TIMEZONES["`shuf -i 0-2 -n 1`"]} | |||
|
|||
install: | |||
# Because of either some changes in travis, composer or git, composer is not able to pick version for "self" on inclusion of solr anymore, so we force it: | |||
- if [ "$TEST_CONFIG" != "" ] ; then export COMPOSER_ROOT_VERSION=`php -r 'echo json_decode(file_get_contents("./composer.json"), true)["extra"]["branch-alias"]["dev-tmp_ci_branch"];'` ; fi |
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.
Did you try without this?
Afaik this has since been resolved, so cool if you can try removing those two lines in a commit and see if all jobs still pass.
Thanks @andrerom , it works without it 🎉 |
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.
Looks even better!
Sometimes
composer install
fails because of network connection problems, for example:Adding
travis_retry
should help avoid this (and improve stability).TODO: