Switch from infinite retries on upgrade to 10 retries. (#20450)

This changes the flutter tool to just try 10 times before giving up when running "flutter upgrade". Infinite retries can hang bots, and really don't provide a lot of help: if we've failed to upgrade for for nearly a minute, trying every five seconds, then something is just not responding.

Also, changed the bot default warning level to "normal" from "all", because the solver messages are VERY verbose: several megs of output for doing packages get on Flutter. "normal" will give warnings, user messages and errors, which should be sufficient to diagnose problems on the bots without spamming the log.

I removed the retrying for building the snapshot on flutter.bat because we don't do that on the other platforms, and because I can't imagine how running it again would give a different answer.

I also fixed a problem in the whitespace detection when no files matched the type of file that it is looking for, and removed the code that waits until failure to print the logs on setup, since reducing the log output made a huge difference.
This commit is contained in:
Greg Spencer
2018-08-11 19:10:14 -07:00
committed by GitHub
parent cf88359ae4
commit 01d6444490
4 changed files with 50 additions and 39 deletions

View File

@@ -1,28 +1,15 @@
#!/bin/bash
set -e
function error() {
echo "$@" 1>&2
}
# This script is only meant to be run by the Cirrus CI system, not locally.
# It must be run from the root of the Flutter repo.
# Collects log output in a tmpfile, but only prints it if the command fails.
function log_on_fail() {
local COMMAND="$@"
local TMPDIR="$(mktemp -d)"
local TMPFILE="$TMPDIR/command.log"
local EXIT=0
if ("$@" > "$TMPFILE" 2>&1); then
echo "'$COMMAND' succeeded."
else
EXIT=$?
cat "$TMPFILE" 1>&2
echo "FAIL: '$COMMAND' exited with code $EXIT" 1>&2
fi
rm -rf "$TMPDIR"
return "$EXIT"
}
function accept_android_licenses() {
yes "y" | flutter doctor --android-licenses
yes "y" | flutter doctor --android-licenses > /dev/null 2>&1
}
echo "Flutter SDK directory is: $PWD"
@@ -30,14 +17,15 @@ echo "Flutter SDK directory is: $PWD"
# Run flutter to download dependencies and precompile things, and to disable
# analytics on the bots.
echo "Downloading build dependencies and pre-compiling Flutter snapshot"
log_on_fail ./bin/flutter config --no-analytics
./bin/flutter config --no-analytics
# Run doctor, to print it to the log for debugging purposes.
./bin/flutter doctor -v
# Accept licenses.
log_on_fail accept_android_licenses && echo "Android licenses accepted."
echo "Accepting Android licenses."
accept_android_licenses || (error "Accepting Android licenses failed." && false)
# Run pub get in all the repo packages.
echo "Updating packages for Flutter."
log_on_fail ./bin/flutter update-packages
./bin/flutter update-packages

View File

@@ -134,7 +134,7 @@ Future<Null> _checkForTrailingSpaces() async {
'git', <String>['diff', '-U0', '--no-color', '--name-only', commitRange, '--'] + fileTypes,
workingDirectory: flutterRoot,
);
if (changedFilesResult.stdout == null) {
if (changedFilesResult.stdout == null || changedFilesResult.stdout.trim().isEmpty) {
print('No files found that need to be checked for trailing whitespace.');
return;
}