Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] fvm use stable --pin gets interactive in CI environment #753

Closed
3 tasks done
twogood opened this issue Jul 21, 2024 · 2 comments
Closed
3 tasks done

[BUG] fvm use stable --pin gets interactive in CI environment #753

twogood opened this issue Jul 21, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@twogood
Copy link

twogood commented Jul 21, 2024

Before creating a bug report please make check the following

  • You have read our FAQ
  • If you have used flutter. Please install correctly, run pub cache repair. Close the terminal and try again.
  • Run fvm doctor if possible and add the output to the issue.

Describe the bug
I'm trying to create a GitHub action that tries to upgrade to the latest Flutter stable (fvm use stable --pin) and create a PR if there is a new version.

To Reproduce

name: Update Flutter Version in FVM

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * 0' # Weekly

env:
  CI: true

jobs:
  update-flutter-version:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      - name: Set up Dart
        uses: dart-lang/setup-dart@v1

      - name: Install FVM
        run: dart pub global activate fvm

      - name: Run FVM use stable --pin
        run: fvm use stable --pin

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        with:
          commit-message: "Update Flutter version to latest stable"
          title: "Update Flutter version to latest stable"
          body: "This PR updates the Flutter version to the latest stable release. Tip: close and reopen this PR to trigger the GitHub Action for PRs!"
          branch: "update-flutter-stable-${{ github.run_number }}"
          delete-branch: true

What happens though is that fvm asks "Would you like to install it now? (y/n)" even in the CI environment.

Expected behavior
I would like fvm to not require interaction when running in a CI environment and the "CI" environment variable is included in kCiEnvironmentVariables. If it installs or not installs Flutter by default is not important.

Logs

Run fvm use stable --pin --verbose
  fvm use stable --pin --verbose
  shell: /usr/bin/bash -e {0}
  env:
    CI: true
    DART_HOME: /opt/hostedtoolcache/dart/3.4.4/x64
    PUB_CACHE: /home/runner/.pub-cache
Argument information:
  Top level options:
  - verbose: true
Command: use
  Command options:
    - pin: true
Searching for project in /home/runner/work/bankid-demo-flutter-firebase/bankid-demo-flutter-firebase
Found project config in /home/runner/work/bankid-demo-flutter-firebase/bankid-demo-flutter-firebase
Pinning version 3.[2](https://github.com/activout/bankid-demo-flutter-firebase/actions/runs/10027622205/job/27713521073#step:6:2)2.3 from "stable" release channel...
Creating local mirror...
.
.
.
✓ Clone complete
Flutter SDK: SDK Version : 3.22.3 is not installed.
25l? Would you like to install it now? (y/n) › yes

Desktop (please complete the following information):

  • OS: Linux (on GitHub Actions)
  • FVM Version fvm 3.1.7
  • If Windows: N/A

Additional context

Not sure if this is solved by #712 ?

fvm doctor output

Run fvm doctor
  fvm doctor
  shell: /usr/bin/bash -e {0}
  env:
    CI: true
    DART_HOME: /opt/hostedtoolcache/dart/3.4.4/x64
    PUB_CACHE: /home/runner/.pub-cache
FVM Doctor:                                                                     
--------------------------------------------------------------------------------
Project:
┌─────────────────────────────┬───────────────────────────────────────────────────────────────────────────────────┐
│ Project                     │ bankid-demo-flutter-firebase                                                      │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Directory                   │ /home/runner/work/bankid-demo-flutter-firebase/bankid-demo-flutter-firebase       │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Active Flavor               │ None                                                                              │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Is Flutter Project          │ Yes                                                                               │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────��───────────┤
│ Dart Tool Generator Version │ Not available                                                                     │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Dart tool version           │ Not available                                                                     │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ .gitignore Present          │ Yes                                                                               │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Config Present              │ Yes                                                                               │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Pinned Version              │ FlutterVersion(name: 3.19.6, releaseFromChannel: null, type: VersionType.release) │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Config path                 │ .fvmrc                                                                            │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Local cache dir             │ .fvm/versions                                                                     │
├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤
│ Version symlink             │ .fvm/versions/3.19.6                                                              │
└─────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────┘


IDEs:
┌────────────────────────────────┬─────────────────────────────────────────────────────┐
│ IDEs                           │ Value                                               │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ VSCode                         │                                                     │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ VSCode                         │ No .vscode directory found                          │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ IntelliJ (Android Studio, ...) │                                                     │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ IntelliJ (Android Studio, ...) │ No local.properties file found in android directory │
├────────────────────────────────┼─────────────────────────────────────────────────────┤
│ IntelliJ (Android Studio, ...) │ No .idea folder found                               │
└────────────────────────────────┴─────────────────────────────────────────────────────┘

Environment:
┌────────────────────────┬──────────────────────────────────────────────┐
│ Environment Variables  │ Value                                        │
├────────────────────────┼──────────────────────────────────────────────┤
│ Flutter PATH           │ Not found                                    │
├────────────────────────┼──────────────────────────────────────────────┤
│ Dart PATH              │ /opt/hostedtoolcache/dart/3.4.4/x64/bin/dart │
├────────────────────────┼──────────────────────────────────────────────┤
│ FVM_CACHE_PATH         │ N/A                                          │
├────────────────────────┼──────────────────────────────────────────────┤
│ FVM_USE_GIT_CACHE      │ N/A                                          │
├────────────────────────┼──────────────────────────────────────────────┤
│ FVM_GIT_CACHE_PATH     │ N/A                                          │
├────────────────────────┼──────────────────────────────────────────────┤
│ FVM_FLUTTER_URL        │ N/A                                          │
├────────────────────────┼──────────────────────────────────────────────┤
│ FVM_PRIVILEDGED_ACCESS │ N/A                                          │
├────────────────────────┼──────────────────────────────────────────────┤
│ Flutter PATH           │ Not found                                    │
├────────────────────────┼──────────────────────────────────────────────┤
│ Dart PATH              │ /opt/hostedtoolcache/dart/3.4.4/x64/bin/dart │
└────────────────────────┴──────────────────────────────────────────────┘
┌──────────────┬──────────────────────────────────────────────────────────────────────────────────┐
│ Platform     │ Value                                                                            │
├──────────────┼──────────────────────────────────────────────────────────────────────────────────┤
│ OS           │ linux Linux 6.5.0-10[2](https://github.com/activout/bankid-demo-flutter-firebase/actions/runs/10027622205/job/27713521073#step:5:2)3-azure #24~22.04.1-Ubuntu SMP Wed Jun 12 19:55:26 UTC 2024 │
├──────────────┼──────────────────────────────────────────────────────────────────────────────────┤
│ Dart Locale  │ C.UTF-8                                                                          │
├──────────────┼──────────────────────────────────────────────────────────────────────────────────┤
│ Dart runtime │ [3](https://github.com/activout/bankid-demo-flutter-firebase/actions/runs/10027622205/job/27713521073#step:5:3).4.4 (stable) (Wed Jun 12 15:5[4](https://github.com/activout/bankid-demo-flutter-firebase/actions/runs/10027622205/job/27713521073#step:5:4):31 2024 +0000) on "linux_x[6](https://github.com/activout/bankid-demo-flutter-firebase/actions/runs/10027622205/job/27713521073#step:5:6)4"                   │
└──────────────┴──────────────────────────────────────────────────────────────────────────────────┘
@leoafarias
Copy link
Owner

@twogood I believe this has been addressed in the latest version, as FVM detects if it is CI in order to use interactivity. I will close this issue, but please reopen it if that is not your experience.

@twogood
Copy link
Author

twogood commented Nov 4, 2024

Works with fvm 3.2.1, thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants