Baphomet is the dedicated bot for nulloctet matrix
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

253 lines
7.5 KiB

5 years ago
5 years ago
  1. ---
  2. resource_types:
  3. - name: helm
  4. type: docker-image
  5. source:
  6. repository: linkyard/concourse-helm-resource
  7. - name: matrix-notification-resource
  8. type: docker-image
  9. source:
  10. repository: freelock/matrix-notification-resource
  11. resources:
  12. - name: git-develop
  13. type: git
  14. icon: git
  15. source:
  16. uri: ssh://git@git.nulloctet.com:8437/warricksothr/baphomet-js.git
  17. private_key: |
  18. ((pull_key))
  19. branch: develop
  20. ignore_paths:
  21. - scripts/upload_pipeline.sh
  22. - README.md
  23. - CONTRIBUTING.md
  24. - LICENSE.md
  25. - name: git-master
  26. type: git
  27. icon: git
  28. source:
  29. uri: ssh://git@git.nulloctet.com:8437/warricksothr/baphomet-js.git
  30. private_key: |
  31. ((pull_key))
  32. branch: master
  33. ignore_paths:
  34. - scripts/upload_pipeline.sh
  35. - README.md
  36. - CONTRIBUTING.md
  37. - LICENSE.md
  38. - name: docker-image
  39. type: docker-image
  40. icon: docker
  41. source:
  42. repository: ((nexus_docker_write.host))/nulloctet/baphomet-js
  43. username: ((nexus_docker_write.username))
  44. password: ((nexus_docker_write.password))
  45. - name: helm
  46. type: helm
  47. source:
  48. cluster_url: ((helm.cluster_url))
  49. cluster_ca: ((helm.cluster_ca))
  50. token: ((helm.token))
  51. - name: matrix-notification
  52. type: matrix-notification-resource
  53. source:
  54. matrix_server_url: (( matrix.url ))
  55. token: (( matrix.token ))
  56. room_id: (( matrix.room_id ))
  57. jobs:
  58. # Development Pipeline
  59. - name: test-develop
  60. plan:
  61. - get: git-develop
  62. trigger: true
  63. - task: run-tests
  64. config:
  65. platform: linux
  66. image_resource:
  67. type: registry-image
  68. source: { repository: node, tag: "12.14-stretch" }
  69. inputs:
  70. - name: git-develop
  71. run:
  72. path: /bin/sh
  73. args:
  74. - -c
  75. - |
  76. echo "Node Version: $(node --version)"
  77. echo "NPM Version: $(npm --version)"
  78. cd git-develop
  79. npm install
  80. npm test
  81. - name: deploy-develop-image
  82. plan:
  83. - get: git-develop
  84. passed: [test-develop]
  85. trigger: true
  86. - task: capture-version
  87. config:
  88. platform: linux
  89. image_resource:
  90. type: registry-image
  91. source: { repository: bitnami/git, tag: "2-debian-9" }
  92. inputs:
  93. - name: git-develop
  94. outputs:
  95. - name: version
  96. run:
  97. path: /bin/sh
  98. args:
  99. - -c
  100. - |
  101. cd git-develop
  102. chmod +x ././scripts/get_*.sh
  103. echo $(./scripts/get_build.sh) > ../version/build.info
  104. echo $(./scripts/get_version.sh) > ../version/version.info
  105. echo $(./scripts/get_tag.sh) > ../version/tag.info
  106. echo "dev" > ../version/tag
  107. echo "Build Information: $(cat ../version/build.info)"
  108. echo "Version Information: $(cat ../version/version.info)"
  109. echo "Tag Information: $(cat ../version/tag.info)"
  110. echo "Docker Image Tag: $(cat ../version/tag)"
  111. - task: package
  112. config:
  113. platform: linux
  114. image_resource:
  115. type: registry-image
  116. source: { repository: debian, tag: "stretch-slim" }
  117. inputs:
  118. - name: git-develop
  119. - name: version
  120. outputs:
  121. - name: package
  122. run:
  123. path: /bin/sh
  124. args:
  125. - -c
  126. - |
  127. cd package
  128. cp ../version/* .
  129. cp ../git-develop/package*.json .
  130. cp ../git-develop/tsconfig.json .
  131. cp ../git-develop/index.js .
  132. cp -r ../git-develop/assets .
  133. cp -r ../git-develop/src .
  134. cp -r ../git-develop/data .
  135. cp ../git-develop/entrypoint.sh .
  136. cp ../git-develop/Dockerfile .
  137. cp ../git-develop/README.md .
  138. cp ../git-develop/LICENSE.md .
  139. ls -al .
  140. - put: docker-image
  141. params:
  142. build: package
  143. tag_file: package/tag
  144. tag_as_latest: false
  145. - name: deploy-develop-helm
  146. plan:
  147. - get: git-develop
  148. passed: [deploy-develop-image]
  149. trigger: true
  150. - put: helm
  151. params:
  152. chart: git-develop/.helm
  153. values: git-develop/.helm/values.yaml
  154. release: baphomet-js-dev
  155. override_values:
  156. - key: image.tag
  157. value: dev
  158. - key: image.pullPolicy
  159. value: Always
  160. - key: app.env.node_env
  161. value: development
  162. - key: persistence.storageClass
  163. value: microk8s-hostpath
  164. recreate_pods: true
  165. # Release Pipeline
  166. - name: test-release
  167. plan:
  168. - get: git-master
  169. trigger: true
  170. - task: run-tests
  171. config:
  172. platform: linux
  173. image_resource:
  174. type: registry-image
  175. source: { repository: node, tag: "12.14-stretch" }
  176. inputs:
  177. - name: git-master
  178. run:
  179. path: /bin/sh
  180. args:
  181. - -c
  182. - |
  183. echo "Node Version: $(node --version)"
  184. echo "NPM Version: $(npm --version)"
  185. cd git-master
  186. npm install
  187. npm test
  188. - name: deploy-release-image
  189. plan:
  190. - get: git-master
  191. passed: [test-release]
  192. trigger: true
  193. - task: capture-version
  194. config:
  195. platform: linux
  196. image_resource:
  197. type: registry-image
  198. source: { repository: bitnami/git, tag: "2-debian-9" }
  199. inputs:
  200. - name: git-master
  201. outputs:
  202. - name: version
  203. run:
  204. path: /bin/sh
  205. args:
  206. - -c
  207. - |
  208. cd git-master
  209. chmod +x ././scripts/get_*.sh
  210. echo $(./scripts/get_build.sh) > ../version/build.info
  211. echo $(./scripts/get_version.sh) > ../version/version.info
  212. echo $(./scripts/get_tag.sh) > ../version/tag.info
  213. cp ../version/tag.info ../version/tag
  214. echo "Build Information: $(cat ../version/build.info)"
  215. echo "Version Information: $(cat ../version/version.info)"
  216. echo "Tag Information: $(cat ../version/tag.info)"
  217. echo "Docker Image Tag: $(cat ../version/tag)"
  218. - task: package
  219. config:
  220. platform: linux
  221. image_resource:
  222. type: registry-image
  223. source: { repository: debian, tag: "stretch-slim" }
  224. inputs:
  225. - name: git-master
  226. - name: version
  227. outputs:
  228. - name: package
  229. run:
  230. path: /bin/sh
  231. args:
  232. - -c
  233. - |
  234. cd package
  235. cp ../version/* .
  236. cp ../git-master/package*.json .
  237. cp ../git-master/tsconfig.json .
  238. cp ../git-master/index.js .
  239. cp -r ../git-master/assets .
  240. cp -r ../git-master/src .
  241. cp -r ../git-master/data .
  242. cp ../git-master/entrypoint.sh .
  243. cp ../git-master/Dockerfile .
  244. cp ../git-master/README.md .
  245. cp ../git-master/LICENSE.md .
  246. ls -al .
  247. - put: docker-image
  248. params:
  249. build: package
  250. tag_file: package/tag
  251. tag_as_latest: true