{% comment %}
Empty line. Do not remove.
{% endcomment %}
Codefresh pipelines use Docker images in all their steps so it is very easy to use any Yarn version in any pipeline.
This pipeline checks out the source code and then runs yarn
with two freestyle steps.
codefresh.yml
version: '1.0'
stages:
- prepare
- test
- build
steps:
main_clone:
title: Cloning main repository...
stage: prepare
type: git-clone
repo: 'codefresh-contrib/react-sample-app'
revision: master
git: github
MyUnitTests:
title: Unit test
stage: test
image: node:11.0
commands:
- yarn install
- yarn test
environment:
- CI=true
MyReactBuild:
title: Packaging application
stage: build
image: node:8.16
commands:
- yarn build
Notice that it is possible to use any version of node/yarn that exists in Dockerhub. In this case we use version 11 for running tests and version 8.6 for packaging the application. You can also use any private docker image that includes yarn
and any other tools you need in your pipeline.
There is no need for any special caching directives as Codefresh automatically caches the current workdir with all its folders (such as node_modules
).
For more details see a complete pipeline with Yarn.