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

Document how to use the plugin with Azure Pipelines defined in Yaml

tomasaschan opened this issue · comments

Since VSTS became Azure DevOps and launched the azure-pipeline.yml option for configuring builds and releases, there are multiple ways to use this task - you can either configure it with the web GUI, or in a yaml file in your repository. However, I can't find any documentation on the Yaml schema to use.

It probably comes down to something like

- task: Yarn@<version>
  <options here>

but it would be nice to have a reference spec for names of available options, their default values etc. One can look e.g. at the top of https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/node-js?view=vsts for inspiration.

steps:
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
  displayName: 'Yarn '
  inputs:
    ProductionMode: true

Here's a sample I got from clicking Show YAML from Azure's pipeline designer tool.

You can see any build yaml equivalent : http://www.codewrecks.com/blog/index.php/2017/12/14/converting-regular-build-in-yaml-build/

Here are some samples:

pool:
  name: Hosted VS2017
steps:
- task: geeklearningio.gl-vsts-tasks-yarn-dev.yarn-installer-task.YarnInstaller@3
  displayName: 'Use Yarn 1.10.x'
  inputs:
    versionSpec: 1.10.x
    checkLatest: true
    includePrerelease: true

- task: geeklearningio.gl-vsts-tasks-yarn-dev.yarn-task.Yarn@3
  displayName: 'No custom package no npmrc'
  inputs:
    projectDirectory: src/YarnNoNpmRc

- task: geeklearningio.gl-vsts-tasks-yarn-dev.yarn-task.Yarn@3
  displayName: 'No custom package but .npmrc'
  inputs:
    projectDirectory: src/YarnNpmRc
  condition: succeededOrFailed()

- task: geeklearningio.gl-vsts-tasks-yarn-dev.yarn-task.Yarn@3
  displayName: 'Custom Package in Custom Feed Directly Specified'
  inputs:
    projectDirectory: src/YarnCustomPackageNoNpmRc
    customRegistry: useFeed
    customFeed: '00000000-0000-0000-0000-000000000000'
  condition: succeededOrFailed()

- task: geeklearningio.gl-vsts-tasks-yarn-dev.yarn-task.Yarn@3
  displayName: 'Custom Package in Custom Feed npmrc'
  inputs:
    projectDirectory: src/YarnCustomPackageNpmRc
  condition: succeededOrFailed()

- task: geeklearningio.gl-vsts-tasks-yarn-dev.yarn-task.Yarn@3
  displayName: 'Yarn licenses generate-disclaimer'
  inputs:
    projectDirectory: src/YarnCustomPackageNoNpmRc
    customRegistry: useFeed
    customFeed: '00000000-0000-0000-0000-000000000000'

Just letting you know that 3.0 will have a breaking changes as all Arguments have been rename to camlCase.

I've also added some examples to the docs.

commented

I followed this discussion but did not see a resolution (neither in the docs nor in this thread) so... how does one specify in YAML that one needs YARN installed? I find it hard to believe that the tasks is called geeklearningio.gl-vsts-tasks-yarn-dev.yarn-installer-task.YarnInstaller@3...

@cawoodm arf indeed this is our internal test extension. the correct name should be:
geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
also there's now a shorthand syntax, you can use just the last bit YarnInstaller@3.

If in doubt you can use the assistant from Azure Devops:
image

commented

Great thanks!