shipit-engine 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/shipit/api/cacheable.rb +13 -0
- data/app/controllers/concerns/shipit/api/paginable.rb +37 -0
- data/app/controllers/concerns/shipit/api/rendering.rb +25 -0
- data/app/controllers/concerns/{api/paginable.rb → shipit/pagination.rb} +5 -13
- data/app/controllers/shipit/api/base_controller.rb +68 -0
- data/app/controllers/shipit/api/deploys_controller.rb +17 -0
- data/app/controllers/shipit/api/hooks_controller.rb +53 -0
- data/app/controllers/shipit/api/locks_controller.rb +32 -0
- data/app/controllers/shipit/api/outputs_controller.rb +17 -0
- data/app/controllers/shipit/api/stacks_controller.rb +21 -0
- data/app/controllers/shipit/api/tasks_controller.rb +20 -0
- data/app/controllers/shipit/commit_checks_controller.rb +26 -0
- data/app/controllers/shipit/deploys_controller.rb +47 -0
- data/app/controllers/shipit/github_authentication_controller.rb +27 -0
- data/app/controllers/shipit/rollbacks_controller.rb +26 -0
- data/app/controllers/shipit/shipit_controller.rb +62 -0
- data/app/controllers/shipit/stacks_controller.rb +81 -0
- data/app/controllers/shipit/status_controller.rb +7 -0
- data/app/controllers/shipit/tasks_controller.rb +48 -0
- data/app/controllers/shipit/webhooks_controller.rb +101 -0
- data/app/helpers/shipit/chunks_helper.rb +8 -0
- data/app/helpers/shipit/deploys_helper.rb +28 -0
- data/app/helpers/shipit/github_url_helper.rb +48 -0
- data/app/helpers/shipit/shipit_helper.rb +64 -0
- data/app/helpers/shipit/stacks_helper.rb +78 -0
- data/app/helpers/shipit/tasks_helper.rb +11 -0
- data/app/jobs/shipit/background_job.rb +24 -0
- data/app/jobs/shipit/background_job/unique.rb +28 -0
- data/app/jobs/shipit/cache_deploy_spec_job.rb +12 -0
- data/app/jobs/shipit/chunk_rollup_job.rb +21 -0
- data/app/jobs/shipit/clear_git_cache_job.rb +9 -0
- data/app/jobs/shipit/deliver_hook_job.rb +9 -0
- data/app/jobs/shipit/destroy_stack_job.rb +9 -0
- data/app/jobs/shipit/emit_event_job.rb +10 -0
- data/app/jobs/shipit/fetch_commit_stats_job.rb +9 -0
- data/app/jobs/shipit/fetch_deployed_revision_job.rb +23 -0
- data/app/jobs/shipit/git_mirror_update_job.rb +12 -0
- data/app/jobs/shipit/github_sync_job.rb +55 -0
- data/app/jobs/shipit/perform_commit_checks_job.rb +7 -0
- data/app/jobs/shipit/perform_task_job.rb +57 -0
- data/app/jobs/shipit/refresh_github_user_job.rb +9 -0
- data/app/jobs/shipit/refresh_statuses_job.rb +14 -0
- data/app/jobs/shipit/setup_github_hook_job.rb +11 -0
- data/app/models/shipit/anonymous_user.rb +43 -0
- data/app/models/shipit/api_client.rb +44 -0
- data/app/models/shipit/commit.rb +209 -0
- data/app/models/shipit/commit_checks.rb +90 -0
- data/app/models/shipit/delivery.rb +47 -0
- data/app/models/shipit/deploy.rb +153 -0
- data/app/models/shipit/deploy_spec.rb +150 -0
- data/app/models/shipit/deploy_spec/bundler_discovery.rb +61 -0
- data/app/models/shipit/deploy_spec/capistrano_discovery.rb +29 -0
- data/app/models/shipit/deploy_spec/file_system.rb +64 -0
- data/app/models/shipit/deploy_spec/pypi_discovery.rb +34 -0
- data/app/models/shipit/deploy_spec/rubygems_discovery.rb +34 -0
- data/app/models/shipit/github_hook.rb +148 -0
- data/app/models/shipit/hook.rb +86 -0
- data/app/models/shipit/membership.rb +8 -0
- data/app/models/shipit/missing_status.rb +21 -0
- data/app/models/shipit/output_chunk.rb +11 -0
- data/app/models/shipit/rollback.rb +31 -0
- data/app/models/shipit/stack.rb +308 -0
- data/app/models/shipit/status.rb +44 -0
- data/app/models/shipit/status_group.rb +35 -0
- data/app/models/shipit/task.rb +201 -0
- data/app/models/shipit/task_definition.rb +38 -0
- data/app/models/shipit/team.rb +69 -0
- data/app/models/shipit/unknown_status.rb +43 -0
- data/app/models/shipit/user.rb +83 -0
- data/app/models/shipit/variable_definition.rb +21 -0
- data/app/serializers/concerns/shipit/conditional_attributes.rb +22 -0
- data/app/serializers/shipit/anonymous_user_serializer.rb +4 -0
- data/app/serializers/shipit/commit_serializer.rb +8 -0
- data/app/serializers/shipit/deploy_serializer.rb +15 -0
- data/app/serializers/shipit/hook_serializer.rb +12 -0
- data/app/serializers/shipit/rollback_serializer.rb +7 -0
- data/app/serializers/shipit/short_commit_serializer.rb +9 -0
- data/app/serializers/shipit/stack_serializer.rb +33 -0
- data/app/serializers/shipit/tail_task_serializer.rb +39 -0
- data/app/serializers/shipit/task_serializer.rb +30 -0
- data/app/serializers/shipit/user_serializer.rb +5 -0
- data/app/views/{commits → shipit/commits}/_commit.html.erb +1 -1
- data/app/views/{commits → shipit/commits}/_commit_author.html.erb +0 -0
- data/app/views/{deploys → shipit/deploys}/_checklist.html.erb +0 -0
- data/app/views/{deploys → shipit/deploys}/_checks.html.erb +0 -0
- data/app/views/{deploys → shipit/deploys}/_concurrent_deploy_warning.html.erb +0 -0
- data/app/views/{deploys → shipit/deploys}/_deploy.html.erb +1 -1
- data/app/views/{deploys → shipit/deploys}/_monitoring.html.erb +0 -0
- data/app/views/{deploys → shipit/deploys}/_summary.html.erb +0 -0
- data/app/views/{deploys → shipit/deploys}/new.html.erb +3 -3
- data/app/views/{deploys → shipit/deploys}/rollback.html.erb +2 -2
- data/app/views/{deploys → shipit/deploys}/show.html.erb +1 -1
- data/app/views/{github_authentication → shipit/github_authentication}/failed.html.erb +0 -0
- data/app/views/{stacks → shipit/stacks}/_header.html.erb +0 -0
- data/app/views/{stacks → shipit/stacks}/index.html.erb +0 -0
- data/app/views/{stacks → shipit/stacks}/new.html.erb +0 -0
- data/app/views/{stacks → shipit/stacks}/settings.html.erb +1 -1
- data/app/views/{stacks → shipit/stacks}/show.html.erb +2 -2
- data/app/views/{statuses → shipit/statuses}/_group.html.erb +1 -1
- data/app/views/{statuses → shipit/statuses}/_status.html.erb +0 -0
- data/app/views/{tasks → shipit/tasks}/_task.html.erb +1 -1
- data/app/views/{tasks → shipit/tasks}/_task_output.html.erb +1 -1
- data/app/views/{tasks → shipit/tasks}/index.html.erb +1 -1
- data/app/views/{tasks → shipit/tasks}/new.html.erb +1 -1
- data/app/views/{tasks → shipit/tasks}/show.html.erb +1 -1
- data/db/migrate/20160104151742_increase_tasks_type_size_back.rb +5 -0
- data/db/migrate/20160104151833_convert_sti_columns.rb +10 -0
- data/lib/shipit.rb +11 -10
- data/lib/shipit/command.rb +171 -0
- data/lib/shipit/commands.rb +25 -0
- data/lib/shipit/deploy_commands.rb +21 -0
- data/lib/shipit/engine.rb +3 -0
- data/lib/shipit/rollback_commands.rb +7 -0
- data/lib/shipit/stack_commands.rb +60 -0
- data/lib/shipit/task_commands.rb +68 -0
- data/lib/shipit/version.rb +1 -1
- data/lib/tasks/cron.rake +3 -3
- data/test/controllers/api/base_controller_test.rb +18 -14
- data/test/controllers/api/deploys_controller_test.rb +56 -52
- data/test/controllers/api/hooks_controller_test.rb +62 -58
- data/test/controllers/api/locks_controller_test.rb +38 -34
- data/test/controllers/api/outputs_controller_test.rb +15 -11
- data/test/controllers/api/stacks_controller_test.rb +56 -52
- data/test/controllers/api/tasks_controller_test.rb +30 -26
- data/test/controllers/commit_checks_controller_test.rb +29 -27
- data/test/controllers/deploys_controller_test.rb +68 -66
- data/test/controllers/github_authentication_controller_test.rb +9 -7
- data/test/controllers/rollbacks_controller_test.rb +43 -41
- data/test/controllers/stacks_controller_test.rb +131 -128
- data/test/controllers/status_controller_test.rb +8 -6
- data/test/controllers/tasks_controller_test.rb +70 -68
- data/test/controllers/webhooks_controller_test.rb +127 -125
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +2 -2
- data/test/dummy/db/seeds.rb +133 -131
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/fixtures/{api_clients.yml → shipit/api_clients.yml} +0 -0
- data/test/fixtures/{commits.yml → shipit/commits.yml} +0 -0
- data/test/fixtures/{deliveries.yml → shipit/deliveries.yml} +0 -0
- data/test/fixtures/{github_hooks.yml → shipit/github_hooks.yml} +4 -4
- data/test/fixtures/{hooks.yml → shipit/hooks.yml} +0 -0
- data/test/fixtures/{memberships.yml → shipit/memberships.yml} +0 -0
- data/test/fixtures/{output_chunks.yml → shipit/output_chunks.yml} +0 -0
- data/test/fixtures/{stacks.yml → shipit/stacks.yml} +0 -0
- data/test/fixtures/{statuses.yml → shipit/statuses.yml} +0 -0
- data/test/fixtures/{tasks.yml → shipit/tasks.yml} +8 -8
- data/test/fixtures/{teams.yml → shipit/teams.yml} +0 -0
- data/test/fixtures/{users.yml → shipit/users.yml} +0 -0
- data/test/helpers/api_helper.rb +1 -1
- data/test/helpers/fixture_aliases_helper.rb +4 -4
- data/test/jobs/cache_deploy_spec_job_test.rb +15 -13
- data/test/jobs/chunk_rollup_job_test.rb +30 -28
- data/test/jobs/deliver_hook_job_test.rb +11 -9
- data/test/jobs/destroy_stack_job_test.rb +11 -9
- data/test/jobs/emit_event_job_test.rb +10 -8
- data/test/jobs/fetch_commit_stats_job_test.rb +10 -8
- data/test/jobs/fetch_deployed_revision_job_test.rb +24 -22
- data/test/jobs/github_sync_job_test.rb +51 -49
- data/test/jobs/perform_task_job_test.rb +78 -76
- data/test/jobs/refresh_github_user_job_test.rb +10 -8
- data/test/jobs/refresh_status_job_test.rb +14 -12
- data/test/jobs/unique_job_test.rb +18 -15
- data/test/models/api_client_test.rb +20 -18
- data/test/models/commit_checks_test.rb +63 -61
- data/test/models/commits_test.rb +317 -314
- data/test/models/delivery_test.rb +29 -27
- data/test/models/deploys_test.rb +289 -287
- data/test/models/github_hook_test.rb +45 -43
- data/test/models/hook_test.rb +44 -42
- data/test/models/membership_test.rb +9 -7
- data/test/models/missing_status_test.rb +16 -14
- data/test/models/output_chunk_test.rb +14 -12
- data/test/models/rollbacks_test.rb +14 -12
- data/test/models/stacks_test.rb +272 -270
- data/test/models/status_group_test.rb +18 -16
- data/test/models/status_test.rb +42 -40
- data/test/models/task_definitions_test.rb +27 -25
- data/test/models/team_test.rb +39 -37
- data/test/models/users_test.rb +61 -59
- data/test/unit/command_test.rb +43 -41
- data/test/unit/commands_test.rb +8 -6
- data/test/unit/csv_serializer_test.rb +28 -26
- data/test/unit/deploy_commands_test.rb +179 -176
- data/test/unit/deploy_spec_test.rb +237 -235
- data/test/unit/github_url_helper_test.rb +19 -17
- data/test/unit/shipit_test.rb +44 -42
- metadata +139 -137
- data/app/controllers/api/base_controller.rb +0 -66
- data/app/controllers/api/deploys_controller.rb +0 -15
- data/app/controllers/api/hooks_controller.rb +0 -51
- data/app/controllers/api/locks_controller.rb +0 -30
- data/app/controllers/api/outputs_controller.rb +0 -15
- data/app/controllers/api/stacks_controller.rb +0 -19
- data/app/controllers/api/tasks_controller.rb +0 -18
- data/app/controllers/commit_checks_controller.rb +0 -24
- data/app/controllers/concerns/api/cacheable.rb +0 -11
- data/app/controllers/concerns/api/rendering.rb +0 -23
- data/app/controllers/concerns/pagination.rb +0 -25
- data/app/controllers/deploys_controller.rb +0 -45
- data/app/controllers/github_authentication_controller.rb +0 -25
- data/app/controllers/rollbacks_controller.rb +0 -24
- data/app/controllers/shipit_controller.rb +0 -54
- data/app/controllers/stacks_controller.rb +0 -79
- data/app/controllers/status_controller.rb +0 -5
- data/app/controllers/tasks_controller.rb +0 -46
- data/app/controllers/webhooks_controller.rb +0 -99
- data/app/helpers/chunks_helper.rb +0 -6
- data/app/helpers/deploys_helper.rb +0 -26
- data/app/helpers/github_url_helper.rb +0 -46
- data/app/helpers/shipit_helper.rb +0 -62
- data/app/helpers/stacks_helper.rb +0 -76
- data/app/helpers/tasks_helper.rb +0 -9
- data/app/jobs/background_job.rb +0 -22
- data/app/jobs/background_job/unique.rb +0 -26
- data/app/jobs/cache_deploy_spec_job.rb +0 -10
- data/app/jobs/chunk_rollup_job.rb +0 -19
- data/app/jobs/clear_git_cache_job.rb +0 -7
- data/app/jobs/deliver_hook_job.rb +0 -7
- data/app/jobs/destroy_stack_job.rb +0 -7
- data/app/jobs/emit_event_job.rb +0 -8
- data/app/jobs/fetch_commit_stats_job.rb +0 -7
- data/app/jobs/fetch_deployed_revision_job.rb +0 -21
- data/app/jobs/git_mirror_update_job.rb +0 -10
- data/app/jobs/github_sync_job.rb +0 -53
- data/app/jobs/perform_commit_checks_job.rb +0 -5
- data/app/jobs/perform_task_job.rb +0 -55
- data/app/jobs/refresh_github_user_job.rb +0 -7
- data/app/jobs/refresh_statuses_job.rb +0 -12
- data/app/jobs/setup_github_hook_job.rb +0 -9
- data/app/models/anonymous_user.rb +0 -41
- data/app/models/api_client.rb +0 -42
- data/app/models/commit.rb +0 -207
- data/app/models/commit_checks.rb +0 -88
- data/app/models/delivery.rb +0 -45
- data/app/models/deploy.rb +0 -151
- data/app/models/deploy_spec.rb +0 -148
- data/app/models/deploy_spec/bundler_discovery.rb +0 -59
- data/app/models/deploy_spec/capistrano_discovery.rb +0 -27
- data/app/models/deploy_spec/file_system.rb +0 -62
- data/app/models/deploy_spec/pypi_discovery.rb +0 -32
- data/app/models/deploy_spec/rubygems_discovery.rb +0 -32
- data/app/models/github_hook.rb +0 -144
- data/app/models/hook.rb +0 -84
- data/app/models/membership.rb +0 -6
- data/app/models/missing_status.rb +0 -18
- data/app/models/output_chunk.rb +0 -9
- data/app/models/rollback.rb +0 -29
- data/app/models/stack.rb +0 -306
- data/app/models/status.rb +0 -42
- data/app/models/status_group.rb +0 -33
- data/app/models/task.rb +0 -197
- data/app/models/task_definition.rb +0 -36
- data/app/models/team.rb +0 -67
- data/app/models/unknown_status.rb +0 -41
- data/app/models/user.rb +0 -81
- data/app/models/variable_definition.rb +0 -19
- data/app/serializers/anonymous_user_serializer.rb +0 -2
- data/app/serializers/commit_serializer.rb +0 -6
- data/app/serializers/concerns/conditional_attributes.rb +0 -20
- data/app/serializers/deploy_serializer.rb +0 -13
- data/app/serializers/hook_serializer.rb +0 -10
- data/app/serializers/rollback_serializer.rb +0 -5
- data/app/serializers/short_commit_serializer.rb +0 -7
- data/app/serializers/stack_serializer.rb +0 -31
- data/app/serializers/tail_task_serializer.rb +0 -37
- data/app/serializers/task_serializer.rb +0 -28
- data/app/serializers/user_serializer.rb +0 -3
- data/lib/command.rb +0 -169
- data/lib/commands.rb +0 -23
- data/lib/deploy_commands.rb +0 -19
- data/lib/rollback_commands.rb +0 -5
- data/lib/stack_commands.rb +0 -58
- data/lib/task_commands.rb +0 -66
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160104151833) do
|
15
15
|
|
16
16
|
create_table "api_clients", force: :cascade do |t|
|
17
17
|
t.text "permissions", limit: 65535
|
@@ -147,7 +147,7 @@ ActiveRecord::Schema.define(version: 20151113151323) do
|
|
147
147
|
t.datetime "updated_at"
|
148
148
|
t.integer "user_id", limit: 4
|
149
149
|
t.boolean "rolled_up", default: false, null: false
|
150
|
-
t.string "type", limit:
|
150
|
+
t.string "type", limit: 20
|
151
151
|
t.integer "parent_id", limit: 4
|
152
152
|
t.integer "additions", limit: 4, default: 0
|
153
153
|
t.integer "deletions", limit: 4, default: 0
|
data/test/dummy/db/seeds.rb
CHANGED
@@ -5,163 +5,165 @@ require 'fakeweb'
|
|
5
5
|
FakeWeb.register_uri(:post, %r{https://example\.com/}, status: %w(200 OK))
|
6
6
|
|
7
7
|
# Cheap hack to allow rake db:seed to work
|
8
|
-
|
9
|
-
Stack.send(:define_method, :
|
10
|
-
|
11
|
-
Commit.send(:define_method, :
|
8
|
+
module Shipit
|
9
|
+
Stack.send(:define_method, :setup_hooks) {}
|
10
|
+
Stack.send(:define_method, :sync_github) {}
|
11
|
+
Commit.send(:define_method, :fetch_stats!) {}
|
12
|
+
Commit.send(:define_method, :refresh_statuses!) {}
|
12
13
|
|
13
|
-
users = 3.times.map do
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
14
|
+
users = 3.times.map do
|
15
|
+
User.create!(
|
16
|
+
name: Faker::Name.name,
|
17
|
+
email: Faker::Internet.email,
|
18
|
+
login: Faker::Internet.user_name,
|
19
|
+
)
|
20
|
+
end
|
20
21
|
|
21
|
-
stacks = 3.times.map do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
22
|
+
stacks = 3.times.map do
|
23
|
+
Stack.create!(
|
24
|
+
repo_name: Faker::Internet.domain_name.parameterize,
|
25
|
+
repo_owner: Faker::Company.name.parameterize,
|
26
|
+
deploy_url: "https://#{Faker::Internet.domain_name.parameterize}.#{Faker::Internet.domain_suffix}/",
|
27
|
+
cached_deploy_spec: DeploySpec.load(%(
|
28
|
+
{
|
29
|
+
"dependencies": {
|
30
|
+
"bundler": {
|
31
|
+
"without": [
|
32
|
+
"default",
|
33
|
+
"production",
|
34
|
+
"development",
|
35
|
+
"test",
|
36
|
+
"staging",
|
37
|
+
"benchmark",
|
38
|
+
"debug"
|
39
|
+
]
|
40
|
+
},
|
41
|
+
"override": [
|
42
|
+
"bundle check --path=/tmp/bundler || bundle install --frozen --path=/tmp/bundler --retry=2 --without=default:production:development:test:staging:benchmark:debug"
|
38
43
|
]
|
39
44
|
},
|
40
|
-
"
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
"fetch": [
|
46
|
+
],
|
47
|
+
"tasks": {
|
48
|
+
"restart": {
|
49
|
+
"action": "Restart application",
|
50
|
+
"description": "Restart Thin and Resque.",
|
51
|
+
"steps": [
|
52
|
+
"bundle exec cap $ENVIRONMENT deploy:restart"
|
53
|
+
],
|
54
|
+
"checklist": [
|
55
|
+
"Hold on your butts",
|
56
|
+
"Eat some chips"
|
57
|
+
]
|
58
|
+
}
|
59
|
+
},
|
60
|
+
"machine": {
|
61
|
+
"environment": {
|
62
|
+
},
|
63
|
+
"directory": null
|
64
|
+
},
|
65
|
+
"review": {
|
53
66
|
"checklist": [
|
54
67
|
"Hold on your butts",
|
55
68
|
"Eat some chips"
|
56
69
|
]
|
57
|
-
}
|
58
|
-
},
|
59
|
-
"machine": {
|
60
|
-
"environment": {
|
61
70
|
},
|
62
|
-
"
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
"bundle exec cap $ENVIRONMENT deploy"
|
73
|
-
]
|
74
|
-
},
|
75
|
-
"rollback": {
|
76
|
-
"override": [
|
77
|
-
"bundle exec cap $ENVIRONMENT deploy:rollback"
|
78
|
-
]
|
71
|
+
"deploy": {
|
72
|
+
"override": [
|
73
|
+
"bundle exec cap $ENVIRONMENT deploy"
|
74
|
+
]
|
75
|
+
},
|
76
|
+
"rollback": {
|
77
|
+
"override": [
|
78
|
+
"bundle exec cap $ENVIRONMENT deploy:rollback"
|
79
|
+
]
|
80
|
+
}
|
79
81
|
}
|
80
|
-
|
81
|
-
)),
|
82
|
-
)
|
83
|
-
end
|
84
|
-
|
85
|
-
stacks.each do |stack|
|
86
|
-
50.times do |i|
|
87
|
-
user = users.sample
|
88
|
-
|
89
|
-
commit = Commit.create!(
|
90
|
-
stack_id: stack.id,
|
91
|
-
author_id: user.id,
|
92
|
-
committer_id: user.id,
|
93
|
-
sha: SecureRandom.hex(20),
|
94
|
-
message: Faker::Company.catch_phrase,
|
95
|
-
authored_at: Time.now,
|
96
|
-
committed_at: Time.now,
|
97
|
-
additions: Faker::Number.number(3),
|
98
|
-
deletions: Faker::Number.number(3),
|
82
|
+
)),
|
99
83
|
)
|
84
|
+
end
|
100
85
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
86
|
+
stacks.each do |stack|
|
87
|
+
50.times do |i|
|
88
|
+
user = users.sample
|
89
|
+
|
90
|
+
commit = Commit.create!(
|
91
|
+
stack_id: stack.id,
|
92
|
+
author_id: user.id,
|
93
|
+
committer_id: user.id,
|
94
|
+
sha: SecureRandom.hex(20),
|
95
|
+
message: Faker::Company.catch_phrase,
|
96
|
+
authored_at: Time.now,
|
97
|
+
committed_at: Time.now,
|
98
|
+
additions: Faker::Number.number(3),
|
99
|
+
deletions: Faker::Number.number(3),
|
100
|
+
)
|
110
101
|
|
111
|
-
if (i % 5) == 0
|
112
102
|
Status.create!(
|
113
103
|
state: %w(pending success error failure).sample,
|
114
|
-
context: 'ci/
|
115
|
-
description: "Your tests ran on
|
104
|
+
context: 'ci/travis',
|
105
|
+
description: "Your tests ran on travis-ci",
|
116
106
|
target_url: "https://example.com",
|
117
107
|
commit_id: commit.id,
|
118
108
|
created_at: Time.now,
|
119
109
|
updated_at: Time.now,
|
120
110
|
)
|
111
|
+
|
112
|
+
if (i % 5) == 0
|
113
|
+
Status.create!(
|
114
|
+
state: %w(pending success error failure).sample,
|
115
|
+
context: 'ci/circle',
|
116
|
+
description: "Your tests ran on circle-ci",
|
117
|
+
target_url: "https://example.com",
|
118
|
+
commit_id: commit.id,
|
119
|
+
created_at: Time.now,
|
120
|
+
updated_at: Time.now,
|
121
|
+
)
|
122
|
+
end
|
121
123
|
end
|
122
124
|
end
|
123
|
-
end
|
124
125
|
|
125
|
-
def create_chunks
|
126
|
-
|
127
|
-
|
128
|
-
|
126
|
+
def create_chunks
|
127
|
+
100.times.map do
|
128
|
+
status = "\x1b[%s;1m[ %s ]\x1b[0m" % [["31", "error"], ["32", "success"]].sample
|
129
|
+
OutputChunk.new(text: "[ #{Faker::Date.backward} ] #{status} #{Faker::Lorem.paragraph}\n")
|
130
|
+
end
|
129
131
|
end
|
130
|
-
end
|
131
132
|
|
132
|
-
stacks.each do |stack|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
133
|
+
stacks.each do |stack|
|
134
|
+
stack.commits.limit(45).each_slice(2).each do |commits|
|
135
|
+
deploy = stack.deploys.create!(
|
136
|
+
since_commit_id: commits.first.id,
|
137
|
+
until_commit_id: commits.last.id,
|
138
|
+
status: "success",
|
139
|
+
chunks: create_chunks,
|
140
|
+
additions: Faker::Number.number(3),
|
141
|
+
deletions: Faker::Number.number(3),
|
142
|
+
user: users.sample,
|
143
|
+
)
|
144
|
+
deploy.write("$ cap production deploy SHA=yolo")
|
145
|
+
end
|
146
|
+
|
147
|
+
last_deploy = stack.deploys.last
|
148
|
+
stack.rollbacks.create!(
|
149
|
+
since_commit_id: last_deploy.until_commit_id,
|
150
|
+
until_commit_id: last_deploy.since_commit_id,
|
151
|
+
status: 'success',
|
141
152
|
user: users.sample,
|
153
|
+
chunks: create_chunks,
|
142
154
|
)
|
143
|
-
deploy.write("$ cap production deploy SHA=yolo")
|
144
|
-
end
|
145
|
-
|
146
|
-
last_deploy = stack.deploys.last
|
147
|
-
stack.rollbacks.create!(
|
148
|
-
since_commit_id: last_deploy.until_commit_id,
|
149
|
-
until_commit_id: last_deploy.since_commit_id,
|
150
|
-
status: 'success',
|
151
|
-
user: users.sample,
|
152
|
-
chunks: create_chunks,
|
153
|
-
)
|
154
155
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
156
|
+
stack.tasks.create!(
|
157
|
+
since_commit_id: stack.last_deployed_commit.id,
|
158
|
+
until_commit_id: stack.last_deployed_commit.id,
|
159
|
+
status: "success",
|
160
|
+
user: users.sample,
|
161
|
+
definition: TaskDefinition.new('restart',
|
162
|
+
'action' => 'Restart application',
|
163
|
+
'description' => 'Restart unicorns and resques',
|
164
|
+
'steps' => ['cap $ENVIRONMENT restart'],
|
165
|
+
),
|
166
|
+
chunks: create_chunks,
|
167
|
+
)
|
168
|
+
end
|
167
169
|
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
File without changes
|
File without changes
|
File without changes
|
@@ -3,23 +3,23 @@ shipit_push:
|
|
3
3
|
event: push
|
4
4
|
secret: 1234
|
5
5
|
github_id: 42
|
6
|
-
type: GithubHook::Repo
|
6
|
+
type: Shipit::GithubHook::Repo
|
7
7
|
|
8
8
|
shipit_status:
|
9
9
|
stack: shipit
|
10
10
|
event: status
|
11
11
|
secret: 1234
|
12
12
|
github_id: 43
|
13
|
-
type: GithubHook::Repo
|
13
|
+
type: Shipit::GithubHook::Repo
|
14
14
|
|
15
15
|
cyclimse_push:
|
16
16
|
stack: cyclimse
|
17
17
|
event: push
|
18
18
|
secret: 1234
|
19
|
-
type: GithubHook::Repo
|
19
|
+
type: Shipit::GithubHook::Repo
|
20
20
|
|
21
21
|
shopify_membership:
|
22
22
|
organization: shopify
|
23
23
|
event: membership
|
24
24
|
secret: 1234
|
25
|
-
type: GithubHook::Organization
|
25
|
+
type: Shipit::GithubHook::Organization
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -2,7 +2,7 @@ shipit:
|
|
2
2
|
user: walrus
|
3
3
|
since_commit_id: 1 # first
|
4
4
|
until_commit_id: 2 # second
|
5
|
-
type: Deploy
|
5
|
+
type: Shipit::Deploy
|
6
6
|
stack: shipit
|
7
7
|
status: success
|
8
8
|
additions: 1
|
@@ -13,7 +13,7 @@ shipit2:
|
|
13
13
|
user: walrus
|
14
14
|
since_commit_id: 2 # second
|
15
15
|
until_commit_id: 3 # third
|
16
|
-
type: Deploy
|
16
|
+
type: Shipit::Deploy
|
17
17
|
stack: shipit
|
18
18
|
status: failed
|
19
19
|
additions: 12
|
@@ -24,7 +24,7 @@ shipit_restart:
|
|
24
24
|
user: walrus
|
25
25
|
since_commit_id: 2 # second
|
26
26
|
until_commit_id: 2 # second
|
27
|
-
type: Task
|
27
|
+
type: Shipit::Task
|
28
28
|
stack: shipit
|
29
29
|
status: success
|
30
30
|
definition: >
|
@@ -41,7 +41,7 @@ shipit_restart:
|
|
41
41
|
shipit_pending:
|
42
42
|
since_commit_id: 2 # second
|
43
43
|
until_commit_id: 4 # fourth
|
44
|
-
type: Deploy
|
44
|
+
type: Shipit::Deploy
|
45
45
|
stack: shipit
|
46
46
|
status: pending
|
47
47
|
additions: 432
|
@@ -52,7 +52,7 @@ shipit_running:
|
|
52
52
|
user: walrus
|
53
53
|
since_commit_id: 3
|
54
54
|
until_commit_id: 4
|
55
|
-
type: Deploy
|
55
|
+
type: Shipit::Deploy
|
56
56
|
stack: shipit
|
57
57
|
status: running
|
58
58
|
additions: 420
|
@@ -63,7 +63,7 @@ shipit_complete:
|
|
63
63
|
user: bob
|
64
64
|
since_commit_id: 3
|
65
65
|
until_commit_id: 4
|
66
|
-
type: Deploy
|
66
|
+
type: Shipit::Deploy
|
67
67
|
stack: shipit
|
68
68
|
status: success
|
69
69
|
additions: 420
|
@@ -74,7 +74,7 @@ shipit_aborted:
|
|
74
74
|
user: bob
|
75
75
|
since_commit_id: 3
|
76
76
|
until_commit_id: 4
|
77
|
-
type: Deploy
|
77
|
+
type: Shipit::Deploy
|
78
78
|
stack: shipit
|
79
79
|
status: aborted
|
80
80
|
additions: 420
|
@@ -87,7 +87,7 @@ shipit_rollback:
|
|
87
87
|
deploy: shipit_aborted
|
88
88
|
since_commit_id: 3
|
89
89
|
until_commit_id: 4
|
90
|
-
type: Rollback
|
90
|
+
type: Shipit::Rollback
|
91
91
|
stack: shipit
|
92
92
|
status: aborted
|
93
93
|
additions: 420
|
File without changes
|
File without changes
|
data/test/helpers/api_helper.rb
CHANGED
@@ -2,7 +2,7 @@ module ApiHelper
|
|
2
2
|
private
|
3
3
|
|
4
4
|
def authenticate!(client = @client || :spy)
|
5
|
-
client =
|
5
|
+
client = shipit_api_clients(client) if client.is_a?(Symbol)
|
6
6
|
@client ||= client
|
7
7
|
request.headers['Authorization'] = "Basic #{Base64.encode64(client.authentication_token)}"
|
8
8
|
end
|