shipit-engine 0.32.0 → 0.35.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (235) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -2
  3. data/app/assets/images/magic-solid.svg +1 -0
  4. data/app/assets/javascripts/shipit/repositories_search.js.coffee +60 -0
  5. data/app/assets/javascripts/shipit/{search.js.coffee → stack_search.js.coffee} +0 -0
  6. data/app/assets/stylesheets/_pages/_deploy.scss +2 -3
  7. data/app/assets/stylesheets/_pages/_repositories.scss +148 -0
  8. data/app/assets/stylesheets/_pages/_stacks.scss +19 -0
  9. data/app/assets/stylesheets/shipit.scss +1 -0
  10. data/app/controllers/shipit/api/ccmenu_controller.rb +1 -1
  11. data/app/controllers/shipit/api/deploys_controller.rb +2 -0
  12. data/app/controllers/shipit/api/{pull_requests_controller.rb → merge_requests_controller.rb} +8 -8
  13. data/app/controllers/shipit/api/rollbacks_controller.rb +2 -1
  14. data/app/controllers/shipit/api/stacks_controller.rb +15 -1
  15. data/app/controllers/shipit/deploys_controller.rb +1 -1
  16. data/app/controllers/shipit/merge_requests_controller.rb +31 -0
  17. data/app/controllers/shipit/merge_status_controller.rb +15 -15
  18. data/app/controllers/shipit/repositories_controller.rb +74 -0
  19. data/app/controllers/shipit/stacks_controller.rb +2 -2
  20. data/app/controllers/shipit/tasks_controller.rb +2 -2
  21. data/app/controllers/shipit/webhooks_controller.rb +23 -4
  22. data/app/helpers/shipit/chunks_helper.rb +2 -2
  23. data/app/helpers/shipit/github_url_helper.rb +8 -0
  24. data/app/helpers/shipit/shipit_helper.rb +0 -1
  25. data/app/helpers/shipit/stacks_helper.rb +4 -0
  26. data/app/jobs/shipit/create_on_github_job.rb +1 -0
  27. data/app/jobs/shipit/deliver_hook_job.rb +1 -1
  28. data/app/jobs/shipit/destroy_repository_job.rb +24 -0
  29. data/app/jobs/shipit/destroy_stack_job.rb +2 -2
  30. data/app/jobs/shipit/github_sync_job.rb +13 -9
  31. data/app/jobs/shipit/perform_task_job.rb +4 -98
  32. data/app/jobs/shipit/process_merge_requests_job.rb +32 -0
  33. data/app/jobs/shipit/refresh_merge_request_job.rb +11 -0
  34. data/app/jobs/shipit/update_github_last_deployed_ref_job.rb +1 -1
  35. data/app/models/shipit/anonymous_user.rb +10 -2
  36. data/app/models/shipit/check_run.rb +38 -2
  37. data/app/models/shipit/command_line_user.rb +4 -0
  38. data/app/models/shipit/commit.rb +31 -20
  39. data/app/models/shipit/commit_checks.rb +14 -13
  40. data/app/models/shipit/commit_deployment.rb +3 -3
  41. data/app/models/shipit/commit_deployment_status.rb +3 -3
  42. data/app/models/shipit/deploy.rb +17 -11
  43. data/app/models/shipit/deploy_spec/file_system.rb +11 -5
  44. data/app/models/shipit/deploy_spec/lerna_discovery.rb +12 -4
  45. data/app/models/shipit/deploy_spec.rb +16 -4
  46. data/app/models/shipit/duration.rb +2 -0
  47. data/app/models/shipit/hook.rb +28 -2
  48. data/app/models/shipit/merge_request.rb +304 -0
  49. data/app/models/shipit/provisioning_handler/base.rb +30 -0
  50. data/app/models/shipit/provisioning_handler/unregistered_provisioning_handler.rb +35 -0
  51. data/app/models/shipit/provisioning_handler.rb +32 -0
  52. data/app/models/shipit/pull_request.rb +26 -265
  53. data/app/models/shipit/pull_request_assignment.rb +10 -0
  54. data/app/models/shipit/release_status.rb +1 -1
  55. data/app/models/shipit/repository.rb +63 -3
  56. data/app/models/shipit/review_stack.rb +130 -0
  57. data/app/models/shipit/review_stack_provisioning_queue.rb +39 -0
  58. data/app/models/shipit/rollback.rb +5 -0
  59. data/app/models/shipit/stack.rb +78 -30
  60. data/app/models/shipit/status/group.rb +1 -1
  61. data/app/models/shipit/task.rb +62 -9
  62. data/app/models/shipit/task_execution_strategy/base.rb +20 -0
  63. data/app/models/shipit/task_execution_strategy/default.rb +109 -0
  64. data/app/models/shipit/team.rb +4 -2
  65. data/app/models/shipit/user.rb +10 -1
  66. data/app/models/shipit/webhooks/handlers/pull_request/assigned_handler.rb +74 -0
  67. data/app/models/shipit/webhooks/handlers/pull_request/closed_handler.rb +68 -0
  68. data/app/models/shipit/webhooks/handlers/pull_request/edited_handler.rb +74 -0
  69. data/app/models/shipit/webhooks/handlers/pull_request/label_capturing_handler.rb +127 -0
  70. data/app/models/shipit/webhooks/handlers/pull_request/labeled_handler.rb +106 -0
  71. data/app/models/shipit/webhooks/handlers/pull_request/opened_handler.rb +83 -0
  72. data/app/models/shipit/webhooks/handlers/pull_request/reopened_handler.rb +88 -0
  73. data/app/models/shipit/webhooks/handlers/pull_request/review_stack_adapter.rb +103 -0
  74. data/app/models/shipit/webhooks/handlers/pull_request/unlabeled_handler.rb +107 -0
  75. data/app/models/shipit/webhooks/handlers/push_handler.rb +4 -1
  76. data/app/models/shipit/webhooks.rb +10 -0
  77. data/app/serializers/shipit/deploy_serializer.rb +6 -0
  78. data/app/serializers/shipit/merge_request_serializer.rb +21 -0
  79. data/app/serializers/shipit/pull_request_serializer.rb +5 -8
  80. data/app/serializers/shipit/review_stack_serializer.rb +7 -0
  81. data/app/serializers/shipit/stack_serializer.rb +7 -6
  82. data/app/serializers/shipit/tail_task_serializer.rb +10 -2
  83. data/app/serializers/shipit/task_serializer.rb +1 -1
  84. data/app/validators/subset_validator.rb +1 -1
  85. data/app/views/layouts/merge_status.html.erb +1 -1
  86. data/app/views/shipit/merge_requests/_merge_request.html.erb +29 -0
  87. data/app/views/shipit/{pull_requests → merge_requests}/index.html.erb +2 -2
  88. data/app/views/shipit/merge_requests/merge_requests/_pull_request.html.erb +29 -0
  89. data/app/views/shipit/merge_requests/merge_requests/index.html.erb +20 -0
  90. data/app/views/shipit/merge_status/_merge_queue_button.html.erb +3 -3
  91. data/app/views/shipit/merge_status/backlogged.html.erb +1 -1
  92. data/app/views/shipit/merge_status/failure.html.erb +1 -1
  93. data/app/views/shipit/merge_status/locked.html.erb +1 -1
  94. data/app/views/shipit/merge_status/success.html.erb +2 -2
  95. data/app/views/shipit/repositories/_header.html.erb +19 -0
  96. data/app/views/shipit/repositories/index.html.erb +31 -0
  97. data/app/views/shipit/repositories/new.html.erb +23 -0
  98. data/app/views/shipit/repositories/settings.html.erb +53 -0
  99. data/app/views/shipit/repositories/show.html.erb +30 -0
  100. data/app/views/shipit/stacks/_banners.html.erb +15 -1
  101. data/app/views/shipit/stacks/_header.html.erb +5 -2
  102. data/app/views/shipit/stacks/_stack.html.erb +8 -0
  103. data/app/views/shipit/stacks/index.html.erb +2 -1
  104. data/app/views/shipit/stacks/new.html.erb +1 -1
  105. data/app/views/shipit/stacks/settings.html.erb +5 -5
  106. data/app/views/shipit/stacks/show.html.erb +1 -1
  107. data/app/views/shipit/tasks/_task_output.html.erb +1 -1
  108. data/config/routes.rb +15 -5
  109. data/config/secrets.development.example.yml +24 -0
  110. data/config/secrets.development.shopify.yml +20 -9
  111. data/db/migrate/20200706145406_add_review_stacks.rb +12 -0
  112. data/db/migrate/20200804144639_rename_pull_request_to_merge_request.rb +7 -0
  113. data/db/migrate/20200804161512_rename_commits_pull_request_id_to_merge_request_id.rb +5 -0
  114. data/db/migrate/20200813134712_recreate_shipit_pull_requests.rb +22 -0
  115. data/db/migrate/20200813194056_create_pull_request_assignments.rb +8 -0
  116. data/db/migrate/20201001125502_add_provision_pr_stacks_flag_to_repositories.rb +7 -0
  117. data/db/migrate/20201008145809_add_retry_attempt_to_tasks.rb +5 -0
  118. data/db/migrate/20201008152744_add_max_retries_to_tasks.rb +5 -0
  119. data/db/migrate/20210325194053_remove_stacks_branch_default.rb +5 -0
  120. data/db/migrate/20210504200438_add_github_updated_at_to_check_runs.rb +5 -0
  121. data/db/migrate/20210823075617_change_check_runs_github_updated_at_default.rb +5 -0
  122. data/lib/shipit/command.rb +7 -6
  123. data/lib/shipit/commands.rb +18 -5
  124. data/lib/shipit/engine.rb +2 -0
  125. data/lib/shipit/flock.rb +8 -1
  126. data/lib/shipit/github_app.rb +8 -6
  127. data/lib/shipit/octokit_iterator.rb +3 -3
  128. data/lib/shipit/review_stack_commands.rb +8 -0
  129. data/lib/shipit/simple_message_verifier.rb +2 -2
  130. data/lib/shipit/stack_commands.rb +36 -7
  131. data/lib/shipit/task_commands.rb +8 -1
  132. data/lib/shipit/version.rb +1 -1
  133. data/lib/shipit.rb +50 -16
  134. data/lib/snippets/publish-lerna-independent-packages +35 -34
  135. data/lib/snippets/publish-lerna-independent-packages-legacy +39 -0
  136. data/lib/tasks/cron.rake +11 -2
  137. data/test/controllers/api/ccmenu_controller_test.rb +1 -1
  138. data/test/controllers/api/deploys_controller_test.rb +17 -0
  139. data/test/controllers/api/{pull_requests_controller_test.rb → merge_requests_controller_test.rb} +12 -12
  140. data/test/controllers/api/outputs_controller_test.rb +1 -0
  141. data/test/controllers/api/rollback_controller_test.rb +1 -1
  142. data/test/controllers/api/stacks_controller_test.rb +42 -8
  143. data/test/controllers/{pull_requests_controller_test.rb → merge_requests_controller_test.rb} +6 -6
  144. data/test/controllers/repositories_controller_test.rb +71 -0
  145. data/test/controllers/stacks_controller_test.rb +9 -1
  146. data/test/controllers/tasks_controller_test.rb +14 -2
  147. data/test/controllers/webhooks_controller_test.rb +27 -12
  148. data/test/dummy/app/assets/config/manifest.js +3 -0
  149. data/test/dummy/config/application.rb +7 -2
  150. data/test/dummy/config/database.yml +9 -0
  151. data/test/dummy/config/environments/development.rb +1 -4
  152. data/test/dummy/config/environments/test.rb +0 -5
  153. data/test/dummy/config/secrets_double_github_app.yml +79 -0
  154. data/test/dummy/db/schema.rb +56 -17
  155. data/test/dummy/db/seeds.rb +2 -1
  156. data/test/fixtures/payloads/check_suite_master.json +4 -32
  157. data/test/fixtures/payloads/invalid_pull_request.json +117 -0
  158. data/test/fixtures/payloads/provision_disabled_pull_request.json +454 -0
  159. data/test/fixtures/payloads/pull_request_assigned.json +480 -0
  160. data/test/fixtures/payloads/pull_request_closed.json +454 -0
  161. data/test/fixtures/payloads/pull_request_labeled.json +461 -0
  162. data/test/fixtures/payloads/pull_request_opened.json +454 -0
  163. data/test/fixtures/payloads/pull_request_reopened.json +454 -0
  164. data/test/fixtures/payloads/pull_request_unlabeled.json +454 -0
  165. data/test/fixtures/payloads/pull_request_with_no_repo.json +454 -0
  166. data/test/fixtures/payloads/push_master.json +1 -1
  167. data/test/fixtures/payloads/push_not_master.json +1 -1
  168. data/test/fixtures/shipit/commits.yml +17 -4
  169. data/test/fixtures/shipit/hooks.yml +1 -0
  170. data/test/fixtures/shipit/merge_requests.yml +141 -0
  171. data/test/fixtures/shipit/pull_request_assignments.yml +3 -0
  172. data/test/fixtures/shipit/pull_requests.yml +10 -131
  173. data/test/fixtures/shipit/repositories.yml +1 -0
  174. data/test/fixtures/shipit/stacks.yml +145 -0
  175. data/test/fixtures/shipit/statuses.yml +9 -0
  176. data/test/fixtures/shipit/tasks.yml +4 -1
  177. data/test/fixtures/shipit/users.yml +7 -0
  178. data/test/helpers/json_helper.rb +5 -1
  179. data/test/helpers/payloads_helper.rb +4 -0
  180. data/test/jobs/chunk_rollup_job_test.rb +15 -1
  181. data/test/jobs/destroy_repository_job_test.rb +27 -0
  182. data/test/jobs/github_sync_job_test.rb +2 -1
  183. data/test/jobs/perform_task_job_test.rb +8 -8
  184. data/test/jobs/{merge_pull_requests_job_test.rb → process_merge_requests_job_test.rb} +18 -18
  185. data/test/lib/shipit/deploy_commands_test.rb +16 -0
  186. data/test/lib/shipit/task_commands_test.rb +17 -0
  187. data/test/models/commit_deployment_status_test.rb +3 -3
  188. data/test/models/commits_test.rb +24 -13
  189. data/test/models/deploy_spec_test.rb +64 -24
  190. data/test/models/deploys_test.rb +188 -14
  191. data/test/models/hook_test.rb +30 -1
  192. data/test/models/{pull_request_test.rb → merge_request_test.rb} +49 -34
  193. data/test/models/pull_request_assignment_test.rb +16 -0
  194. data/test/models/shipit/check_run_test.rb +124 -5
  195. data/test/models/shipit/provisioning_handler/base_test.rb +33 -0
  196. data/test/models/shipit/provisioning_handler/unregistered_provisioning_handler_test.rb +49 -0
  197. data/test/models/shipit/provisioning_handler_test.rb +64 -0
  198. data/test/models/shipit/pull_request_test.rb +52 -0
  199. data/test/models/shipit/repository_test.rb +5 -1
  200. data/test/models/shipit/review_stack_provision_status_test.rb +77 -0
  201. data/test/models/shipit/review_stack_provisioning_queue_test.rb +63 -0
  202. data/test/models/shipit/review_stack_test.rb +91 -0
  203. data/test/models/{stacks_test.rb → shipit/stacks_test.rb} +52 -8
  204. data/test/models/shipit/webhooks/handlers/pull_request/assigned_handler_test.rb +45 -0
  205. data/test/models/shipit/webhooks/handlers/pull_request/closed_handler_test.rb +192 -0
  206. data/test/models/shipit/webhooks/handlers/pull_request/edited_handler_test.rb +47 -0
  207. data/test/models/shipit/webhooks/handlers/pull_request/label_capturing_handler_test.rb +209 -0
  208. data/test/models/shipit/webhooks/handlers/pull_request/labeled_handler_test.rb +332 -0
  209. data/test/models/shipit/webhooks/handlers/pull_request/opened_handler_test.rb +238 -0
  210. data/test/models/shipit/webhooks/handlers/pull_request/reopened_handler_test.rb +282 -0
  211. data/test/models/shipit/webhooks/handlers/pull_request/review_stack_adapter_test.rb +107 -0
  212. data/test/models/shipit/webhooks/handlers/pull_request/unlabeled_handler_test.rb +324 -0
  213. data/test/models/shipit/{wehbooks → webhooks}/handlers_test.rb +0 -0
  214. data/test/models/tasks_test.rb +66 -3
  215. data/test/serializers/shipit/pull_request_serializer_test.rb +29 -0
  216. data/test/test_helper.rb +15 -0
  217. data/test/unit/anonymous_user_serializer_test.rb +1 -1
  218. data/test/unit/command_test.rb +8 -3
  219. data/test/unit/commit_serializer_test.rb +1 -1
  220. data/test/unit/deploy_commands_test.rb +73 -17
  221. data/test/unit/deploy_serializer_test.rb +1 -1
  222. data/test/unit/github_app_test.rb +2 -3
  223. data/test/unit/github_apps_test.rb +416 -0
  224. data/test/unit/github_url_helper_test.rb +5 -0
  225. data/test/unit/shipit_deployment_checks_test.rb +77 -0
  226. data/test/unit/shipit_task_execution_strategy_test.rb +47 -0
  227. data/test/unit/shipit_test.rb +14 -0
  228. data/test/unit/user_serializer_test.rb +1 -1
  229. metadata +306 -188
  230. data/app/controllers/shipit/pull_requests_controller.rb +0 -31
  231. data/app/jobs/shipit/merge_pull_requests_job.rb +0 -32
  232. data/app/jobs/shipit/refresh_pull_request_job.rb +0 -11
  233. data/app/views/shipit/pull_requests/_pull_request.html.erb +0 -29
  234. data/test/fixtures/shipit/output_chunks.yml +0 -47
  235. data/test/models/output_chunk_test.rb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98113cef0ad013fa29cb11fea22f09547c191310a601eb788a53fdc5fb3c7e40
4
- data.tar.gz: 39c68de0e6356e1daab40942a817af86258ea8219726c1e4276a42bba5d79315
3
+ metadata.gz: 7ab32590ea528100fc22999f40a17d9ffcefb72313672eb4858befdb9a6932e1
4
+ data.tar.gz: fe6fe3d4b026e0e2d0ecb067639d97027649d26fd785c90b9e198ce0e478c2a9
5
5
  SHA512:
6
- metadata.gz: 29504e17c71d378485e8610edea95e25e215f5c391478244e609a95a847e3022b508bda95713db97e1f1de22f67c8eed310a562f82cf737e1425803e958341ce
7
- data.tar.gz: a7ea41b8ddcf21803a1279cd74d53231c9e030165c06b2ff835f31db55b0cf2240ca802626fba50abaec6b0e5c09e1439900de22c9d3b7719f53b6e2fe524da8
6
+ metadata.gz: a51d622ab862751d118d2d0995361366d8035481f090ddfcaa09f01b672c326ed1708c4085831a195899500762cd29b6247c01710e08260b5baf263d2363cc33
7
+ data.tar.gz: 327aac9271b84975c388c0dbb42c380f99c00d15b1ce6930bba6877066d0333b3c60efcaf8ab56e925d17e90ac1462c48cbccb9ec5da1537c04f45fe6149c49b
data/README.md CHANGED
@@ -12,7 +12,7 @@ Shipit is compatible with just about anything that you can deploy using a script
12
12
 
13
13
  This guide aims to help you [set up](#installation-and-setup), [use](#using-shipit), and [understand](#reference) Shipit.
14
14
 
15
- *Shipit requires a database (MySQL, PostgreSQL or SQLite3), redis, and Ruby 2.1 or superior.*
15
+ *Shipit requires a database (MySQL, PostgreSQL or SQLite3), redis, and Ruby 2.6 or superior.*
16
16
 
17
17
  * * *
18
18
  <h2 id="toc">Table of contents</h2>
@@ -270,7 +270,9 @@ deploy:
270
270
  ```
271
271
  <br>
272
272
 
273
- **<code>deploy.max_commits</code>** defines the maximum number of commits that should be shipped per deploys. Defaults to `8`.
273
+ **<code>deploy.max_commits</code>** defines the maximum number of commits that should be shipped per deploy. Defaults to `8` if no value is provided.
274
+
275
+ To disable this limit, you can use use an explicit null value: `max_commits: null`. Continuous Delivery will then deploy any number of commits.
274
276
 
275
277
  Human users will be warned that they are not respecting the recommendation, but allowed to continue.
276
278
  However continuous delivery will respect this limit. If there is no deployable commits in this range, a human intervention will be required.
@@ -292,6 +294,15 @@ deploy:
292
294
  interval: 5m
293
295
  ```
294
296
 
297
+ **<code>deploy.retries</code>** enables retries for a stack, and defines the maximum amount of times that Shipit will retry a deploy that finished with a `failed`, `error` or `timedout` status.
298
+
299
+ For example, this will retry a deploy twice if it fails.
300
+
301
+ ```yaml
302
+ deploy:
303
+ retries: 2
304
+ ```
305
+
295
306
  **<code>rollback.override</code>** contains an array of the shell commands required to rollback the application to a previous state. Shipit will try to infer it from the repository structure, but you can change the default inference. This key defaults to `disabled` unless Capistrano is detected.
296
307
 
297
308
  For example:
@@ -0,0 +1 @@
1
+ <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="magic" class="svg-inline--fa fa-magic fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M224 96l16-32 32-16-32-16-16-32-16 32-32 16 32 16 16 32zM80 160l26.66-53.33L160 80l-53.34-26.67L80 0 53.34 53.33 0 80l53.34 26.67L80 160zm352 128l-26.66 53.33L352 368l53.34 26.67L432 448l26.66-53.33L512 368l-53.34-26.67L432 288zm70.62-193.77L417.77 9.38C411.53 3.12 403.34 0 395.15 0c-8.19 0-16.38 3.12-22.63 9.38L9.38 372.52c-12.5 12.5-12.5 32.76 0 45.25l84.85 84.85c6.25 6.25 14.44 9.37 22.62 9.37 8.19 0 16.38-3.12 22.63-9.37l363.14-363.15c12.5-12.48 12.5-32.75 0-45.24zM359.45 203.46l-50.91-50.91 86.6-86.6 50.91 50.91-86.6 86.6z"></path></svg>
@@ -0,0 +1,60 @@
1
+ KEY =
2
+ UP: 38
3
+ DOWN: 40
4
+ ENTER: 13
5
+
6
+ class RepositorySearch
7
+
8
+ constructor: (root) ->
9
+ @$root = $(root)
10
+ @$root.on('keyup', '.repository-search', @onKeyUp)
11
+ @$root.on('click', '.show-all-repositories', (event) =>
12
+ @$root.find('.not-matching').removeClass('not-matching')
13
+ event.preventDefault()
14
+ )
15
+
16
+ onKeyUp: (event) =>
17
+ @$items = @$root.find('[data-search]')
18
+ switch event.keyCode
19
+ when KEY.ENTER
20
+ event.preventDefault()
21
+ @goToSelectedRepository()
22
+ when KEY.UP
23
+ event.preventDefault()
24
+ @selectPrevious()
25
+ when KEY.DOWN
26
+ event.preventDefault()
27
+ @selectNext()
28
+ else
29
+ @filterResults($.trim($(event.target).val()).toLowerCase())
30
+
31
+ filterResults: (query) ->
32
+ if query
33
+ for item in @$items
34
+ $item = $(item)
35
+ $item.toggleClass('not-matching', query not in $item.attr('data-search').toLowerCase())
36
+ @selectFirst()
37
+ else
38
+ @$items.removeClass('not-matching')
39
+
40
+ selectFirst: ->
41
+ @$items.removeClass('selected').first(':not(.not-matching)').addClass('selected')
42
+
43
+ selectNext: ->
44
+ $next = @$items.filter('.selected').removeClass('selected').nextAll(':not(.not-matching)').first()
45
+ $next = @$items.filter(':not(.not-matching)').first() unless $next.length
46
+ $next.addClass('selected')
47
+
48
+ selectPrevious: ->
49
+ $previous = @$items.filter('.selected').removeClass('selected').prevAll(':not(.not-matching)').first()
50
+ $previous = @$items.filter(':not(.not-matching)').last() unless $previous.length
51
+ $previous.addClass('selected')
52
+
53
+ goToSelectedRepository: ->
54
+ if repository = @$items.filter('.selected').filter(':not(.not-matching)').find('.commits-path').attr('href')
55
+ window.location = repository
56
+
57
+ search = new RepositorySearch(document)
58
+
59
+ jQuery ->
60
+ $('.repository-search').focus()
@@ -67,7 +67,8 @@
67
67
  }
68
68
 
69
69
  .deploy-banner {
70
- height: 4rem;
70
+ min-height: 4rem;
71
+ height: auto;
71
72
  background-color: #f0f4f7;
72
73
  display: flex;
73
74
  justify-content: center;
@@ -196,8 +197,6 @@
196
197
  width: 100%;
197
198
  overflow-y: auto;
198
199
  overflow-x: hidden;
199
- padding-right: 20px;
200
- padding-left: 15px;
201
200
  }
202
201
 
203
202
  .commit-checks {
@@ -0,0 +1,148 @@
1
+ .repository-search {
2
+ -webkit-appearance: none;
3
+ width: 100%;
4
+ @extend h1;
5
+ border: none;
6
+ font-family: "Helvetica Neue", sans-serif;
7
+ font-weight: 200;
8
+ background: asset-data-url('search.svg') no-repeat center right;
9
+ &::-webkit-input-placeholder {
10
+ color: #B5C0CA;
11
+ }
12
+ &:focus {
13
+ outline: none;
14
+ background-image: asset-data-url('search-active.svg');
15
+ }
16
+ }
17
+
18
+ .repository-table-header {
19
+ @include clearfix;
20
+ margin: 0; padding: 1.25rem 0 1rem;
21
+ .col {
22
+ width: 25%;
23
+ float: left;
24
+ }
25
+ li {
26
+ list-style-type: none;
27
+ font-size: .875em;
28
+ color: #BAC5D1;
29
+ }
30
+ }
31
+
32
+ .repository-lst {
33
+ list-style-type: none;
34
+ margin: 0; padding: 0; margin-bottom: 1.5rem;
35
+ .col {
36
+ width: 25%;
37
+ float: left;
38
+ text-overflow: ellipsis;
39
+ white-space: nowrap;
40
+ overflow: hidden;
41
+ padding-right: .5rem;
42
+ box-sizing: border-box;
43
+ }
44
+ .undeployed {
45
+ background-image: asset-data-url('ship.png');
46
+ background-repeat: no-repeat;
47
+ background-size: 22px 22px;
48
+ background-position: 0px center;
49
+ padding-left: 30px;
50
+ margin-left: -30px;
51
+ }
52
+ .archived {
53
+ // From FontAwesome, license @ https://fontawesome.com/license/free
54
+ background-image: asset-data-url('archive-solid.svg');
55
+ background-repeat: no-repeat;
56
+ background-size: 22px 22px;
57
+ background-position: 0px center;
58
+ padding-left: 30px;
59
+ margin-left: -30px;
60
+ }
61
+ .auto-provisioned {
62
+ // From FontAwesome, license @ https://fontawesome.com/license/free
63
+ background-image: asset-data-url('magic-solid.svg');
64
+ background-repeat: no-repeat;
65
+ background-size: 22px 22px;
66
+ background-position: 0px center;
67
+ padding-left: 30px;
68
+ margin-left: -30px;
69
+ }
70
+ }
71
+
72
+ .repository-lst:empty:before {
73
+ content: "No environment to deploy to, Shipit Squirrel is displeased";
74
+ }
75
+
76
+ .repository-lst li {
77
+ &:nth-child(even) a {
78
+ background-color: lighten(#EDF1F3, 3.5%);
79
+ }
80
+
81
+ &.selected a {
82
+ background-color: $blue;
83
+ outline: none;
84
+ span { color: #fff; }
85
+ small { color: rgba(#fff, .8); }
86
+ }
87
+
88
+ a {
89
+ padding: .35rem;
90
+ margin-left: -0.35rem; margin-right: -0.35rem;
91
+ @include clearfix;
92
+ border-radius: 4px;
93
+ display: block;
94
+ &:hover, &:focus {
95
+ background-color: $blue;
96
+ outline: none;
97
+ span { color: #fff; }
98
+ small { color: rgba(#fff, .8); }
99
+ }
100
+ }
101
+ }
102
+
103
+ .repository-search input {
104
+ margin-left: 4%;
105
+ width: 92%;
106
+ padding: 6px;
107
+ font-size: larger;
108
+ -moz-border-radius: 8px;
109
+ -webkit-border-radius: 8px;
110
+ border-radius: 8px;
111
+ outline: 0;
112
+ border: 1px #a0a0a0 solid;
113
+ }
114
+
115
+ .repository-search-header {
116
+ display: none;
117
+ }
118
+
119
+ .show-all-repositories {
120
+ display: none;
121
+ }
122
+
123
+ .filtering-enabled {
124
+ .show-all-repositories {
125
+ display: inline-block;
126
+ }
127
+
128
+ .repository-search-header {
129
+ display: block;
130
+ }
131
+ .search-item.not-matching {
132
+ display: none;
133
+ }
134
+ }
135
+
136
+ .new_repository {
137
+ input.repo {
138
+ width: 200px;
139
+ display: inline;
140
+
141
+ &:focus {
142
+ padding-right: 30px !important;
143
+ }
144
+ }
145
+ input:focus {
146
+ border-color: $blue;
147
+ }
148
+ }
@@ -58,6 +58,15 @@
58
58
  padding-left: 30px;
59
59
  margin-left: -30px;
60
60
  }
61
+ .auto-provisioned {
62
+ // From FontAwesome, license @ https://fontawesome.com/license/free
63
+ background-image: asset-data-url('magic-solid.svg');
64
+ background-repeat: no-repeat;
65
+ background-size: 22px 22px;
66
+ background-position: 0px center;
67
+ padding-left: 30px;
68
+ margin-left: -30px;
69
+ }
61
70
  }
62
71
 
63
72
  .stack-lst:empty:before {
@@ -193,6 +202,16 @@
193
202
  @include clearfix;
194
203
  }
195
204
 
205
+ .auto-provisioned {
206
+ // From FontAwesome, license @ https://fontawesome.com/license/free
207
+ background-image: asset-data-url('magic-solid.svg');
208
+ background-repeat: no-repeat;
209
+ background-size: 22px 22px;
210
+ background-position: 0px center;
211
+ padding-left: 30px;
212
+ margin-left: 5px;
213
+ }
214
+
196
215
  /* STATS */
197
216
 
198
217
  .stats {
@@ -17,4 +17,5 @@
17
17
  @import "_pages/_commits";
18
18
  @import "_pages/_settings";
19
19
  @import "_pages/_stacks";
20
+ @import "_pages/_repositories";
20
21
  @import "_pages/_deploy";
@@ -20,7 +20,7 @@ module Shipit
20
20
 
21
21
  def show
22
22
  latest_deploy = stack.deploys_and_rollbacks.last || NoDeploy.new
23
- render('shipit/ccmenu/project.xml.builder', formats: [:xml], locals: { stack: stack, deploy: latest_deploy })
23
+ render('shipit/ccmenu/project', formats: [:xml], locals: { stack: stack, deploy: latest_deploy })
24
24
  end
25
25
 
26
26
  private
@@ -11,11 +11,13 @@ module Shipit
11
11
  params do
12
12
  requires :sha, String, length: { in: 6..40 }
13
13
  accepts :force, Boolean, default: false
14
+ accepts :require_ci, Boolean, default: false
14
15
  accepts :env, Hash, default: {}
15
16
  end
16
17
  def create
17
18
  commit = stack.commits.by_sha(params.sha) || param_error!(:sha, 'Unknown revision')
18
19
  param_error!(:force, "Can't deploy a locked stack") if !params.force && stack.locked?
20
+ param_error!(:require_ci, "Commit is not deployable") if params.require_ci && !commit.deployable?
19
21
  deploy = stack.trigger_deploy(commit, current_user, env: params.env, force: params.force)
20
22
  render_resource(deploy, status: :accepted)
21
23
  end
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
  module Shipit
3
3
  module Api
4
- class PullRequestsController < BaseController
4
+ class MergeRequestsController < BaseController
5
5
  require_permission :read, :stack
6
6
  require_permission :deploy, :stack, only: %i(update destroy)
7
7
 
8
8
  def index
9
- render_resources(stack.pull_requests.includes(:head).order(id: :desc))
9
+ render_resources(stack.merge_requests.includes(:head).order(id: :desc))
10
10
  end
11
11
 
12
12
  def show
13
- render_resource(stack.pull_requests.find_by!(number: params[:id]))
13
+ render_resource(stack.merge_requests.find_by!(number: params[:id]))
14
14
  end
15
15
 
16
16
  def update
17
- pull_request = PullRequest.request_merge!(stack, params[:id], current_user)
18
- if pull_request.waiting?
17
+ merge_request = MergeRequest.request_merge!(stack, params[:id], current_user)
18
+ if merge_request.waiting?
19
19
  head(:accepted)
20
- elsif pull_request.merged?
20
+ elsif merge_request.merged?
21
21
  render(status: :method_not_allowed, json: {
22
22
  message: "This pull request was already merged.",
23
23
  })
@@ -27,8 +27,8 @@ module Shipit
27
27
  end
28
28
 
29
29
  def destroy
30
- if pull_request = stack.pull_requests.where(number: params[:id]).first
31
- pull_request.cancel! if pull_request.waiting?
30
+ if merge_request = stack.merge_requests.where(number: params[:id]).first
31
+ merge_request.cancel! if merge_request.waiting?
32
32
  end
33
33
  head(:no_content)
34
34
  end
@@ -8,6 +8,7 @@ module Shipit
8
8
  requires :sha, String, length: { in: 6..40 }
9
9
  accepts :force, Boolean, default: false
10
10
  accepts :env, Hash, default: {}
11
+ accepts :lock, Boolean, default: true
11
12
  end
12
13
  def create
13
14
  commit = stack.commits.by_sha(params.sha) || param_error!(:sha, 'Unknown revision')
@@ -23,7 +24,7 @@ module Shipit
23
24
  active_task.abort!(aborted_by: current_user, rollback_once_aborted_to: deploy)
24
25
  response = active_task
25
26
  else
26
- response = deploy.trigger_rollback(current_user, env: deploy_env, force: params.force)
27
+ response = deploy.trigger_rollback(current_user, env: deploy_env, force: params.force, lock: params.lock)
27
28
  end
28
29
 
29
30
  render_resource(response, status: :accepted)
@@ -5,8 +5,21 @@ module Shipit
5
5
  require_permission :read, :stack, only: %i(index show)
6
6
  require_permission :write, :stack, only: %i(create update destroy)
7
7
 
8
+ params do
9
+ accepts :repo_owner, String
10
+ accepts :repo_name, String
11
+ end
8
12
  def index
9
- render_resources(stacks)
13
+ @stacks = stacks
14
+ if params[:repo_owner] && params[:repo_name]
15
+ full_repo_name = [repo_owner, repo_name].join('/')
16
+ @stacks = if (repository = Repository.from_github_repo_name(full_repo_name))
17
+ stacks.where(repository: repository)
18
+ else
19
+ Stack.none
20
+ end
21
+ end
22
+ render_resources(@stacks)
10
23
  end
11
24
 
12
25
  params do
@@ -27,6 +40,7 @@ module Shipit
27
40
  end
28
41
 
29
42
  params do
43
+ accepts :branch, String
30
44
  accepts :deploy_url, String
31
45
  accepts :ignore_ci, Boolean
32
46
  accepts :merge_queue_enabled, Boolean
@@ -17,7 +17,7 @@ module Shipit
17
17
  def show
18
18
  respond_to do |format|
19
19
  format.html
20
- format.text { render plain: @deploy.chunk_output }
20
+ format.text { render(plain: @deploy.chunk_output) }
21
21
  end
22
22
  end
23
23