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

288

It's turn out being an issue of the docker image. After I removed the flutter channel and flutter upgrade command in the befor_script part, everything is ok now.

Note if you have the flutter project in a subdirectory under the repository root, still you need to add cd you-flutter-dir command in the before_script. Also don't forget to put the .gitlab-ci.yml file in the root of the repository.

Share:
288
John Wang
Author by

John Wang

Updated on December 30, 2022

Comments

  • John Wang
    John Wang over 1 year

    I'm trying to publish my flutter page on gitlab which is the git host of my project. I'm using the ci configure like the following(from this post)

    gitlab page CI configure
    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
    

    The ci job failed in an error like:

    ...
    $ 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.
    ...
    

    What's the problem?

    One thing worth to note is my flutter project locate in a subdirectory(ie., my-flutter-dir) of the repository root. Is it the reason? How to configure the CI script in this situation?

    I've tried to add a cd my-flutter-dir as the first command in the before_script, but it still result in the same error.