Skip to content

Conversation

@alibitek
Copy link
Contributor

@alibitek alibitek commented Dec 31, 2017

flutter doctor exits with a non-zero status code when one of the defined IDE validators returns ValidationType.missing:

Due to this, one cannot use the exit status of flutter doctor command in a CI environment to determine whether flutter system requirements are met.

For example, in GitLab CI, the GitLab Runner stops executing when it encounters a command within a job that exits with a non zero code.
I had to use RUN flutter doctor || exit 0 instead of RUN flutter doctor to prevent the build job from failing after running flutter doctor in a Docker container image based on Debian Stretch where no IDE is installed.

@Hixie
Copy link
Contributor

Hixie commented Jan 13, 2018

cc @tvolkert

@tvolkert
Copy link
Contributor

I'm curious what your use case is that causes you to run flutter doctor on a bot. If the previous setup steps in the bot have succeeded, don't you know that your environment is set up?

@alibitek
Copy link
Contributor Author

If the previous setup steps in the bot have succeeded, don't you know that your environment is set up?

Not necessarily. For example, in the above mentioned Dockerfile one can forget to install one of:

    "platforms;android-$ANDROID_TARGET_SDK" \
    "build-tools;$ANDROID_SDK_BUILD_TOOLS" \
    "platform-tools"  \

via the sdkmanager command.

Even though the sdkmanager command succeeded, flutter environment is not properly setup.

Running flutter doctor ensures that everything Flutter needs is installed, e.g.:

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /home/user/Software/android-sdk
    • Android NDK at /home/user/Software/android-sdk/ndk-bundle
    • Platform android-27, build-tools 27.0.3 (this line could be missing)
    • ANDROID_HOME = /home/user/Software/android-sdk
    • Java binary at: /home/user/Software/android-studio-preview/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Hixie
Copy link
Contributor

Hixie commented Jan 19, 2018

Thanks for the contribution @alibitek!

@Hixie Hixie merged commit 3258c54 into flutter:master Jan 19, 2018
@Hixie
Copy link
Contributor

Hixie commented Jan 20, 2018

I need to revert this because it broke one of our tests (probably a test running on a bot that's verifying the IDE stuff). I'll post the logs momentarily.

@Hixie
Copy link
Contributor

Hixie commented Jan 20, 2018

The tests that failed were:
https://github.com/flutter/flutter/blob/master/dev/devicelab/bin/tasks/gradle_plugin_test.dart
https://github.com/flutter/flutter/blob/master/dev/devicelab/bin/tasks/flutter_gallery_instrumentation_test.dart

The logs were respectively:


------------ LOG ------------
Deleting build/ directories, if any.
Deleting /home/linux2/.cocoon/flutter/dev/integration_tests/ui/build
Observatory listening on http://127.0.0.1:20000/


══════════════╡ ••• Running flutter doctor to get JAVA_HOME ••• ╞═══════════════


Executing: /home/linux2/.cocoon/flutter/dev/devicelab/../../bin/flutter doctor
stdout: [✓] Flutter (on Linux, locale en_US.UTF-8, channel unknown)
stdout:     • Flutter version unknown at /home/linux2/.cocoon/flutter
stdout:     • Framework revision 3258c54618 (20 minutes ago), 2018-01-20 00:45:10 +0200
stdout:     • Engine revision e45eb692b1
stdout:     • Tools Dart version 2.0.0-dev.16.0
stdout:     • Engine Dart version 2.0.0-edge.93d8c9fe2a2c22dc95ec85866af108cfab71ad06
stdout: 
stdout: [✓] Android toolchain - develop for Android devices (Android SDK 26.0.3)
stdout:     • Android SDK at /home/linux2/Android/Sdk
stdout:     • Android NDK at /home/linux2/Android/Sdk/ndk-bundle
stdout:     • Platform android-27, build-tools 26.0.3
stdout:     • ANDROID_HOME = /home/linux2/Android/Sdk
stdout:     • Java binary at: /home/linux2/android-studio/jre/bin/java
stdout:     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
stdout: 
stdout: [✓] Connected devices
stdout:     • Moto G 4 • ZY223TDZPV • android-arm • Android 7.0 (API 24)
stdout: 
exitcode: 0
Task failed: NoSuchMethodError: The method 'group' was called on null.
Receiver: null
Tried calling: group(1)

Stack trace:
dart:core                                                  Object.noSuchMethod
bin/tasks/gradle_plugin_test.dart 19:60                    main.
===== asynchronous gap ===========================
dart:async                                                 _Completer.completeError
bin/tasks/gradle_plugin_test.dart                          main.
===== asynchronous gap ===========================
dart:async                                                 _asyncThenWrapperHelper
bin/tasks/gradle_plugin_test.dart 15:17                    main.
package:flutter_devicelab/framework/framework.dart 125:36  _TaskRunner._performTask.
===== asynchronous gap ===========================
dart:async                                                 new Future.microtask
package:flutter_devicelab/framework/framework.dart 124:28  _TaskRunner._performTask.
package:stack_trace                                        Chain.capture
package:flutter_devicelab/framework/framework.dart 124:11  _TaskRunner._performTask
package:flutter_devicelab/framework/framework.dart 84:39   _TaskRunner.run

Task execution finished

Task failed with the following reason:
Task failed: NoSuchMethodError: The method 'group' was called on null.
Receiver: null
Tried calling: group(1)
...
stdout: Built build/app/outputs/apk/release/app-release.apk (15.2MB).
exitcode: 0

Executing: /home/linux2/.cocoon/flutter/dev/devicelab/../../bin/flutter doctor
stdout: [✓] Flutter (on Linux, locale en_US.UTF-8, channel unknown)
stdout:     • Flutter version unknown at /home/linux2/.cocoon/flutter
stdout:     • Framework revision 3258c54618 (8 minutes ago), 2018-01-20 00:45:10 +0200
stdout:     • Engine revision e45eb692b1
stdout:     • Tools Dart version 2.0.0-dev.16.0
stdout:     • Engine Dart version 2.0.0-edge.93d8c9fe2a2c22dc95ec85866af108cfab71ad06
stdout: 
stdout: [✓] Android toolchain - develop for Android devices (Android SDK 26.0.3)
stdout:     • Android SDK at /home/linux2/Android/Sdk
stdout:     • Android NDK at /home/linux2/Android/Sdk/ndk-bundle
stdout:     • Platform android-27, build-tools 26.0.3
stdout:     • ANDROID_HOME = /home/linux2/Android/Sdk
stdout:     • Java binary at: /home/linux2/android-studio/jre/bin/java
stdout:     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
stdout: 
stdout: [✓] Connected devices
stdout:     • Moto G 4 • ZY223TDZPV • android-arm • Android 7.0 (API 24)
stdout: 
exitcode: 0
Task failed: Bad state: No element

Stack trace:
dart:core                                                   Iterable.first
bin/tasks/flutter_gallery_instrumentation_test.dart 24:101  main..
===== asynchronous gap ===========================
dart:async                                                  _Completer.completeError
bin/tasks/flutter_gallery_instrumentation_test.dart         main..
===== asynchronous gap ===========================
dart:async                                                  _asyncThenWrapperHelper
bin/tasks/flutter_gallery_instrumentation_test.dart 18:50   main..
package:flutter_devicelab/framework/utils.dart 329:24       inDirectory
===== asynchronous gap ===========================
dart:async                                                  new Future.microtask
package:flutter_devicelab/framework/utils.dart 325:80       inDirectory
bin/tasks/flutter_gallery_instrumentation_test.dart 18:11   main.
===== asynchronous gap ===========================
dart:async                                                  new Future.microtask
bin/tasks/flutter_gallery_instrumentation_test.dart 15:23   main.
package:flutter_devicelab/framework/framework.dart 125:36   _TaskRunner._performTask.
===== asynchronous gap ===========================
dart:async                                                  new Future.microtask
package:flutter_devicelab/framework/framework.dart 124:28   _TaskRunner._performTask.
package:stack_trace                                         Chain.capture
package:flutter_devicelab/framework/framework.dart 124:11   _TaskRunner._performTask
package:flutter_devicelab/framework/framework.dart 84:39    _TaskRunner.run

Task execution finished

Task failed with the following reason:
Task failed: Bad state: No element

@Hixie
Copy link
Contributor

Hixie commented Jan 20, 2018

Yeah, both of these tests are looking for "Android Studio at" in the output.

@alibitek Would you mind making the appropriate changes to those tests and resubmitting the PR?

HansMuller pushed a commit that referenced this pull request Jan 20, 2018
…#14196)

* Revert "Bump async, http, and vm_service_client packages (#14136)"

This reverts commit 7ffcce8.

* Revert "Exclude flutter doctor IDE validators in CI environments (#13816)"

This reverts commit 3258c54.
@alibitek
Copy link
Contributor Author

@Hixie I will make the appropriate changes to those tests and resubmit the PR.

DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
…flutter#14196)

* Revert "Bump async, http, and vm_service_client packages (flutter#14136)"

This reverts commit 7ffcce8.

* Revert "Exclude flutter doctor IDE validators in CI environments (flutter#13816)"

This reverts commit 3258c54.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants