Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.73 KB | None | 0 0
  1. ### Author: Peter
  2. ### Created: Visual Studio Code
  3. ### Title: Widget Composer SDK pipeline
  4.  
  5. ## Define the process
  6. jobs:
  7. - name: production-sdk
  8. build_logs_to_retain: 5
  9. serial: true
  10. plan:
  11.  
  12. ## Trigger slack alarm
  13. - put: notify
  14. params:
  15. alert_type: started
  16.  
  17. # ## Get Knowbly SDK
  18. - get: sdk
  19. passed: []
  20. trigger: false
  21.  
  22. ## Build the App
  23. - task: pack-npm
  24. config:
  25. platform: linux
  26. image_resource:
  27. type: docker-image
  28. source:
  29. repository: parboleda/node-knowbly
  30. inputs:
  31. - name: sdk
  32. run:
  33. path: sh
  34. args:
  35. - -exc
  36. - |
  37. apt-get update
  38. apt-get install zip
  39. apt-get install -y jq
  40. jq --version
  41. cd sdk
  42. echo ((credentials.backup))-sdk-$(jq -r .version package.json)
  43. zip -r ((credentials.backup))-sdk-$(jq -r .version package.json).zip ./
  44. cp ./((credentials.backup))-sdk-$(jq -r .version package.json).zip ../build-output
  45. ls ../build-output
  46. outputs:
  47. - name: build-output
  48.  
  49. ## Copy flags
  50. - task: copy-flags
  51. config:
  52. platform: linux
  53. image_resource:
  54. type: docker-image
  55. source:
  56. repository: parboleda/node-knowbly
  57. inputs:
  58. - name: sdk
  59. run:
  60. path: sh
  61. args:
  62. - -exc
  63. - |
  64. cd sdk
  65. cp ./config/devFlags.default.js ./config/devFlags.js
  66. cp -R ./ ../build-output-flags
  67. ls ../build-output-flags
  68. outputs:
  69. - name: build-output-flags
  70.  
  71.  
  72. # ## Push Knowbly SDK
  73. - put: deploy-to-PCF
  74. params:
  75. manifest: build-output-flags/prod-manifest.yml
  76. path: build-output-flags
  77. on_success:
  78. put: notify
  79. params:
  80. # var:
  81. # - name: GIT_MSG
  82. # file_value: sdk/.git/commit_message
  83. # - name: GIT_COM
  84. # file_value: sdk/.git/committer
  85. # - name: GIT_REF
  86. # file_value: sdk/.git/short_ref
  87. # message: This is my commit message of success and this the var @here
  88. alert_type: success
  89. on_failure:
  90. put: notify
  91. params:
  92. alert_type: failed
  93. on_abort:
  94. put: notify
  95. params:
  96. alert_type: aborted
  97.  
  98. ## Store current build on S3
  99. - put: release-backup
  100. params:
  101. path: build-output
  102. file: build-output/((credentials.backup))-sdk-*.zip
  103. # acl: public-read
  104.  
  105. ## Job rollback
  106. - name: rollback
  107. serial: true
  108. plan:
  109.  
  110. ## Get the zip from s3
  111. - get: release-backup
  112.  
  113. ## Trigger slack alarm
  114. - put: notify
  115. params:
  116. alert_type: started
  117.  
  118. ## Build the App
  119. - task: unpack-build
  120. config:
  121. platform: linux
  122. image_resource:
  123. type: docker-image
  124. source:
  125. repository: parboleda/node-knowbly
  126. inputs:
  127. - name: release-backup
  128. run:
  129. path: sh
  130. args:
  131. - -exc
  132. - |
  133. apt-get update
  134. apt-get install zip
  135. cd release-backup
  136. unzip ((credentials.backup))-sdk-*.zip
  137. rm ((credentials.backup))-sdk-*.zip
  138. cp -R ./ ../build-output
  139. ls ../build-output
  140. outputs:
  141. - name: build-output
  142.  
  143. - put: deploy-to-PCF
  144. params:
  145. manifest: build-output/prod-manifest.yml
  146. path: build-output
  147. on_success:
  148. put: notify
  149. params:
  150. alert_type: success
  151. on_failure:
  152. put: notify
  153. params:
  154. alert_type: failed
  155. on_abort:
  156. put: notify
  157. params:
  158. alert_type: aborted
  159.  
  160. ## Define Resource Types
  161. resource_types:
  162.  
  163. ## Slack Alerts
  164. - name: slack-alert
  165. type: docker-image
  166. source:
  167. repository: arbourd/concourse-slack-alert-resource
  168.  
  169. ## Define Resources
  170. resources:
  171.  
  172. ## Slack notification
  173. - name: notify
  174. type: slack-alert
  175. source:
  176. url: ((credentials.slack.webhook-url))
  177.  
  178. # CF auth credentials
  179. - name: deploy-to-PCF
  180. type: cf
  181. source:
  182. api: ((credentials.cf.api))
  183. organization: ((credentials.cf.organization))
  184. password: ((credentials.cf.user.pass))
  185. space: ((credentials.cf.space.prod))
  186. username: ((credentials.cf.user.name))
  187. skip_cert_check: false
  188.  
  189. ## Define git resources
  190.  
  191. ## Knowbly SDK
  192. - name: sdk
  193. type: git
  194. source:
  195. branch: ((credentials.git.branch.sdk))
  196. uri: ((credentials.git.uri.sdk))
  197. username: ((credentials.git.user.name))
  198. password: ((credentials.git.user.pass))
  199.  
  200. ## S3 Backup
  201. - name: release-backup
  202. type: s3
  203. source:
  204. bucket: ((credentials.aws.bucket))
  205. access_key_id: ((credentials.aws.access-key-id))
  206. secret_access_key: ((credentials.aws.secret-access-key))
  207. regexp: ((credentials.backup))-sdk-(.*).zip
  208. region_name: us-west-2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement