You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

codefresh.md 1.7 kB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {% comment %}
  2. Empty line. Do not remove.
  3. {% endcomment %}
  4. [Codefresh pipelines](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/introduction-to-codefresh-pipelines/) use Docker images in all their steps so it is very easy to use any [Yarn version](https://hub.docker.com/_/node/) in any pipeline.
  5. This pipeline [checks out](https://codefresh.io/docs/docs/codefresh-yaml/steps/git-clone/) the source code and then runs `yarn` with two [freestyle steps](https://codefresh.io/docs/docs/codefresh-yaml/steps/freestyle/).
  6. `codefresh.yml`
  7. ```yml
  8. version: '1.0'
  9. stages:
  10. - prepare
  11. - test
  12. - build
  13. steps:
  14. main_clone:
  15. title: Cloning main repository...
  16. stage: prepare
  17. type: git-clone
  18. repo: 'codefresh-contrib/react-sample-app'
  19. revision: master
  20. git: github
  21. MyUnitTests:
  22. title: Unit test
  23. stage: test
  24. image: node:11.0
  25. commands:
  26. - yarn install
  27. - yarn test
  28. environment:
  29. - CI=true
  30. MyReactBuild:
  31. title: Packaging application
  32. stage: build
  33. image: node:8.16
  34. commands:
  35. - yarn build
  36. ```
  37. Notice that it is possible to use any version of node/yarn that exists in [Dockerhub](https://hub.docker.com/_/node/?tab=tags). 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.
  38. There is no need for any special caching directives as Codefresh automatically caches the current workdir with all its folders (such as `node_modules`).
  39. For more details see [a complete pipeline with Yarn](https://codefresh.io/docs/docs/learn-by-example/nodejs/react/).

js yarn包管理组件依赖分析

Contributors (1)