fvm icon indicating copy to clipboard operation
fvm copied to clipboard

leoafarias/fvm:latest broken with latest FVM version

Open AngeloAvv opened this issue 1 year ago • 9 comments

Before creating a bug report please make check the following

  • [X] You have read our FAQ
  • [ ] If you have used flutter. Please install correctly, run pub cache repair. Close the terminal and try again.
  • [ ] If you are on Windows. Make sure you are running the terminal as administrator or with developer permissions.
  • [ ] Run fvm doctor if possible and add the output to the issue.

Describe the bug After upgrading to the latest fvm version (3.x) the tool changed the file config moving everything under .fvmrc. Since my CI is using leoafarias/fvm:latest, sounds like that image is not using the latest FVM version

To Reproduce Steps to reproduce the behavior:

In the CI script: $ fvm install Please provide a channel or a version, or run this command in a Flutter project that has FVM configured.

Expected behavior latest version of fvm should detect the new .fvmrc file

AngeloAvv avatar Feb 15 '24 18:02 AngeloAvv

@AngeloAvv This is related to #626

leoafarias avatar Feb 16 '24 17:02 leoafarias

@AngeloAvv can you try again as this should have been resolved on 3.0.4 which was just released

leoafarias avatar Feb 16 '24 17:02 leoafarias

@leoafarias unfortunately nothing changed. This is part of my CI output log:

Using Docker executor with image leoafarias/fvm:latest ...
Pulling docker image leoafarias/fvm:latest ...
Using docker image sha256:5842ebf363d002bfe4bb93094674ece87d5a9958de3535b536c4a59f2a289b1c for leoafarias/fvm:latest with digest leoafarias/fvm@sha256:3696a70138d1444b353244446138bf0915b1884356bb443d7e100e9bf66e2d19 ...
Successfully extracted cache
Executing "step_script" stage of the job script
00:00
Using docker image sha256:5842ebf363d002bfe4bb93094674ece87d5a9958de3535b536c4a59f2a289b1c for leoafarias/fvm:latest with digest leoafarias/fvm@sha256:3696a70138d1444b353244446138bf0915b1884356bb443d7e100e9bf66e2d19 ...
$ fvm install
Please provide a channel or a version, or run this command in a Flutter project that has FVM configured.
Running after_script
00:01
Running after script...
$ echo $CI_PIPELINE_IID
450
$ date
Fri Feb 16 18:06:20 UTC 2024
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1

AngeloAvv avatar Feb 16 '24 18:02 AngeloAvv

Based on the output, the command is not running on a project folder, and there is no fvm config found to install the version

leoafarias avatar Feb 17 '24 00:02 leoafarias

I don't understand how this could be possible since I didn't change anything in my CI scripts. Every single Flutter project is failing if I forget to rollback the migration to .fvmrc.

The following script is one of the simplest ones that are failing. As you can see, I'm not going back and forth in the folders, I'm just running fvm instructions:

.android_image:
  image: fabernovel/android:api-33-v1.7.0

.flutter:
  image: leoafarias/fvm:latest
  before_script:
    - fvm install
    - fvm flutter doctor
    - fvm flutter pub get
  stage: test
  tags:
    - flutter
.test:
  extends: .flutter
  stage: test

analyze:
  extends: .test
  script:
    - fvm flutter analyze

tests:
  extends: .test
  script:
    - apt-get update && apt-get -y install lcov
    - pub global activate junitreport
    - fvm flutter test --machine --coverage
      | tojunit -o report.xml
    - lcov --summary coverage/lcov.info
    - genhtml coverage/lcov.info --output=coverage
  coverage: '/lines\.*: \d+\.\d+\%/'
  artifacts:
    name: coverage
    paths:
      - $CI_PROJECT_DIR/coverage
    expire_in: 7 days
    reports:
      junit: report.xml

I also tried running the script locally using gitlab-ci-local and is failing too, but if I use fvm install in my project, everything is working fine. It's a clear indication that something is wrong in the docker image.

EDIT: After taking a look at the fvm Dockerfile, I'm assuming you need to rebuild the image because five months ago (last time you built fvm:latest) you hadn't released fvm 3.x yet

AngeloAvv avatar Feb 17 '24 14:02 AngeloAvv

@AngeloAvv I am not a rocket expert but the image should just install the latest.

I will take a look at what could be happening, maybe there is a directory issue on fvm.

leoafarias avatar Feb 17 '24 15:02 leoafarias

I don't think so :) at least if you're using this file to create the fvm image.

As far as I can see, there's a param FVM_VERSION which has been used to define the version of fvm to be used at that time. This means that every time you release a newer version of fvm, you need to rerun the image creation process to update the fvm version in the fvm:latest image.

Also, it would be nice to tag previous versions for those people who don't want to use the latest version but a fixed version instead.

cc @andreadelfante who worked on the Dockerfile

AngeloAvv avatar Feb 17 '24 16:02 AngeloAvv

Unfortunately this does not seem to be resolved in the PRs mentioned above. As my console logs will show the current leoafarias/fvm:latest is not shipping the current FVM version and instead ships with 2.3.1

run_test:
  image: leoafarias/fvm:latest
  stage: run_test
  before_script:
    # Flutter version should already be configured in .fvmrc
    - ls -la
    - fvm --version
    - fvm install
    - fvm flutter pub global activate junitreport

Console log:

Using docker image sha256:5842ebf363d002bfe4bb93094674ece87d5a9958de3535b536c4a59f2a289b1c for leoafarias/fvm:latest with digest leoafarias/fvm@sha256:3696a70138d1444b353244446138bf0915b1884356bb443d7e100e9bf66e2d19 ...
$ /pre_build_script.sh
npm not found or npm version is >8
$ ls -la
total 44
drwxrwxrwx. 7 root root 4096 Jun 10 07:44 .
drwxrwxrwx. 4 root root   40 Jun 10 07:44 ..
-rw-rw-rw-. 1 root root   25 Jun 10 07:44 .fvmrc
drwxrwxrwx. 6 root root  113 Jun 10 07:44 .git
-rw-rw-rw-. 1 root root  717 Jun 10 07:44 .gitignore
-rw-rw-rw-. 1 root root 6169 Jun 10 07:44 .gitlab-ci.yml
-rw-rw-rw-. 1 root root 1114 Jun 10 07:44 .metadata
-rw-rw-rw-. 1 root root  184 Jun 10 07:44 README.md
-rw-rw-rw-. 1 root root 1446 Jun 10 07:44 analysis_options.yaml
drwxrwxrwx. 5 root root  168 Jun 10 07:44 android
drwxrwxrwx. 8 root root  188 Jun 10 07:44 ios
drwxrwxrwx. 2 root root  101 Jun 10 07:44 lib
-rw-rw-rw-. 1 root root 7428 Jun 10 07:44 pubspec.lock
-rw-rw-rw-. 1 root root 3922 Jun 10 07:44 pubspec.yaml
drwxrwxrwx. 2 root root   30 Jun 10 07:44 test
$ fvm --version
2.3.1
$ fvm install
Please provide a channel or a version, or run this command in a Flutter project that has FVM configured.

CodeRedDev avatar Jun 10 '24 05:06 CodeRedDev

You can add this script to pull the version from .fvmrc:

before_script: - export FLUTTER_VERSION=$(grep '"flutter":' .fvmrc | sed 's/[^0-9.]//g') - fvm install $FLUTTER_VERSION - fvm use $FLUTTER_VERSION

katzet20 avatar Jun 13 '24 11:06 katzet20

@leoafarias Hi! Could you please run the deploy_docker workflow to update the image in docker hub to the latest version?

cheymos avatar Jul 29 '24 15:07 cheymos

I'm trying to set up gitlab ci and discovered that version 2.3.1 is still stored in the docker hub :(

cheymos avatar Jul 29 '24 15:07 cheymos

Done this was deployed

leoafarias avatar Jul 30 '24 13:07 leoafarias