php-docs-samples
php-docs-samples copied to clipboard
[CI] random failures of presubmit jobs
I experience troubles with my PR lately. When Kokoro CI runs, a random job fails. Test log contains lines like:
Activated service account credentials for: [[email protected]]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 162 100 162 0 0 228 0 --:--:-- --:--:-- --:--:-- 228
100 162 100 162 0 0 228 0 --:--:-- --:--:-- --:--:-- 228
100 1474 100 1474 0 0 1584 0 --:--:-- --:--:-- --:--:-- 1584
+ PHP_CS_FIXER=php-cs-fixer
+ '[' -f vendor/bin/php-cs-fixer ']'
+ '[' -f ./php-cs-fixer ']'
+ PHP_CS_FIXER=./php-cs-fixer
+++ dirname testing/run_cs_check.sh
++ cd testing
++ pwd
+ DIR=/tmpfs/src/github/php-docs-samples/testing
+ ./php-cs-fixer fix --dry-run --diff --config=/tmpfs/src/github/php-docs-samples/testing/../.php_cs.dist --path-mode=intersection .
./php-cs-fixer: line 1: syntax error near unexpected token `newline'
./php-cs-fixer: line 1: `<html>'
[ID: 7340483] Build finished after 77 secs, exit value: 2
I believe this happens inside .kokoro/system_tests.sh: when the script tries to download php-cs-fixer-v2.phar, the server fails to serve requested file and returns a HTML error message instead, which is written to the file; when bash tries to run corrupted script, it sees <html> instead of shebang/path and reports an error.
This is really annoying (especially because I cannot rerun CI myself). Is there a way to avoid such errors? Maybe the script could detect downloading errors and retry downloading a bit later?
This should be fixed in #1091