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.

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