geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple versions of yarn being installed.

argrithmag opened this issue · comments

Before opening an issue please read this.

Are you reporting a bug or a feature request ?

  • Bug
  • [] Feature request

Description

I think this may be a bug, or just my not understanding how things work. I set Yarn installer to use version 1.9.x for my build server.
On the build server, under the 1.9.4 folder, I see yarn v1.5.1 through v1.10.1

In the build log, I see the following for the Yarn Install task.
NOTE: the Prepended path environment references v1.5.1, then the build ends up using 1.5.1 to build.
Depending if i configure the yarn install with 1.9.x and/or the always download the latest matching version, it'll download v1.10.1 and use that version instead of the 1.9.4. Our build has issues with 1.10.1, so i want to avoid that.

2018-10-05T13:32:30.5636701Z ##[section]Starting: Use Yarn 1.9.x 2018-10-05T13:32:30.5640486Z ============================================================================== 2018-10-05T13:32:30.5640765Z Task : Yarn Tool Installer 2018-10-05T13:32:30.5640893Z Description : Installs a version of Yarn 2018-10-05T13:32:30.5640998Z Version : 2.5.999 2018-10-05T13:32:30.5641098Z Author : Geek Learning 2018-10-05T13:32:30.5641237Z Help : [More Information](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn) (Version 2.5.999) 2018-10-05T13:32:30.5641371Z ============================================================================== 2018-10-05T13:32:31.7552065Z Found tool in cache: yarn 1.9.4 x64 2018-10-05T13:32:31.7825168Z Prepending PATH environment variable with directory: E:\BuildAgent01\w\_tool\yarn\1.9.4\x64\yarn-v1.5.1\bin 2018-10-05T13:32:31.7929759Z ##[section]Finishing: Use Yarn 1.9.x

The yarn build command has the following log:
`2018-10-05T13:34:11.4572524Z ##[section]Starting: Yarn build
2018-10-05T13:34:11.4576905Z ==============================================================================
2018-10-05T13:34:11.4577072Z Task : Yarn task
2018-10-05T13:34:11.4577177Z Description : Executes Yarn
2018-10-05T13:34:11.4577282Z Version : 2.5.999
2018-10-05T13:34:11.4577404Z Author : Geek Learning
2018-10-05T13:34:11.4577589Z Help : More Information (Version 2.5.999).

Dear Angular and Ember CLI users, please check our known issues
2018-10-05T13:34:11.4577823Z ==============================================================================
2018-10-05T13:34:13.4806315Z [command]C:\Windows\system32\cmd.exe /D /S /C "E:\BuildAgent01\w_tool\yarn\1.9.4\x64\yarn-v1.5.1\bin\yarn.cmd build"
2018-10-05T13:34:13.7372320Z yarn run v1.5.1
2018-10-05T13:34:13.8562164Z $ node scripts/build.js
2018-10-05T13:34:20.9559565Z Creating an optimized production build...
2018-10-05T13:35:09.8951658Z Compiled successfully.`

Expected behavior

The yarn command only installs and runs the intended version, if 1.9.x version is set, it only downloads 1.9.x and only runs 1.9.x in the path.

Reproduction

image
image
image

In order to allow us to quickly reproduce you issue please include a link to a reproduction repository

System information

VSTS or TFS:

  • VSTS
  • TFS

Agent:

  • Hosted
  • Custom

OS:

  • Windows
  • Mac
  • Linux

Yarn version: 1.9.4
*Yarn version**1.9.4

Node version:
Node version*

It seems that you have some version already in the path or you have some corrupted files in your cache. I'd advise that you clean the tool cache and make sure you don't have another version of yarn installed globally

For reference here is the log I get on a windows agent:

2018-10-12T02:48:24.0101589Z ==============================================================================
2018-10-12T02:48:24.0101742Z Task         : Yarn Tool Installer (Development)
2018-10-12T02:48:24.0102033Z Description  : Installs a version of Yarn
2018-10-12T02:48:24.0102134Z Version      : 2.5.1003
2018-10-12T02:48:24.0102245Z Author       : Geek Learning
2018-10-12T02:48:24.0102363Z Help         : [More Information](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn) (Version 2.5.1003)
2018-10-12T02:48:24.0102539Z ==============================================================================
2018-10-12T02:48:24.2796247Z ##[debug]agent.TempDirectory=F:\VSTS-Agent-GL-1\_work\_temp
2018-10-12T02:48:24.2804678Z ##[debug]loading inputs and endpoints
2018-10-12T02:48:24.2810610Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2018-10-12T02:48:24.2821604Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2018-10-12T02:48:24.2824382Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2018-10-12T02:48:24.2826177Z ##[debug]loading INPUT_CHECKLATEST
2018-10-12T02:48:24.2828036Z ##[debug]loading INPUT_INCLUDEPRERELEASE
2018-10-12T02:48:24.2830635Z ##[debug]loading INPUT_VERSIONSPEC
2018-10-12T02:48:24.2835098Z ##[debug]loaded 6
2018-10-12T02:48:24.2848998Z ##[debug]Agent.ProxyUrl=undefined
2018-10-12T02:48:24.2850271Z ##[debug]Agent.CAInfo=undefined
2018-10-12T02:48:24.2850502Z ##[debug]Agent.ClientCert=undefined
2018-10-12T02:48:24.3126792Z ##[debug]Agent.ProxyUrl=undefined
2018-10-12T02:48:24.3132970Z ##[debug]check path : F:\VSTS-Agent-GL-1\_work\_tasks\YarnInstaller_920f3027-2a07-4619-a8df-2ed5cc4eb791\2.5.1003\node_modules\vsts-task-tool-lib\lib.json
2018-10-12T02:48:24.3133304Z ##[debug]set resource file to: F:\VSTS-Agent-GL-1\_work\_tasks\YarnInstaller_920f3027-2a07-4619-a8df-2ed5cc4eb791\2.5.1003\node_modules\vsts-task-tool-lib\lib.json
2018-10-12T02:48:24.3133598Z ##[debug]system.culture=en-US
2018-10-12T02:48:24.3795006Z ##[debug]Agent.BuildDirectory=F:\VSTS-Agent-GL-1\_work\54
2018-10-12T02:48:24.3797701Z ##[debug]testing directory 'F:\VSTS-Agent-GL-1\_work\54\yarn'
2018-10-12T02:48:24.3799305Z ##[debug]testing directory 'F:\VSTS-Agent-GL-1\_work\54'
2018-10-12T02:48:24.3800834Z ##[debug]mkdir 'F:\VSTS-Agent-GL-1\_work\54\yarn'
2018-10-12T02:48:24.3821555Z ##[debug]versionSpec=1.9.x
2018-10-12T02:48:24.3824234Z ##[debug]checkLatest=true
2018-10-12T02:48:24.3830983Z ##[debug]includePrerelease=true
2018-10-12T02:48:24.3837668Z ##[debug]isExplicit: null
2018-10-12T02:48:24.3838210Z ##[debug]explicit? false
2018-10-12T02:48:24.3838795Z ##[debug]isExplicit: null
2018-10-12T02:48:24.3839069Z ##[debug]explicit? false
2018-10-12T02:48:24.4735435Z ##[debug]evaluating 103 versions
2018-10-12T02:48:24.4881794Z ##[debug]matched: v1.9.4
2018-10-12T02:48:24.4888726Z ##[debug]Matched version: v1.9.4
2018-10-12T02:48:24.4890517Z ##[debug]isExplicit: 1.9.4
2018-10-12T02:48:24.4891157Z ##[debug]explicit? true
2018-10-12T02:48:24.4893114Z ##[debug]Agent.Version=2.131.0
2018-10-12T02:48:24.4893416Z ##[debug]Agent.ToolsDirectory=F:\VSTS-Agent-GL-1\_work\_tool
2018-10-12T02:48:24.4893652Z ##[debug]checking cache: F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64
2018-10-12T02:48:24.4894788Z ##[debug]not found
2018-10-12T02:48:24.4895048Z ##[debug]Downloading tarball: https://github.com/yarnpkg/yarn/releases/download/v1.9.4/yarn-v1.9.4.tar.gz
2018-10-12T02:48:24.4897709Z ##[debug]cleaning: v1.9.4
2018-10-12T02:48:24.4898004Z ##[debug]Agent.BuildDirectory=F:\VSTS-Agent-GL-1\_work\54
2018-10-12T02:48:25.7470648Z ##[debug]Agent.BuildDirectory=F:\VSTS-Agent-GL-1\_work\54
2018-10-12T02:48:26.2654905Z Caching tool: yarn 1.9.4 x64
2018-10-12T02:48:26.2655398Z ##[debug]source dir: F:\VSTS-Agent-GL-1\_work\54\yarn\output
2018-10-12T02:48:26.2656930Z ##[debug]Agent.Version=2.131.0
2018-10-12T02:48:26.2657210Z ##[debug]Agent.ToolsDirectory=F:\VSTS-Agent-GL-1\_work\_tool
2018-10-12T02:48:26.2657456Z ##[debug]destination F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64
2018-10-12T02:48:26.2659552Z ##[debug]rm -rf F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64
2018-10-12T02:48:26.2660893Z ##[debug]rm -rf F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64.complete
2018-10-12T02:48:26.2661805Z ##[debug]testing directory 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64'
2018-10-12T02:48:26.2662845Z ##[debug]testing directory 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4'
2018-10-12T02:48:26.2664537Z ##[debug]testing directory 'F:\VSTS-Agent-GL-1\_work\_tool\yarn'
2018-10-12T02:48:26.2665386Z ##[debug]mkdir 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4'
2018-10-12T02:48:26.2666752Z ##[debug]mkdir 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64'
2018-10-12T02:48:26.6626379Z ##[debug]Agent.Version=2.131.0
2018-10-12T02:48:26.6626832Z ##[debug]Agent.ToolsDirectory=F:\VSTS-Agent-GL-1\_work\_tool
2018-10-12T02:48:26.6630209Z ##[debug]finished caching tool
2018-10-12T02:48:26.6632559Z ##[debug]Agent.Version=2.131.0
2018-10-12T02:48:26.6634560Z Prepending PATH environment variable with directory: F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64
2018-10-12T02:48:26.6636709Z ##[debug]new Path: F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64;F:\VSTS-Agent-GL-1\externals\git\cmd;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Gradle\bin;C:\Program Files\NuGet;C:\Program Files (x86)\Java\jdk1.8.0_131\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy;C:\ProgramData\chocolatey\bin;C:\Users\GlBuildUser1\AppData\Local\Microsoft\WindowsApps;C:\Users\GlBuildUser1\AppData\Roaming\npm;C:\Users\GlBuildUser1\.dotnet\tools
2018-10-12T02:48:26.6644829Z ##[debug]Processed: ##vso[task.prependpath]F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64
2018-10-12T02:48:26.6645272Z ##[debug]defaultRoot: 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64'
2018-10-12T02:48:26.6645522Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2018-10-12T02:48:26.6645723Z ##[debug]findOptions.followSymbolicLinks: 'true'
2018-10-12T02:48:26.6646824Z ##[debug]matchOptions.debug: 'false'
2018-10-12T02:48:26.6647034Z ##[debug]matchOptions.nobrace: 'true'
2018-10-12T02:48:26.6647259Z ##[debug]matchOptions.noglobstar: 'false'
2018-10-12T02:48:26.6647442Z ##[debug]matchOptions.dot: 'true'
2018-10-12T02:48:26.6647638Z ##[debug]matchOptions.noext: 'false'
2018-10-12T02:48:26.6647819Z ##[debug]matchOptions.nocase: 'true'
2018-10-12T02:48:26.6648048Z ##[debug]matchOptions.nonull: 'false'
2018-10-12T02:48:26.6648608Z ##[debug]matchOptions.matchBase: 'false'
2018-10-12T02:48:26.6648876Z ##[debug]matchOptions.nocomment: 'false'
2018-10-12T02:48:26.6649068Z ##[debug]matchOptions.nonegate: 'false'
2018-10-12T02:48:26.6649278Z ##[debug]matchOptions.flipNegate: 'false'
2018-10-12T02:48:26.6651298Z ##[debug]pattern: '**/bin/yarn.cmd'
2018-10-12T02:48:26.6680385Z ##[debug]findPath: 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64'
2018-10-12T02:48:26.6680653Z ##[debug]statOnly: 'false'
2018-10-12T02:48:26.6683337Z ##[debug]findPath: 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64'
2018-10-12T02:48:26.6683560Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2018-10-12T02:48:26.6683990Z ##[debug]findOptions.followSymbolicLinks: 'true'
2018-10-12T02:48:26.6687923Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64 (directory)
2018-10-12T02:48:26.6696578Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4 (directory)
2018-10-12T02:48:26.6703225Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin (directory)
2018-10-12T02:48:26.6707941Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarn (file)
2018-10-12T02:48:26.6711152Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarn.cmd (file)
2018-10-12T02:48:26.6711453Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarn.js (file)
2018-10-12T02:48:26.6712345Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarnpkg (file)
2018-10-12T02:48:26.6714988Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarnpkg.cmd (file)
2018-10-12T02:48:26.6715841Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\lib (directory)
2018-10-12T02:48:26.6720896Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\lib\cli.js (file)
2018-10-12T02:48:26.6721351Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\lib\v8-compile-cache.js (file)
2018-10-12T02:48:26.6722182Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\LICENSE (file)
2018-10-12T02:48:26.6722741Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\package.json (file)
2018-10-12T02:48:26.6723437Z ##[debug]  F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\README.md (file)
2018-10-12T02:48:26.6723659Z ##[debug]14 results
2018-10-12T02:48:26.6723857Z ##[debug]found 14 paths
2018-10-12T02:48:26.6724044Z ##[debug]applying include pattern
2018-10-12T02:48:26.6724269Z ##[debug]adjustedPattern: 'F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\**/bin/yarn.cmd'
2018-10-12T02:48:26.6743902Z ##[debug]1 matches
2018-10-12T02:48:26.6745420Z ##[debug]1 final results
2018-10-12T02:48:26.6745769Z ##[debug]Agent.Version=2.131.0
2018-10-12T02:48:26.6747522Z Prepending PATH environment variable with directory: F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin
2018-10-12T02:48:26.6748556Z ##[debug]new Path: F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin;F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64;F:\VSTS-Agent-GL-1\externals\git\cmd;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Gradle\bin;C:\Program Files\NuGet;C:\Program Files (x86)\Java\jdk1.8.0_131\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy;C:\ProgramData\chocolatey\bin;C:\Users\GlBuildUser1\AppData\Local\Microsoft\WindowsApps;C:\Users\GlBuildUser1\AppData\Roaming\npm;C:\Users\GlBuildUser1\.dotnet\tools
2018-10-12T02:48:26.6754652Z ##[debug]Processed: ##vso[task.prependpath]F:\VSTS-Agent-GL-1\_work\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin
2018-10-12T02:48:26.6844188Z ##[section]Finishing: Use Yarn 1.9.x
2018-10-12T02:48:26.6926803Z ##[debug]Evaluating condition for step: 'No custom package no npmrc'
2018-10-12T02:48:26.6927471Z ##[debug]Evaluating: succeeded()
2018-10-12T02:48:26.6927636Z ##[debug]Evaluating succeeded:
2018-10-12T02:48:26.6928040Z ##[debug]=> (Boolean) True
2018-10-12T02:48:26.6928863Z ##[debug]Expanded: True
2018-10-12T02:48:26.6929071Z ##[debug]Result: True
2018-10-12T02:48:26.6929328Z ##[section]Starting: No custom package no npmrc

same issue here. guess it somehow mixes up the versions to be downloaded and puts old versions in a subfolder in a newer version parent folder.

@OneCyrus did cleaning the cache manually solve the issue for you?

yes, after removing the yarn folder from the _tools folder, yarn installer downloaded only the latest version and it worked again.

Thanks, for trying this. I think I've found the root cause the trouble, the detar folder was never cleaned. I'll publish the update soon so it should not happen anymore.

3f6e06a