shipit-engine 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -1
- data/app/assets/javascripts/shipit/page_updater.js.coffee +63 -0
- data/app/assets/javascripts/shipit/stacks.js.coffee +9 -21
- data/app/assets/stylesheets/_base/_base.scss +2 -2
- data/app/assets/stylesheets/_base/_colors.scss +0 -1
- data/app/assets/stylesheets/_base/_forms.scss +14 -0
- data/app/assets/stylesheets/_pages/_commits.scss +16 -6
- data/app/assets/stylesheets/_pages/_settings.scss +8 -0
- data/app/assets/stylesheets/_pages/_stacks.scss +1 -1
- data/app/controllers/shipit/api/base_controller.rb +7 -3
- data/app/controllers/shipit/api/ccmenu_controller.rb +33 -0
- data/app/controllers/shipit/api/pull_requests_controller.rb +36 -0
- data/app/controllers/shipit/api/stacks_controller.rb +1 -0
- data/app/controllers/shipit/ccmenu_url_controller.rb +22 -0
- data/app/controllers/shipit/pull_requests_controller.rb +30 -0
- data/app/controllers/shipit/stacks_controller.rb +7 -2
- data/app/controllers/shipit/webhooks_controller.rb +1 -2
- data/app/helpers/shipit/github_url_helper.rb +8 -2
- data/app/helpers/shipit/shipit_helper.rb +9 -0
- data/app/helpers/shipit/stacks_helper.rb +22 -7
- data/app/jobs/shipit/background_job/unique.rb +19 -1
- data/app/jobs/shipit/cache_deploy_spec_job.rb +1 -1
- data/app/jobs/shipit/merge_pull_requests_job.rb +26 -0
- data/app/jobs/shipit/perform_task_job.rb +1 -1
- data/app/jobs/shipit/refresh_pull_request_job.rb +8 -0
- data/app/models/concerns/shipit/deferred_touch.rb +6 -1
- data/app/models/shipit/anonymous_user.rb +4 -0
- data/app/models/shipit/application_record.rb +5 -0
- data/app/models/shipit/commit.rb +51 -49
- data/app/models/shipit/commit_message.rb +32 -0
- data/app/models/shipit/deploy.rb +5 -0
- data/app/models/shipit/deploy_spec.rb +26 -1
- data/app/models/shipit/deploy_spec/file_system.rb +6 -1
- data/app/models/shipit/deploy_spec/kubernetes_discovery.rb +10 -13
- data/app/models/shipit/deploy_spec/npm_discovery.rb +2 -1
- data/app/models/shipit/duration.rb +3 -1
- data/app/models/shipit/hook.rb +1 -0
- data/app/models/shipit/pull_request.rb +252 -0
- data/app/models/shipit/stack.rb +33 -17
- data/app/models/shipit/status.rb +1 -16
- data/app/models/shipit/status/common.rb +45 -0
- data/app/models/shipit/status/group.rb +82 -0
- data/app/models/shipit/status/missing.rb +30 -0
- data/app/models/shipit/status/unknown.rb +33 -0
- data/app/models/shipit/unlimited_api_client.rb +10 -0
- data/app/serializers/shipit/commit_serializer.rb +1 -1
- data/app/serializers/shipit/pull_request_serializer.rb +20 -0
- data/app/serializers/shipit/stack_serializer.rb +6 -2
- data/app/views/layouts/shipit.html.erb +41 -39
- data/app/views/shipit/ccmenu/project.xml.builder +13 -0
- data/app/views/shipit/commits/_commit.html.erb +1 -1
- data/app/views/shipit/deploys/_deploy.html.erb +1 -1
- data/app/views/shipit/pull_requests/_pull_request.html.erb +29 -0
- data/app/views/shipit/pull_requests/index.html.erb +20 -0
- data/app/views/shipit/shared/_author.html.erb +7 -0
- data/app/views/shipit/stacks/_header.html.erb +5 -0
- data/app/views/shipit/stacks/settings.html.erb +13 -0
- data/app/views/shipit/stacks/show.html.erb +3 -2
- data/app/views/shipit/statuses/_group.html.erb +1 -1
- data/app/views/shipit/tasks/_task.html.erb +1 -1
- data/config/initializers/inflections.rb +3 -0
- data/config/locales/en.yml +1 -3
- data/config/routes.rb +8 -0
- data/db/migrate/20170130113633_create_shipit_pull_requests.rb +25 -0
- data/db/migrate/20170208143657_add_pull_request_number_and_title_to_commits.rb +7 -0
- data/db/migrate/20170208154609_backfill_merge_commits.rb +13 -0
- data/db/migrate/20170209160355_add_branch_to_pull_requests.rb +5 -0
- data/db/migrate/20170215123538_add_merge_queue_enabled_to_stacks.rb +5 -0
- data/db/migrate/20170220152410_improve_users_indexing.rb +6 -0
- data/db/migrate/20170221102128_improve_tasks_indexing.rb +8 -0
- data/db/migrate/20170221130336_add_last_revalidated_at_on_pull_requests.rb +10 -0
- data/lib/shipit.rb +2 -0
- data/lib/shipit/version.rb +1 -1
- data/lib/tasks/cron.rake +1 -0
- data/test/controllers/api/ccmenu_controller_test.rb +57 -0
- data/test/controllers/api/commits_controller_test.rb +1 -1
- data/test/controllers/api/pull_requests_controller_test.rb +59 -0
- data/test/controllers/ccmenu_controller_test.rb +33 -0
- data/test/controllers/pull_requests_controller_test.rb +31 -0
- data/test/controllers/webhooks_controller_test.rb +3 -4
- data/test/dummy/config/environments/development.rb +3 -1
- data/test/dummy/data/stacks/shopify/junk/production/git/README.md +8 -0
- data/test/dummy/data/stacks/shopify/junk/production/git/circle.yml +4 -0
- data/test/dummy/data/stacks/shopify/junk/production/git/shipit.yml +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +45 -11
- data/test/dummy/db/seeds.rb +33 -10
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/fixtures/shipit/commits.yml +14 -0
- data/test/fixtures/shipit/pull_requests.yml +56 -0
- data/test/fixtures/shipit/stacks.yml +5 -1
- data/test/fixtures/shipit/statuses.yml +8 -0
- data/test/helpers/json_helper.rb +16 -14
- data/test/jobs/merge_pull_requests_job_test.rb +59 -0
- data/test/models/commits_test.rb +104 -49
- data/test/{unit → models}/deploy_spec_test.rb +138 -12
- data/test/models/deploys_test.rb +10 -4
- data/test/models/pull_request_test.rb +197 -0
- data/test/models/stacks_test.rb +46 -53
- data/test/models/status/group_test.rb +44 -0
- data/test/models/status/missing_test.rb +23 -0
- data/test/models/status_test.rb +3 -6
- data/test/unit/csv_serializer_test.rb +10 -2
- metadata +57 -12
- data/app/models/shipit/missing_status.rb +0 -21
- data/app/models/shipit/status_group.rb +0 -35
- data/app/models/shipit/unknown_status.rb +0 -48
- data/app/views/shipit/commits/_commit_author.html.erb +0 -7
- data/test/models/missing_status_test.rb +0 -23
- data/test/models/status_group_test.rb +0 -26
@@ -1,21 +0,0 @@
|
|
1
|
-
module Shipit
|
2
|
-
class MissingStatus < SimpleDelegator
|
3
|
-
def initialize(instance, missing_statuses)
|
4
|
-
@missing_statuses = missing_statuses
|
5
|
-
super(instance)
|
6
|
-
end
|
7
|
-
|
8
|
-
def state
|
9
|
-
'missing'
|
10
|
-
end
|
11
|
-
|
12
|
-
def success?
|
13
|
-
false
|
14
|
-
end
|
15
|
-
|
16
|
-
def description
|
17
|
-
statuses = @missing_statuses.to_sentence
|
18
|
-
I18n.t('missing_status.description', missing_statuses: statuses, count: @missing_statuses.size)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Shipit
|
2
|
-
class StatusGroup
|
3
|
-
STATES_PRIORITY = %w(failure error pending success).freeze
|
4
|
-
|
5
|
-
attr_reader :statuses, :significant_status
|
6
|
-
|
7
|
-
def initialize(significant_status, visible_statuses)
|
8
|
-
@significant_status = significant_status
|
9
|
-
@statuses = visible_statuses
|
10
|
-
end
|
11
|
-
|
12
|
-
delegate :pending?, :success?, :error?, :failure?, :unknown?, :state, to: :significant_status
|
13
|
-
|
14
|
-
def description
|
15
|
-
"#{success_count} / #{statuses.count} checks OK"
|
16
|
-
end
|
17
|
-
|
18
|
-
def target_url
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_partial_path
|
22
|
-
'statuses/group'
|
23
|
-
end
|
24
|
-
|
25
|
-
def group?
|
26
|
-
true
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def success_count
|
32
|
-
@statuses.count { |s| s.state == 'success'.freeze }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Shipit
|
2
|
-
UnknownStatus = Struct.new(:commit) do
|
3
|
-
def state
|
4
|
-
'unknown'
|
5
|
-
end
|
6
|
-
alias_method :simple_state, :state
|
7
|
-
|
8
|
-
def unknown?
|
9
|
-
true
|
10
|
-
end
|
11
|
-
|
12
|
-
def pending?
|
13
|
-
false
|
14
|
-
end
|
15
|
-
|
16
|
-
def success?
|
17
|
-
false
|
18
|
-
end
|
19
|
-
|
20
|
-
def error?
|
21
|
-
false
|
22
|
-
end
|
23
|
-
|
24
|
-
def failure?
|
25
|
-
false
|
26
|
-
end
|
27
|
-
|
28
|
-
def group?
|
29
|
-
false
|
30
|
-
end
|
31
|
-
|
32
|
-
def target_url
|
33
|
-
nil
|
34
|
-
end
|
35
|
-
|
36
|
-
def description
|
37
|
-
''
|
38
|
-
end
|
39
|
-
|
40
|
-
def context
|
41
|
-
'ci/unknown'
|
42
|
-
end
|
43
|
-
|
44
|
-
def to_partial_path
|
45
|
-
'shipit/statuses/status'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<a href="<%= github_user_url(commit.author.login) %>" class="commit-author">
|
2
|
-
<%= github_avatar(commit.author, size: 80, class: 'commit-author__avatar') %>
|
3
|
-
<div class="commit-author__name">
|
4
|
-
<span class="commit-author__name__real-name"><%= commit.author.name %></span>
|
5
|
-
<span class="commit-author__name__username"><%= commit.author.login %></span>
|
6
|
-
</div>
|
7
|
-
</a>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Shipit
|
4
|
-
class MissingStatusTest < ActiveSupport::TestCase
|
5
|
-
setup do
|
6
|
-
@real_status = shipit_statuses(:first_pending)
|
7
|
-
@status = MissingStatus.new(@real_status, %w(ci/very-important style/very-important-too))
|
8
|
-
end
|
9
|
-
|
10
|
-
test "#state is 'missing'" do
|
11
|
-
assert_equal 'missing', @status.state
|
12
|
-
end
|
13
|
-
|
14
|
-
test "#description explains the situation" do
|
15
|
-
message = 'ci/very-important and style/very-important-too are required for deploy but were not sent'
|
16
|
-
assert_equal message, @status.description
|
17
|
-
end
|
18
|
-
|
19
|
-
test "#success? is false" do
|
20
|
-
refute_predicate @status, :success?
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Shipit
|
4
|
-
class StatusGroupTest < ActiveSupport::TestCase
|
5
|
-
setup do
|
6
|
-
@commit = shipit_commits(:second)
|
7
|
-
@group = StatusGroup.new(@commit.significant_status, @commit.visible_statuses)
|
8
|
-
end
|
9
|
-
|
10
|
-
test "#description is a summary of the statuses" do
|
11
|
-
assert_equal '1 / 2 checks OK', @group.description
|
12
|
-
end
|
13
|
-
|
14
|
-
test "#group? returns true" do
|
15
|
-
assert_equal true, @group.group?
|
16
|
-
end
|
17
|
-
|
18
|
-
test "#target_url returns nil" do
|
19
|
-
assert_nil @group.target_url
|
20
|
-
end
|
21
|
-
|
22
|
-
test "#state is significant's status state" do
|
23
|
-
assert_equal @commit.significant_status.state, @group.state
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|