"flutter channel stable" 在 docker 图像中失败:将页面发布到 gitlab 时出现 cirrusci

"flutter channel stable" failed in docker image: cirrusci when publish pages to gitlab

我正在尝试在 gitlab 上发布我的 flutter 页面,该实验室是我项目的 git 宿主。我正在使用 ci 配置如下(来自这个 post

git实验室页面 CI 配置
image: cirrusci/flutter:latest

before_script:
  - flutter channel stable
  - flutter upgrade
  - flutter config --enable-web
  - flutter pub get

pages:
  stage: deploy
  script:
    - flutter build web
    - cp -r build/web public
  artifacts:
    paths:
      - public
  only:
    - live

ci 作业失败,错误如下:

...
$ flutter channel stable
Switching to flutter channel 'stable'...
git: fatal: 'origin/stable' is not a commit and a branch 'stable' cannot be created from it
Switching channels failed with error code 128.
...

有什么问题?

值得注意的一件事是我的 flutter 项目位于存储库根目录的子目录(即 my-flutter-dir)中。是这个原因吗?在这种情况下如何配置 CI 脚本?

我尝试在 before_script 中添加 cd my-flutter-dir 作为第一个命令,但它仍然导致相同的错误。

原来是 docker 图片的问题。我把befor_script部分的flutter channelflutter upgrade命令去掉后,一切正常

注意,如果你在仓库根目录下的子目录中有flutter项目,你仍然需要在before_script中添加cd you-flutter-dir命令。另外不要忘记将 .gitlab-ci.yml 文件放在存储库的根目录中。