aloisdeniel / vsts-flutter-tasks

Flutter build tasks for Azure DevOps Pipelines/TFS.
https://marketplace.visualstudio.com/items?itemName=aloisdeniel.flutter
105 stars 83 forks source link

Flutter custom install task not considering the channel when searching to download correct release #77

Open moonytoes29 opened 3 years ago

moonytoes29 commented 3 years ago

The usage in azure devops pipeline on a Mac host:

- task: FlutterInstall@0
      displayName: install custom flutter version
      inputs:
        channel: 'stable'
        version: 'custom'
        customVersion: '2.0.1'

Expected download link that install task should use:

https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_2.0.1-stable.zip

Actual download link that install task finds and uses:

https://storage.googleapis.com/flutter_infra/releases/beta/macos/flutter_macos_2.0.1-beta.zip

Install task looks like it searches primarily for the customVersion set and not pairing with the channel set when version is set to custom.

tasks/install/index.ts

... else {
        current = json.releases.find((item: { version: any; }) => uniformizeVersion(item.version) === uniformizeVersion(version));
    }

JSON includes multiple 2.0.1 versions, but only one that is both 2.0.1 and stable. Looks to traverse and find first, then proceed with that.

"releases": [
    {
      "hash": "c5a4b4029c0798f37c4a39b479d7cb75daa7b05c",
      "channel": "beta",
      "version": "2.0.1",
      "release_date": "2021-03-04T20:57:52.657482Z",
      "archive": "beta/macos/flutter_macos_2.0.1-beta.zip",
      "sha256": "39569c1443311ebc66cff944ce1e58dcf1314c600776e40cbec69b68b523b624"
    },
    {
      "hash": "c5a4b4029c0798f37c4a39b479d7cb75daa7b05c",
      "channel": "stable",
      "version": "2.0.1",
      "release_date": "2021-03-04T19:46:19.886582Z",
      "archive": "stable/macos/flutter_macos_2.0.1-stable.zip",
      "sha256": "0d1985d0cc6ef99a51c8b2051aceb07eb654a02973e8e43aaf28ef1d8c3735b4"
    },
    {
      "hash": "60bd88df915880d23877bfc1602e8ddcf4c4dd2a",
      "channel": "beta",
      "version": "2.0.0",
      "release_date": "2021-03-03T19:38:28.814685Z",
      "archive": "beta/macos/flutter_macos_2.0.0-beta.zip",
      "sha256": "ac96558264c7cba717b27b5c1f136333a30345f720c0741cc63dfd519a82b3bd"
    },