在 gitlab 中运行管道期间有时会收到错误"flutter: command not found"



我们有一台Macbook,上面有用于gitlab CI的Runner。 有时,管道会失败并显示错误"颤振:找不到命令"。有时它工作正常,所有单元和集成测试都通过。

这种行为的原因可能是什么?

gitlab-ci.yml 文件是:

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

我们解决了!

问题出在默认的 gitlab 运行器中,它适用于所有 gitlab 项目。 因此,我们有 2 个运行器:默认运行器和 macbook 的运行器。 有时,gitlab 在未配置的默认运行器上运行我们的构建并失败。

我们从 gitlab 的项目中删除了默认运行器,一切都按预期工作!

最新更新