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.

282 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_docker_read.host))/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. get_params: {skip_download: true}
  158. - put: matrix-notification
  159. params:
  160. msgtype: m.notice
  161. text: |
  162. Successfully deployed baphomet-js-dev image to repository
  163. - name: deploy-develop-helm
  164. plan:
  165. - get: git-develop
  166. passed: [deploy-develop-image]
  167. trigger: true
  168. - put: helm
  169. params:
  170. chart: git-develop/.helm
  171. values: git-develop/.helm/values.yaml
  172. release: baphomet-js-dev
  173. override_values:
  174. - key: image.tag
  175. value: dev
  176. - key: image.pullPolicy
  177. value: Always
  178. - key: app.env.node_env
  179. value: development
  180. - key: persistence.storageClass
  181. value: microk8s-hostpath
  182. recreate_pods: true
  183. # Release Pipeline
  184. - name: test-release
  185. plan:
  186. - get: git-master
  187. trigger: true
  188. - task: run-tests
  189. config:
  190. platform: linux
  191. image_resource:
  192. type: registry-image
  193. source: { repository: node, tag: "12.14-stretch" }
  194. inputs:
  195. - name: git-master
  196. run:
  197. path: /bin/sh
  198. args:
  199. - -c
  200. - |
  201. echo "Node Version: $(node --version)"
  202. echo "NPM Version: $(npm --version)"
  203. cd git-master
  204. npm install
  205. npm test
  206. on_failure:
  207. do:
  208. - put: matrix-notification
  209. params:
  210. msgtype: m.notice
  211. text: |
  212. A test of baphomet-js has failed. Check it out at:
  213. https://concourse.nulloctet.com/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
  214. or at:
  215. https://concourse.nulloctet.com/builds/$BUILD_ID
  216. - name: deploy-release-image
  217. plan:
  218. - get: git-master
  219. passed: [test-release]
  220. trigger: true
  221. - task: capture-version
  222. config:
  223. platform: linux
  224. image_resource:
  225. type: registry-image
  226. source: { repository: bitnami/git, tag: "2-debian-9" }
  227. inputs:
  228. - name: git-master
  229. outputs:
  230. - name: version
  231. run:
  232. path: /bin/sh
  233. args:
  234. - -c
  235. - |
  236. cd git-master
  237. chmod +x ././scripts/get_*.sh
  238. echo $(./scripts/get_build.sh) > ../version/build.info
  239. echo $(./scripts/get_version.sh) > ../version/version.info
  240. echo $(./scripts/get_tag.sh) > ../version/tag.info
  241. cp ../version/tag.info ../version/tag
  242. echo "Build Information: $(cat ../version/build.info)"
  243. echo "Version Information: $(cat ../version/version.info)"
  244. echo "Tag Information: $(cat ../version/tag.info)"
  245. echo "Docker Image Tag: $(cat ../version/tag)"
  246. - task: package
  247. config:
  248. platform: linux
  249. image_resource:
  250. type: registry-image
  251. source: { repository: debian, tag: "stretch-slim" }
  252. inputs:
  253. - name: git-master
  254. - name: version
  255. outputs:
  256. - name: package
  257. run:
  258. path: /bin/sh
  259. args:
  260. - -c
  261. - |
  262. cd package
  263. cp ../version/* .
  264. cp ../git-master/package*.json .
  265. cp ../git-master/tsconfig.json .
  266. cp ../git-master/index.js .
  267. cp -r ../git-master/assets .
  268. cp -r ../git-master/src .
  269. cp -r ../git-master/data .
  270. cp ../git-master/entrypoint.sh .
  271. cp ../git-master/Dockerfile .
  272. cp ../git-master/README.md .
  273. cp ../git-master/LICENSE.md .
  274. ls -al .
  275. - put: docker-image
  276. params:
  277. build: package
  278. tag_file: package/tag
  279. tag_as_latest: true
  280. get_params: {skip_download: true}