Guest User

Untitled

a guest
Aug 7th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. variables:
  2. DEPLOY_ENV: "staging"
  3. NODE_IMAGE: node:12.13.0-alpine
  4.  
  5. image: $NODE_IMAGE
  6.  
  7. stages:
  8. - install_modules
  9. - build_and_test
  10. - build_docker
  11. - deploy
  12.  
  13. .cache:
  14. cache:
  15. key:
  16. files:
  17. - package.json
  18. - yarn.lock
  19. paths:
  20. - node_modules/
  21. - npm-packages-offline-cache/
  22.  
  23. install_modules:
  24. extends: .cache
  25. stage: install_modules
  26. script:
  27. - yarn config set yarn-offline-mirror $PWD/npm-packages-offline-cache
  28. - yarn config set install.prefer-offline true
  29. - yarn
  30.  
  31. install_prod_modules:
  32. extends: .cache
  33. stage: install_modules
  34. artifacts:
  35. paths:
  36. - node_modules_prod/
  37. expire_in: 30 mins
  38. script:
  39. - yarn install --production --modules-folder node_modules_prod/
  40. cache:
  41. policy: pull
  42.  
  43. .build_node:
  44. extends: .cache
  45. needs:
  46. - install_prod_modules
  47. - install_modules
  48. script:
  49. - yarn run build
  50. artifacts:
  51. paths:
  52. - node_modules_prod/
  53. - build/
  54. expire_in: 30 mins
  55. cache:
  56. policy: pull
  57.  
  58. build-stage:
  59. stage: build_and_test
  60. extends: .build_node
  61. variables:
  62. DEPLOY_ENV: "staging"
  63. except:
  64. - master
  65. - tags
  66.  
  67. build-prod:
  68. stage: build_and_test
  69. extends: .build_node
  70. variables:
  71. DEPLOY_ENV: "production"
  72. only:
  73. - master
  74. - tags
  75.  
  76. lint:
  77. extends: .cache
  78. needs:
  79. - install_modules
  80. stage: build_and_test
  81. allow_failure: true
  82. script:
  83. - yarn lint
  84. cache:
  85. policy: pull
  86.  
  87. test:
  88. extends: .cache
  89. needs:
  90. - install_modules
  91. stage: build_and_test
  92. allow_failure: true
  93. script:
  94. - yarn test -w 2
  95. cache:
  96. policy: pull
  97.  
  98. build-docker:
  99. stage: build_docker
  100. image: docker:19.03.11
  101. variables:
  102. ...
  103. before_script:
  104. - docker info
  105. - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  106. ...
  107. tags:
  108. - docker-socket
  109.  
  110. .deploy-kubernetes:
  111. stage: deploy
  112. image: dtzar/helm-kubectl:3.2.1
  113. dependencies: []
  114. needs:
  115. - build-docker
  116. variables:
  117. ...
  118. before_script:
  119. - export KUBECONFIG=$K8S_STAGING_CONF
  120. script:
  121. ...
  122.  
  123. deploy-branch:
  124. extends: .deploy-kubernetes
  125. environment:
  126. ...
  127. before_script:
  128. - ls -la
  129. - apk add --update --no-cache bash curl unzip
  130. - curl -s https://rclone.org/install.sh | bash &> /dev/null
  131. - rclone --config ${RCLONE_CONFIG} copy ./build/ ${SELECTEL_CLOUD}/
  132. variables:
  133. ...
  134. when: manual
  135.  
  136. deploy-staging:
  137. extends: .deploy-kubernetes
  138. environment:
  139. ...
  140. variables:
  141. ...
  142. only:
  143. - develop
  144. - release/*
  145.  
  146. deploy-production:
  147. extends: .deploy-kubernetes
  148. variables:
  149. ...
  150. environment:
  151. ...
  152. before_script:
  153. - export KUBECONFIG=$K8S_PRODUCTION_CONF
  154. only:
  155. - master
  156. - tags
  157. when: manual
  158.  
  159. check-build:
  160. stage: deploy
  161. before_script:
  162. - cat /etc/os-release && ls -la
  163. script:
  164. - echo test
Add Comment
Please, Sign In to add comment