fluttergitlab-cipipeline

Sometimes get error "flutter: command not found" during pipeline run in gitlab


We have a macbook with Runner for gitlab CI on it. Sometimes, pipeline fails with error "flutter: command not found". Sometimes it works correctly and all unit and integration tests passes.

What can be the reason of such behaviour?

gitlab-ci.yml file is:

before_script:
- flutter channel stable
- flutter upgrade
- flutter pub get

stages:
- test_unit
- test_integration

test_unit:
stage: test_unit
script:
  - flutter test
  - cd android
  - cp ~/builds/QKu8Lg6_/0/mobile/local.properties ~/builds/QKu8Lg6_/0/mobile/app/android
  - ./gradlew app:connectedAndroidTest
only:
  - merge_requests
except:
  - schedules
retry: 2


test_integration:
stage: test_integration
script:
  - flutter drive --target=test_driver/app/app.dart
  - flutter drive --target=test_driver/app/app.dart -d iPhone Xʀ
  - flutter drive --target=test_driver/skill/time/time.dart
  - flutter drive --target=test_driver/skill/time/time.dart -d iPhone Xʀ
only:
  - schedules
retry: 2

Solution

  • We solved it!

    The problem was in default gitlab runner, which is applied to all gitlab projects. So, we have 2 runners: the default one and macbook's runner. Sometimes, gitlab runs our build on non configured default runner and it fails.

    We removed default runner from our gitlab's project and all is working as expected!