geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions
MIT License
52 stars 18 forks source link

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

Closed tomasaschan closed 5 years ago

tomasaschan commented 5 years ago

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.

Sawtaytoes commented 5 years ago
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.

sandorfr commented 5 years ago

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'
sandorfr commented 5 years ago

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

sandorfr commented 5 years ago

I've also added some examples to the docs.

cawoodm commented 4 years ago

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...

sandorfr commented 4 years ago

@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

cawoodm commented 4 years ago

Great thanks!