shipit-engine 0.20.1 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +43 -6
  3. data/app/assets/stylesheets/_base/_base.scss +4 -0
  4. data/app/assets/stylesheets/_pages/_commits.scss +3 -1
  5. data/app/assets/stylesheets/_pages/_deploy.scss +4 -2
  6. data/app/controllers/concerns/shipit/authentication.rb +1 -1
  7. data/app/controllers/shipit/api/base_controller.rb +6 -1
  8. data/app/controllers/shipit/api/pull_requests_controller.rb +1 -1
  9. data/app/controllers/shipit/commit_checks_controller.rb +1 -1
  10. data/app/controllers/shipit/shipit_controller.rb +1 -5
  11. data/app/controllers/shipit/stacks_controller.rb +2 -0
  12. data/app/controllers/shipit/tasks_controller.rb +1 -1
  13. data/app/controllers/shipit/webhooks_controller.rb +2 -2
  14. data/app/helpers/shipit/deploys_helper.rb +9 -0
  15. data/app/helpers/shipit/shipit_helper.rb +17 -15
  16. data/app/helpers/shipit/stacks_helper.rb +6 -1
  17. data/app/jobs/shipit/destroy_stack_job.rb +4 -2
  18. data/app/jobs/shipit/fetch_deployed_revision_job.rb +1 -1
  19. data/app/jobs/shipit/github_sync_job.rb +1 -1
  20. data/app/jobs/shipit/merge_pull_requests_job.rb +3 -3
  21. data/app/jobs/shipit/perform_task_job.rb +3 -0
  22. data/app/jobs/shipit/purge_old_deliveries_job.rb +1 -0
  23. data/app/models/shipit/api_client.rb +1 -1
  24. data/app/models/shipit/commit.rb +29 -6
  25. data/app/models/shipit/commit_deployment.rb +1 -1
  26. data/app/models/shipit/commit_deployment_status.rb +1 -1
  27. data/app/models/shipit/deploy_spec.rb +19 -2
  28. data/app/models/shipit/deploy_spec/bundler_discovery.rb +1 -10
  29. data/app/models/shipit/deploy_spec/file_system.rb +6 -0
  30. data/app/models/shipit/deploy_spec/kubernetes_discovery.rb +1 -1
  31. data/app/models/shipit/deploy_spec/lerna_discovery.rb +85 -0
  32. data/app/models/shipit/deploy_spec/npm_discovery.rb +103 -5
  33. data/app/models/shipit/deploy_spec/pypi_discovery.rb +4 -2
  34. data/app/models/shipit/deploy_spec/rubygems_discovery.rb +4 -2
  35. data/app/models/shipit/duration.rb +1 -1
  36. data/app/models/shipit/github_status.rb +1 -1
  37. data/app/models/shipit/hook.rb +4 -5
  38. data/app/models/shipit/output_chunk.rb +1 -1
  39. data/app/models/shipit/pull_request.rb +36 -15
  40. data/app/models/shipit/stack.rb +15 -9
  41. data/app/models/shipit/status/common.rb +4 -0
  42. data/app/models/shipit/status/group.rb +4 -0
  43. data/app/models/shipit/task.rb +20 -8
  44. data/app/models/shipit/task_definition.rb +2 -2
  45. data/app/models/shipit/undeployed_commit.rb +13 -2
  46. data/app/models/shipit/user.rb +1 -1
  47. data/app/serializers/shipit/pull_request_serializer.rb +1 -1
  48. data/app/serializers/shipit/tail_task_serializer.rb +1 -1
  49. data/app/views/shipit/ccmenu/project.xml.builder +9 -8
  50. data/app/views/shipit/deploys/_deploy.html.erb +3 -2
  51. data/app/views/shipit/stacks/_banners.html.erb +4 -1
  52. data/app/views/shipit/stacks/settings.html.erb +4 -0
  53. data/app/views/shipit/statuses/_group.html.erb +1 -1
  54. data/app/views/shipit/statuses/_status.html.erb +1 -1
  55. data/app/views/shipit/tasks/_task.html.erb +1 -2
  56. data/config/locales/en.yml +2 -0
  57. data/config/secrets.development.example.yml +0 -4
  58. data/config/secrets.development.shopify.yml +1 -5
  59. data/db/migrate/20170904103242_reindex_deliveries.rb +7 -0
  60. data/db/migrate/20171120161420_add_base_info_to_pull_request.rb +7 -0
  61. data/db/migrate/20180202220850_add_aborted_by_to_tasks.rb +5 -0
  62. data/lib/shipit.rb +15 -23
  63. data/lib/shipit/command.rb +11 -3
  64. data/lib/shipit/engine.rb +0 -4
  65. data/lib/shipit/stack_commands.rb +3 -1
  66. data/lib/shipit/version.rb +1 -1
  67. data/lib/snippets/assert-lerna-fixed-version-tag +21 -0
  68. data/lib/snippets/assert-lerna-independent-version-tags +28 -0
  69. data/lib/snippets/generate-local-npmrc +19 -0
  70. data/lib/snippets/misconfigured-npm-publish-config +8 -0
  71. data/lib/snippets/publish-lerna-independent-packages +39 -0
  72. data/lib/snippets/push-to-heroku +5 -5
  73. data/lib/tasks/cron.rake +1 -1
  74. data/lib/tasks/dev.rake +1 -1
  75. data/test/controllers/api/deploys_controller_test.rb +19 -0
  76. data/test/controllers/api/stacks_controller_test.rb +1 -1
  77. data/test/controllers/github_authentication_controller_test.rb +1 -1
  78. data/test/controllers/stacks_controller_test.rb +10 -0
  79. data/test/controllers/tasks_controller_test.rb +2 -0
  80. data/test/controllers/webhooks_controller_test.rb +0 -7
  81. data/test/dummy/config/secrets.yml +0 -2
  82. data/test/dummy/db/development.sqlite3 +0 -0
  83. data/test/dummy/db/schema.rb +5 -3
  84. data/test/dummy/db/test.sqlite3 +0 -0
  85. data/test/fixtures/shipit/commits.yml +53 -0
  86. data/test/fixtures/shipit/pull_requests.yml +52 -0
  87. data/test/fixtures/shipit/stacks.yml +35 -0
  88. data/test/fixtures/shipit/statuses.yml +27 -0
  89. data/test/fixtures/shipit/tasks.yml +14 -0
  90. data/test/helpers/queries_helper.rb +1 -1
  91. data/test/jobs/merge_pull_requests_job_test.rb +19 -2
  92. data/test/jobs/perform_task_job_test.rb +26 -2
  93. data/test/models/commits_test.rb +55 -6
  94. data/test/models/deploy_spec_test.rb +288 -52
  95. data/test/models/deploys_test.rb +7 -7
  96. data/test/models/hook_test.rb +4 -3
  97. data/test/models/pull_request_test.rb +78 -24
  98. data/test/models/stacks_test.rb +21 -17
  99. data/test/models/status/group_test.rb +6 -0
  100. data/test/models/undeployed_commits_test.rb +9 -0
  101. data/test/models/users_test.rb +2 -2
  102. data/test/test_helper.rb +1 -1
  103. metadata +211 -222
  104. data/app/assets/javascripts/shipit_bs.js.coffee +0 -2
  105. data/app/assets/stylesheets/shipit_bs.scss +0 -22
  106. data/app/views/bootstrap/shipit/missing_settings.html.erb +0 -97
  107. data/app/views/bootstrap/shipit/stacks/new.html.erb +0 -44
  108. data/app/views/layouts/shipit_bootstrap.html.erb +0 -44
  109. data/lib/shipit/template_renderer_extension.rb +0 -16
@@ -1,2 +0,0 @@
1
- #= require jquery
2
- #= require bootstrap-sprockets
@@ -1,22 +0,0 @@
1
- // Custom bootstrap variables must be set or import before bootstrap itself.
2
- @import "bootstrap";
3
-
4
- body {
5
- padding-top: 5rem;
6
- }
7
-
8
- .navbar-brand {
9
- background: asset-data-url('anchor.svg') center center no-repeat;
10
- display: block;
11
- width: 40px;
12
- height: 40px;
13
- transition: transform .3s ease-in-out;
14
- text-indent: -9999px;
15
- top: 50%;
16
- right: 100%;
17
- margin-right: 1em;
18
-
19
- &:hover {
20
- transform: rotate(-25deg);
21
- }
22
- }
@@ -1,97 +0,0 @@
1
- <% content_for :page_title do %>
2
- Shipit
3
- <% end %>
4
-
5
- <div class="jumbotron bg-warning">
6
- <div class="container">
7
- <h1 class="display-4">Oops! You're not ready to ship just yet.</h1>
8
- <p class="lead">
9
- Shipit is missing some of the information it needs to work properly.
10
- Once you've added the configuration, make sure you restart the Rails server.
11
- </p>
12
- </div>
13
- </div>
14
-
15
- <div class="container">
16
- <section>
17
- <header>
18
- <h2>GitHub application</h2>
19
- </header>
20
-
21
- <% if Shipit.github_oauth_id.blank? || Shipit.github_oauth_secret.blank? %>
22
- <p><%= missing_github_oauth_message %></p>
23
- <% end %>
24
- <p id="github_oauth_id">
25
- ID:
26
- <% if Shipit.github_oauth_id.present? %>
27
- Success!
28
- <% else %>
29
- <span class="missing">
30
- <%= missing_github_oauth_id_message %>
31
- </span>
32
- <% end %>
33
- </p>
34
-
35
- <p id="github_oauth_secret">
36
- Secret:
37
- <% if Shipit.github_oauth_secret.present? %>
38
- Success!
39
- <% else %>
40
- <span class="missing">
41
- <%= missing_github_oauth_secret_message %>
42
- </span>
43
- <% end %>
44
- </p>
45
- </section>
46
-
47
- <section>
48
- <header>
49
- <h2>GitHub API</h2>
50
- </header>
51
-
52
- <p id="github_api">
53
- Token:
54
- <% if Shipit.github_api_credentials.present? %>
55
- Success!
56
- <% else %>
57
- <span class="missing">
58
- <%= missing_github_api_credentials_message %>
59
- </span>
60
- <% end %>
61
- </p>
62
- </section>
63
-
64
- <section>
65
- <header>
66
- <h2>Redis</h2>
67
- </header>
68
-
69
- <p id="redis_url">
70
- Redis:
71
- <% if Shipit.redis_url.present? %>
72
- Success!
73
- <% else %>
74
- <span class="missing">
75
- <%= missing_redis_url_message %>
76
- </span>
77
- <% end %>
78
- </p>
79
- </section>
80
-
81
- <section>
82
- <header>
83
- <h2>Host</h2>
84
- </header>
85
-
86
- <p id="host">
87
- Host:
88
- <% if Shipit.host.present? %>
89
- Success!
90
- <% else %>
91
- <span class="missing">
92
- <%= missing_host_message %>
93
- </span>
94
- <% end %>
95
- </p>
96
- </section>
97
- </div>
@@ -1,44 +0,0 @@
1
- <% content_for :page_title do %>
2
- Create a stack
3
- <% end %>
4
-
5
- <div class='container'>
6
- <section>
7
- <header>
8
- <h1>Create a stack</h1>
9
- </header>
10
- <%= form_for @stack do |f| %>
11
- <fieldset class='form-group'>
12
- <%= label_tag :stack_repo_owner, 'Repo' %>
13
- <div class='input-group'>
14
- <div class='input-group-addon'><%= Shipit.github_url %>/</div>
15
- <%= f.text_field :repo_owner, placeholder: 'e.g. Shopify', required: true, class: 'form-control' %>
16
- <div class='input-group-addon'>/</div>
17
- <%= f.text_field :repo_name, placeholder: 'e.g. shipit-engine', required: true, pattern: "^[a-zA-Z0-9\-_\.]+$", class: 'form-control' %>
18
- </div>
19
- </fieldset>
20
- <fieldset class='form-group'>
21
- <%= f.label :branch %>
22
- <%= f.text_field :branch, placeholder: 'master', class: 'form-control' %>
23
- </fieldset>
24
- <fieldset class='form-group'>
25
- <%= f.label :environment %>
26
- <%= f.text_field :environment, placeholder: 'production', class: 'form-control' %>
27
- </fieldset>
28
- <fieldset class='form-group'>
29
- <%= f.label :deploy_url %>
30
- <%= f.text_field :deploy_url, placeholder: 'https://', class: 'form-control' %>
31
- <small class='text-muted'>Where is this stack deployed to?</small>
32
- </fieldset>
33
- <fieldset class='form-group checkbox'>
34
- <%= label_tag :stack_ignore_ci do %>
35
- <%= f.check_box :ignore_ci, class: 'checkbox' %>
36
- Allow deploys regardless of CI status
37
- <% end %>
38
- </fieldset>
39
- <fieldset>
40
- <%= f.submit class: 'btn btn-primary' %>
41
- </fieldset>
42
- <% end %>
43
- </section>
44
- </div>
@@ -1,44 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en" data-controller="<%= controller_name %>" data-action="<%= action_name %>">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
- <meta http-equiv="x-ua-compatible" content="ie=edge">
7
- <title><%= [Shipit.app_name, @stack.try!(:repo_name)].compact.join(' - ') %></title>
8
-
9
- <%= favicon_link_tag %>
10
- <%= stylesheet_link_tag :shipit_bs, media: 'all' %>
11
- <%= javascript_include_tag :shipit_bs %>
12
-
13
- <%= csrf_meta_tags %>
14
- </head>
15
- <body>
16
- <% flash.each do |name, msg| %>
17
- <%= content_tag :div, msg, class: ["flash-#{name}", :flash] %>
18
- <% end %>
19
-
20
- <nav class="navbar navbar-fixed-top navbar-light bg-faded">
21
- <%= link_to "Shipit", root_path, class: "navbar-brand" %>
22
-
23
- <ul class="nav navbar-nav">
24
- <li class="nav-item active">
25
- <%= link_to "#", class: "nav-link" do %>
26
- <%= yield :page_title %>
27
- <% end %>
28
- </li>
29
- </ul>
30
-
31
- <div class="pull-xs-right">
32
- <%= link_to "Shipit v#{Shipit::VERSION}", "https://github.com/Shopify/shipit-engine/tree/v#{Shipit::VERSION}" %>
33
- </div>
34
-
35
- <div class="container pull-xs-right">
36
- <%= yield :primary_navigation %>
37
- </div>
38
- </nav>
39
-
40
- <div class="main">
41
- <%= yield %>
42
- </div>
43
- </body>
44
- </html>
@@ -1,16 +0,0 @@
1
- module TemplateRendererExtension
2
- private
3
-
4
- def render_template(template, layout_name = nil, *args)
5
- if layout_name && bootstrap?(template)
6
- layout_name = 'layouts/shipit_bootstrap'
7
- end
8
- super(template, layout_name, *args)
9
- end
10
-
11
- def bootstrap?(template)
12
- template.identifier.start_with?('bootstrap/') || template.identifier.start_with?("#{Shipit.bootstrap_view_path}/")
13
- end
14
- end
15
-
16
- ActionView::TemplateRenderer.prepend(TemplateRendererExtension)