shipit-engine 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -11
  3. data/app/assets/javascripts/shipit.js.coffee +7 -1
  4. data/app/assets/stylesheets/_base/_buttons.scss +3 -0
  5. data/app/assets/stylesheets/_base/_colors.scss +1 -1
  6. data/app/assets/stylesheets/_base/_status-items.scss +1 -1
  7. data/app/assets/stylesheets/_pages/_deploy.scss +1 -1
  8. data/app/assets/stylesheets/_structure/_main.scss +1 -1
  9. data/app/controllers/shipit/stacks_controller.rb +1 -5
  10. data/app/helpers/shipit/shipit_helper.rb +7 -9
  11. data/app/helpers/shipit/stacks_helper.rb +14 -28
  12. data/app/jobs/shipit/continuous_delivery_job.rb +1 -1
  13. data/app/jobs/shipit/update_estimated_deploy_duration.rb +9 -0
  14. data/app/models/shipit/commit_checks.rb +1 -1
  15. data/app/models/shipit/deploy.rb +1 -1
  16. data/app/models/shipit/deploy_spec/bundler_discovery.rb +1 -1
  17. data/app/models/shipit/deploy_spec/file_system.rb +6 -1
  18. data/app/models/shipit/deploy_spec.rb +12 -0
  19. data/app/models/shipit/duration.rb +29 -9
  20. data/app/models/shipit/github_hook.rb +0 -2
  21. data/app/models/shipit/stack.rb +48 -11
  22. data/app/models/shipit/task.rb +13 -2
  23. data/app/models/shipit/team.rb +1 -1
  24. data/app/models/shipit/undeployed_commit.rb +36 -0
  25. data/app/views/layouts/shipit.html.erb +6 -4
  26. data/app/views/shipit/deploys/show.html.erb +1 -1
  27. data/app/views/shipit/stacks/_header.html.erb +7 -0
  28. data/app/views/shipit/stacks/show.html.erb +1 -1
  29. data/config/locales/en.yml +9 -3
  30. data/config/secrets.development.example.yml +19 -0
  31. data/config/secrets.development.shopify.yml +19 -0
  32. data/config/secrets.development.yml +16 -0
  33. data/db/migrate/20160502150713_add_estimated_deploy_duration_to_stacks.rb +5 -0
  34. data/db/migrate/20160526192650_reorder_active_tasks_index.rb +7 -0
  35. data/lib/shipit/command.rb +15 -2
  36. data/lib/shipit/engine.rb +2 -1
  37. data/lib/shipit/stat.rb +13 -0
  38. data/lib/shipit/version.rb +1 -1
  39. data/lib/shipit.rb +13 -0
  40. data/lib/tasks/cron.rake +1 -0
  41. data/test/controllers/github_authentication_controller_test.rb +5 -5
  42. data/test/dummy/config/initializers/0_load_development_secrets.rb +9 -0
  43. data/test/dummy/config/secrets.yml +5 -16
  44. data/test/dummy/db/development.sqlite3 +0 -0
  45. data/test/dummy/db/schema.rb +14 -14
  46. data/test/dummy/db/seeds.rb +1 -0
  47. data/test/dummy/db/test.sqlite3 +0 -0
  48. data/test/fixtures/shipit/stacks.yml +2 -2
  49. data/test/fixtures/shipit/tasks.yml +3 -1
  50. data/test/fixtures/shipit/users.yml +5 -0
  51. data/test/helpers/queries_helper.rb +1 -1
  52. data/test/models/deploys_test.rb +7 -0
  53. data/test/models/duration_test.rb +23 -0
  54. data/test/models/stacks_test.rb +93 -4
  55. data/test/models/undeployed_commits_test.rb +100 -0
  56. data/test/test_helper.rb +1 -0
  57. data/test/unit/deploy_spec_test.rb +1 -1
  58. data/test/unit/shipit_test.rb +2 -1
  59. metadata +19 -10
  60. data/db/schema.rb +0 -188
  61. data/test/dummy/config/secrets.example.yml +0 -35
@@ -403,20 +403,44 @@ module Shipit
403
403
  assert_equal 'success', @stack.merge_status
404
404
  end
405
405
 
406
- test "#merge_status returns pending if all undeployed commits are in pending or unknown state" do
406
+ test "#merge_status returns pending if all undeployed commits and last deployed commit are in pending or unknown state" do
407
407
  shipit_commits(:fifth).statuses.destroy_all
408
408
  shipit_commits(:fourth).statuses.update_all(state: 'pending')
409
- @stack.expects(:last_deployed_commit).returns(shipit_commits(:third))
409
+ shipit_commits(:third).statuses.update_all(state: 'pending')
410
+ @stack.deploys_and_rollbacks.last.update!(status: 'success', until_commit: shipit_commits(:third))
410
411
 
411
412
  assert_equal 'pending', @stack.merge_status
412
413
  end
413
414
 
414
- test "#merge_status returns pending if there are no undeployed commits" do
415
- @stack.expects(:last_deployed_commit).returns(shipit_commits(:fifth))
415
+ test "#merge_status returns pending if there are no undeployed commits and no deployed commits" do
416
+ @stack.deploys_and_rollbacks.last.update(status: 'success', until_commit: shipit_commits(:fifth))
416
417
 
417
418
  assert_equal 'pending', @stack.merge_status
418
419
  end
419
420
 
421
+ test "#merge_status returns state of last deployed commit if there are no undeployed commits waiting" do
422
+ shipit_commits(:fifth).statuses.destroy_all
423
+ @stack.deploys_and_rollbacks.last.update!(status: 'success', until_commit: shipit_commits(:fourth))
424
+
425
+ shipit_commits(:fourth).statuses.update_all(state: 'success')
426
+ assert_equal 'success', @stack.merge_status
427
+
428
+ shipit_commits(:fourth).statuses.last.update(state: 'failure')
429
+ assert_equal 'failure', @stack.merge_status
430
+ end
431
+
432
+ test "#merge_status returns state of last deployed commit if all undeployed commits are in pending or unknown state" do
433
+ shipit_commits(:fifth).statuses.destroy_all
434
+ shipit_commits(:fourth).statuses.update_all(state: 'pending')
435
+ @stack.deploys_and_rollbacks.last.update!(status: 'success', until_commit: shipit_commits(:third))
436
+
437
+ shipit_commits(:third).statuses.update_all(state: 'success')
438
+ assert_equal 'success', @stack.merge_status
439
+
440
+ shipit_commits(:third).statuses.last.update(state: 'failure')
441
+ assert_equal 'failure', @stack.merge_status
442
+ end
443
+
420
444
  test "#handle_github_redirections update the stack if the repository was renamed" do
421
445
  repo_permalink = 'https://api.github.com/repositories/42'
422
446
 
@@ -437,5 +461,70 @@ module Shipit
437
461
  @stack.reload
438
462
  assert_equal 'george/shipster', @stack.github_repo_name
439
463
  end
464
+
465
+ test "#update_estimated_deploy_duration! records the 90th percentile duration among the last 100 deploys" do
466
+ assert_equal 1, @stack.estimated_deploy_duration
467
+ @stack.update_estimated_deploy_duration!
468
+ assert_equal 120, @stack.estimated_deploy_duration
469
+ end
470
+
471
+ test "#trigger_continuous_delivery bails out if the stack isn't deployable" do
472
+ refute_predicate @stack, :deployable?
473
+ refute_predicate @stack, :deployed_too_recently?
474
+ assert_no_enqueued_jobs do
475
+ assert_no_difference -> { Deploy.count } do
476
+ @stack.trigger_continuous_delivery
477
+ end
478
+ end
479
+ end
480
+
481
+ test "#trigger_continuous_delivery bails out if the stack is deployable but was deployed too recently" do
482
+ @stack.tasks.active.each(&:error!)
483
+ assert_predicate @stack, :deployable?
484
+ @stack.last_active_task.update(ended_at: 20.seconds.ago)
485
+ assert_predicate @stack, :deployed_too_recently?
486
+
487
+ assert_no_enqueued_jobs do
488
+ assert_no_difference -> { Deploy.count } do
489
+ @stack.trigger_continuous_delivery
490
+ end
491
+ end
492
+ end
493
+
494
+ test "#trigger_continuous_delivery trigger a deploy if all conditions are met" do
495
+ @stack.tasks.active.each(&:error!)
496
+ assert_predicate @stack, :deployable?
497
+ refute_predicate @stack, :deployed_too_recently?
498
+
499
+ assert_no_difference -> { Deploy.count } do
500
+ @stack.trigger_continuous_delivery
501
+ end
502
+ end
503
+
504
+ test "#next_commit_to_deploy returns the last deployable commit" do
505
+ @stack.tasks.where.not(until_commit_id: shipit_commits(:second).id).destroy_all
506
+ assert_equal shipit_commits(:second), @stack.last_deployed_commit
507
+
508
+ assert_equal shipit_commits(:third), @stack.next_commit_to_deploy
509
+
510
+ fifth_commit = shipit_commits(:fifth)
511
+ fifth_commit.statuses.create!(state: 'success', context: 'ci/travis')
512
+ assert_predicate fifth_commit, :deployable?
513
+
514
+ assert_equal shipit_commits(:fifth), @stack.next_commit_to_deploy
515
+ end
516
+
517
+ test "#next_commit_to_deploy respects the deploy.max_commits directive" do
518
+ @stack.tasks.destroy_all
519
+
520
+ fifth_commit = shipit_commits(:fifth)
521
+ fifth_commit.statuses.create!(state: 'success', context: 'ci/travis')
522
+ assert_predicate fifth_commit, :deployable?
523
+
524
+ assert_equal shipit_commits(:fifth), @stack.next_commit_to_deploy
525
+
526
+ @stack.expects(:maximum_commits_per_deploy).returns(3).at_least_once
527
+ assert_equal shipit_commits(:third), @stack.next_commit_to_deploy
528
+ end
440
529
  end
441
530
  end
@@ -0,0 +1,100 @@
1
+ require 'test_helper'
2
+
3
+ module Shipit
4
+ class UndeployedCommitsTest < ActiveSupport::TestCase
5
+ setup do
6
+ @real_commit = shipit_commits(:cyclimse_first)
7
+ @commit = UndeployedCommit.new(@real_commit, 0)
8
+ @stack = @commit.stack
9
+ end
10
+
11
+ test "#deploy_disallowed? returns false if the commit and the stack are deployable" do
12
+ assert_predicate @commit, :deployable?
13
+ assert_predicate @stack, :deployable?
14
+ refute_predicate @commit, :deploy_disallowed?
15
+ end
16
+
17
+ test "#deploy_disallowed? returns false if the commit isn't deployable" do
18
+ @commit.statuses.update_all(state: 'failure')
19
+ refute_predicate @commit, :deployable?
20
+ assert_predicate @stack, :deployable?
21
+ assert_predicate @commit, :deploy_disallowed?
22
+ end
23
+
24
+ test "#deploy_disallowed? returns false if the stack isn't deployable" do
25
+ @stack.update!(lock_reason: "Let's eat some chips!")
26
+ assert_predicate @commit, :deployable?
27
+ refute_predicate @stack, :deployable?
28
+ assert_predicate @commit, :deploy_disallowed?
29
+ end
30
+
31
+ test "#deploy_discouraged? returns false if the commit index is lower than the maximum commits per deploy" do
32
+ assert_equal 2, @stack.maximum_commits_per_deploy
33
+ refute_predicate @commit, :deploy_discouraged?
34
+ end
35
+
36
+ test "#deploy_discouraged? returns true if the commit index is equal or bigger then the maximum commits per deploy" do
37
+ @commit = UndeployedCommit.new(@real_commit, 2)
38
+ assert_equal 2, @stack.maximum_commits_per_deploy
39
+ assert_predicate @commit, :deploy_discouraged?
40
+ end
41
+
42
+ test "#deploy_state returns `allowed` by default" do
43
+ assert_equal 'allowed', @commit.deploy_state
44
+ end
45
+
46
+ test "#deploy_state returns `locked` if the stack is locked" do
47
+ @stack.update!(lock_reason: "Let's eat some chips!")
48
+ assert_equal 'locked', @commit.deploy_state
49
+ end
50
+
51
+ test "#deploy_state returns `allowed` if the stack is locked but the safeties are ignored" do
52
+ @stack.update!(lock_reason: "Let's eat some chips!")
53
+ assert_equal 'allowed', @commit.deploy_state(true)
54
+ end
55
+
56
+ test "#deploy_state returns `deploying` if the stack is already being deployed" do
57
+ @stack.trigger_deploy(@real_commit, AnonymousUser.new)
58
+ assert_equal 'deploying', @commit.deploy_state
59
+ end
60
+
61
+ test "#deploy_state returns `allowed` if the stack is already being deployed but the safeties are ignored" do
62
+ @stack.trigger_deploy(@real_commit, AnonymousUser.new)
63
+ assert_equal 'allowed', @commit.deploy_state(true)
64
+ end
65
+
66
+ test "#deploy_state returns the commit state if it isn't deployable" do
67
+ @commit.statuses.update_all(state: 'failure')
68
+ assert_equal 'failure', @commit.deploy_state(true)
69
+ end
70
+
71
+ test "#redeploy_state returns `allowed` by default" do
72
+ assert_equal 'allowed', @commit.redeploy_state
73
+ end
74
+
75
+ test "#redeploy_state returns `locked` if the stack is locked" do
76
+ @stack.update!(lock_reason: "Let's eat some chips!")
77
+ assert_equal 'locked', @commit.redeploy_state
78
+ end
79
+
80
+ test "#redeploy_state returns `allowed` if the stack is locked but the safeties are ignored" do
81
+ @stack.update!(lock_reason: "Let's eat some chips!")
82
+ assert_equal 'allowed', @commit.redeploy_state(true)
83
+ end
84
+
85
+ test "#redeploy_state returns `deploying` if the stack is already being deployed" do
86
+ @stack.trigger_deploy(@real_commit, AnonymousUser.new)
87
+ assert_equal 'deploying', @commit.redeploy_state
88
+ end
89
+
90
+ test "#redeploy_state returns `allowed` if the stack is already being deployed but the safeties are ignored" do
91
+ @stack.trigger_deploy(@real_commit, AnonymousUser.new)
92
+ assert_equal 'allowed', @commit.redeploy_state(true)
93
+ end
94
+
95
+ test "#redeploy_state returns `allowed` even if it isn't deployable" do
96
+ @commit.statuses.update_all(state: 'failure')
97
+ assert_equal 'allowed', @commit.redeploy_state(true)
98
+ end
99
+ end
100
+ end
data/test/test_helper.rb CHANGED
@@ -43,6 +43,7 @@ class ActiveSupport::TestCase
43
43
  setup do
44
44
  @routes = Shipit::Engine.routes
45
45
  Process.stubs(:kill)
46
+ Shipit.github_api.stubs(:login).returns('shipit')
46
47
  end
47
48
 
48
49
  teardown do
@@ -230,7 +230,7 @@ module Shipit
230
230
  'review' => {'checklist' => [], 'monitoring' => [], 'checks' => []},
231
231
  'dependencies' => {'override' => []},
232
232
  'plugins' => {},
233
- 'deploy' => {'override' => nil, 'variables' => []},
233
+ 'deploy' => {'override' => nil, 'variables' => [], 'max_commits' => nil, 'interval' => 0},
234
234
  'rollback' => {'override' => nil},
235
235
  'fetch' => nil,
236
236
  'tasks' => {},
@@ -57,7 +57,8 @@ module Shipit
57
57
  test ".github_teams merges the teams and team keys in a single array" do
58
58
  Rails.application.secrets.stubs(:github_oauth).returns(
59
59
  'team' => 'shopify/developers',
60
- 'teams' => ['shopify/developers', 'cyclimse/cooks'])
60
+ 'teams' => ['shopify/developers', 'cyclimse/cooks'],
61
+ )
61
62
  assert_equal(['cyclimse/cooks', 'shopify/developers'], Shipit.github_teams.map(&:handle))
62
63
  end
63
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipit-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-28 00:00:00.000000000 Z
11
+ date: 2016-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: pubsubstub
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.0.14
117
+ version: 0.1.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.0.14
124
+ version: 0.1.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: safe_yaml
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -537,6 +537,7 @@ files:
537
537
  - app/jobs/shipit/refresh_github_user_job.rb
538
538
  - app/jobs/shipit/refresh_statuses_job.rb
539
539
  - app/jobs/shipit/setup_github_hook_job.rb
540
+ - app/jobs/shipit/update_estimated_deploy_duration.rb
540
541
  - app/models/shipit/anonymous_user.rb
541
542
  - app/models/shipit/api_client.rb
542
543
  - app/models/shipit/commit.rb
@@ -564,6 +565,7 @@ files:
564
565
  - app/models/shipit/task.rb
565
566
  - app/models/shipit/task_definition.rb
566
567
  - app/models/shipit/team.rb
568
+ - app/models/shipit/undeployed_commit.rb
567
569
  - app/models/shipit/unknown_status.rb
568
570
  - app/models/shipit/user.rb
569
571
  - app/models/shipit/variable_definition.rb
@@ -612,6 +614,9 @@ files:
612
614
  - app/views/shipit/tasks/show.html.erb
613
615
  - config/locales/en.yml
614
616
  - config/routes.rb
617
+ - config/secrets.development.example.yml
618
+ - config/secrets.development.shopify.yml
619
+ - config/secrets.development.yml
615
620
  - db/migrate/20140226233935_create_baseline.rb
616
621
  - db/migrate/20150515190352_add_output_column_to_tasks.rb
617
622
  - db/migrate/20150518214944_add_ignore_ci_to_stack.rb
@@ -633,7 +638,8 @@ files:
633
638
  - db/migrate/20160303203940_add_encrypted_token_to_users.rb
634
639
  - db/migrate/20160324155046_add_started_at_and_ended_at_on_tasks.rb
635
640
  - db/migrate/20160426155146_add_index_for_stack_active_task.rb
636
- - db/schema.rb
641
+ - db/migrate/20160502150713_add_estimated_deploy_duration_to_stacks.rb
642
+ - db/migrate/20160526192650_reorder_active_tasks_index.rb
637
643
  - lib/shipit-engine.rb
638
644
  - lib/shipit.rb
639
645
  - lib/shipit/command.rb
@@ -649,6 +655,7 @@ files:
649
655
  - lib/shipit/rollback_commands.rb
650
656
  - lib/shipit/simple_message_verifier.rb
651
657
  - lib/shipit/stack_commands.rb
658
+ - lib/shipit/stat.rb
652
659
  - lib/shipit/task_commands.rb
653
660
  - lib/shipit/template_renderer_extension.rb
654
661
  - lib/shipit/version.rb
@@ -698,6 +705,7 @@ files:
698
705
  - test/dummy/config/environments/development.rb
699
706
  - test/dummy/config/environments/production.rb
700
707
  - test/dummy/config/environments/test.rb
708
+ - test/dummy/config/initializers/0_load_development_secrets.rb
701
709
  - test/dummy/config/initializers/assets.rb
702
710
  - test/dummy/config/initializers/backtrace_silencers.rb
703
711
  - test/dummy/config/initializers/cookies_serializer.rb
@@ -708,7 +716,6 @@ files:
708
716
  - test/dummy/config/initializers/wrap_parameters.rb
709
717
  - test/dummy/config/locales/en.yml
710
718
  - test/dummy/config/routes.rb
711
- - test/dummy/config/secrets.example.yml
712
719
  - test/dummy/config/secrets.yml
713
720
  - test/dummy/db/development.sqlite3
714
721
  - test/dummy/db/schema.rb
@@ -774,6 +781,7 @@ files:
774
781
  - test/models/status_test.rb
775
782
  - test/models/task_definitions_test.rb
776
783
  - test/models/team_test.rb
784
+ - test/models/undeployed_commits_test.rb
777
785
  - test/models/users_test.rb
778
786
  - test/test_command_integration.rb
779
787
  - test/test_helper.rb
@@ -811,7 +819,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
811
819
  version: '0'
812
820
  requirements: []
813
821
  rubyforge_project:
814
- rubygems_version: 2.4.6
822
+ rubygems_version: 2.2.5
815
823
  signing_key:
816
824
  specification_version: 4
817
825
  summary: Application deployment software
@@ -849,6 +857,7 @@ test_files:
849
857
  - test/dummy/config/environments/development.rb
850
858
  - test/dummy/config/environments/production.rb
851
859
  - test/dummy/config/environments/test.rb
860
+ - test/dummy/config/initializers/0_load_development_secrets.rb
852
861
  - test/dummy/config/initializers/assets.rb
853
862
  - test/dummy/config/initializers/backtrace_silencers.rb
854
863
  - test/dummy/config/initializers/cookies_serializer.rb
@@ -859,7 +868,6 @@ test_files:
859
868
  - test/dummy/config/initializers/wrap_parameters.rb
860
869
  - test/dummy/config/locales/en.yml
861
870
  - test/dummy/config/routes.rb
862
- - test/dummy/config/secrets.example.yml
863
871
  - test/dummy/config/secrets.yml
864
872
  - test/dummy/config.ru
865
873
  - test/dummy/db/development.sqlite3
@@ -927,6 +935,7 @@ test_files:
927
935
  - test/models/status_test.rb
928
936
  - test/models/task_definitions_test.rb
929
937
  - test/models/team_test.rb
938
+ - test/models/undeployed_commits_test.rb
930
939
  - test/models/users_test.rb
931
940
  - test/test_command_integration.rb
932
941
  - test/test_helper.rb
data/db/schema.rb DELETED
@@ -1,188 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20150424175630) do
15
-
16
- create_table "api_clients", force: :cascade do |t|
17
- t.text "permissions", limit: 65535
18
- t.integer "creator_id", limit: 4
19
- t.datetime "created_at", null: false
20
- t.datetime "updated_at", null: false
21
- t.string "name", limit: 255, default: ""
22
- t.integer "stack_id", limit: 4
23
- end
24
-
25
- add_index "api_clients", ["creator_id"], name: "index_api_clients_on_creator_id", using: :btree
26
-
27
- create_table "commits", force: :cascade do |t|
28
- t.integer "stack_id", limit: 4, null: false
29
- t.integer "author_id", limit: 4, null: false
30
- t.integer "committer_id", limit: 4, null: false
31
- t.string "sha", limit: 40, null: false
32
- t.text "message", limit: 65535, null: false
33
- t.datetime "created_at"
34
- t.datetime "updated_at"
35
- t.boolean "detached", default: false, null: false
36
- t.datetime "authored_at", null: false
37
- t.datetime "committed_at", null: false
38
- t.integer "additions", limit: 4, default: 0
39
- t.integer "deletions", limit: 4, default: 0
40
- end
41
-
42
- add_index "commits", ["author_id"], name: "index_commits_on_author_id", using: :btree
43
- add_index "commits", ["committer_id"], name: "index_commits_on_committer_id", using: :btree
44
- add_index "commits", ["created_at"], name: "index_commits_on_created_at", using: :btree
45
- add_index "commits", ["stack_id"], name: "index_commits_on_stack_id", using: :btree
46
-
47
- create_table "deliveries", force: :cascade do |t|
48
- t.integer "hook_id", limit: 4, null: false
49
- t.string "status", limit: 255, default: "pending", null: false
50
- t.string "url", limit: 4096, null: false
51
- t.string "content_type", limit: 255, null: false
52
- t.string "event", limit: 255, null: false
53
- t.text "payload", limit: 16777215, null: false
54
- t.integer "response_code", limit: 4
55
- t.text "response_headers", limit: 65535
56
- t.text "response_body", limit: 65535
57
- t.datetime "delivered_at"
58
- t.datetime "created_at", null: false
59
- t.datetime "updated_at", null: false
60
- end
61
-
62
- create_table "github_hooks", force: :cascade do |t|
63
- t.integer "stack_id", limit: 4
64
- t.integer "github_id", limit: 4
65
- t.string "event", limit: 255
66
- t.datetime "created_at"
67
- t.datetime "updated_at"
68
- t.string "secret", limit: 255
69
- t.string "api_url", limit: 255
70
- t.string "type", limit: 255
71
- t.string "organization", limit: 255
72
- end
73
-
74
- add_index "github_hooks", ["organization", "event"], name: "index_github_hooks_on_organization_and_event", unique: true, using: :btree
75
- add_index "github_hooks", ["stack_id", "event"], name: "index_github_hooks_on_stack_id_and_event", unique: true, using: :btree
76
-
77
- create_table "hooks", force: :cascade do |t|
78
- t.integer "stack_id", limit: 4
79
- t.string "url", limit: 4096, null: false
80
- t.string "content_type", limit: 4, default: "json", null: false
81
- t.string "secret", limit: 255
82
- t.string "events", limit: 255, default: "", null: false
83
- t.boolean "insecure_ssl", default: false, null: false
84
- t.datetime "created_at", null: false
85
- t.datetime "updated_at", null: false
86
- end
87
-
88
- add_index "hooks", ["stack_id"], name: "index_hooks_on_stack_id", using: :btree
89
-
90
- create_table "memberships", force: :cascade do |t|
91
- t.integer "team_id", limit: 4
92
- t.integer "user_id", limit: 4
93
- t.datetime "created_at", null: false
94
- t.datetime "updated_at", null: false
95
- end
96
-
97
- add_index "memberships", ["team_id", "user_id"], name: "index_memberships_on_team_id_and_user_id", unique: true, using: :btree
98
- add_index "memberships", ["user_id"], name: "index_memberships_on_user_id", using: :btree
99
-
100
- create_table "output_chunks", force: :cascade do |t|
101
- t.integer "task_id", limit: 4
102
- t.text "text", limit: 16777215
103
- t.datetime "created_at"
104
- t.datetime "updated_at"
105
- end
106
-
107
- add_index "output_chunks", ["task_id"], name: "index_output_chunks_on_task_id", using: :btree
108
-
109
- create_table "stacks", force: :cascade do |t|
110
- t.string "repo_name", limit: 255, null: false
111
- t.string "repo_owner", limit: 255, null: false
112
- t.string "environment", limit: 255, default: "production", null: false
113
- t.datetime "created_at"
114
- t.datetime "updated_at"
115
- t.string "branch", limit: 255, default: "master", null: false
116
- t.string "deploy_url", limit: 255
117
- t.string "lock_reason", limit: 255
118
- t.integer "tasks_count", limit: 4, default: 0, null: false
119
- t.boolean "continuous_deployment", default: false, null: false
120
- t.integer "undeployed_commits_count", limit: 4, default: 0, null: false
121
- t.text "cached_deploy_spec", limit: 65535
122
- t.integer "lock_author_id", limit: 4
123
- end
124
-
125
- add_index "stacks", ["repo_owner", "repo_name", "environment"], name: "stack_unicity", unique: true, using: :btree
126
-
127
- create_table "statuses", force: :cascade do |t|
128
- t.string "state", limit: 255
129
- t.string "target_url", limit: 255
130
- t.text "description", limit: 65535
131
- t.string "context", limit: 255, default: "default", null: false
132
- t.integer "commit_id", limit: 4
133
- t.datetime "created_at"
134
- t.datetime "updated_at"
135
- end
136
-
137
- add_index "statuses", ["commit_id"], name: "index_statuses_on_commit_id", using: :btree
138
-
139
- create_table "tasks", force: :cascade do |t|
140
- t.integer "stack_id", limit: 4, null: false
141
- t.integer "since_commit_id", limit: 4, null: false
142
- t.integer "until_commit_id", limit: 4, null: false
143
- t.string "status", limit: 255, default: "pending", null: false
144
- t.datetime "created_at"
145
- t.datetime "updated_at"
146
- t.integer "user_id", limit: 4
147
- t.boolean "rolled_up", default: false, null: false
148
- t.string "type", limit: 255
149
- t.integer "parent_id", limit: 4
150
- t.integer "additions", limit: 4, default: 0
151
- t.integer "deletions", limit: 4, default: 0
152
- t.text "definition", limit: 65535
153
- end
154
-
155
- add_index "tasks", ["rolled_up", "created_at", "status"], name: "index_tasks_on_rolled_up_and_created_at_and_status", using: :btree
156
- add_index "tasks", ["since_commit_id"], name: "index_tasks_on_since_commit_id", using: :btree
157
- add_index "tasks", ["stack_id"], name: "index_tasks_on_stack_id", using: :btree
158
- add_index "tasks", ["until_commit_id"], name: "index_tasks_on_until_commit_id", using: :btree
159
- add_index "tasks", ["user_id"], name: "index_tasks_on_user_id", using: :btree
160
-
161
- create_table "teams", force: :cascade do |t|
162
- t.integer "github_id", limit: 4
163
- t.string "api_url", limit: 255
164
- t.string "slug", limit: 255
165
- t.string "name", limit: 255
166
- t.string "organization", limit: 255
167
- t.datetime "created_at", null: false
168
- t.datetime "updated_at", null: false
169
- end
170
-
171
- add_index "teams", ["organization", "slug"], name: "index_teams_on_organization_and_slug", unique: true, using: :btree
172
-
173
- create_table "users", force: :cascade do |t|
174
- t.integer "github_id", limit: 4
175
- t.string "name", limit: 255, null: false
176
- t.string "email", limit: 255
177
- t.string "login", limit: 255
178
- t.string "api_url", limit: 255
179
- t.datetime "created_at"
180
- t.datetime "updated_at"
181
- t.string "avatar_url", limit: 255
182
- end
183
-
184
- add_index "users", ["login"], name: "index_users_on_login", using: :btree
185
-
186
- add_foreign_key "memberships", "teams"
187
- add_foreign_key "memberships", "users"
188
- end
@@ -1,35 +0,0 @@
1
- development:
2
- secret_key_base: s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t
3
- github_oauth:
4
- # id:
5
- # secret:
6
- # teams:
7
- # -
8
- # -
9
- github_api:
10
- # access_token:
11
- # login:
12
- # password:
13
- # api_endpoint:
14
- host: 'http://localhost:3000'
15
- redis_url: "redis://127.0.0.1:6379/7"
16
- # features:
17
- # - bootstrap
18
-
19
- test:
20
- secret_key_base: s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3t
21
- host: shipit.com
22
- github_api:
23
- access_token: t0kEn
24
- # login:
25
- # password:
26
- # api_endpoint:
27
- github_oauth:
28
- id: 1d
29
- secret: s3cr37
30
- # teams:
31
- # -
32
- # -
33
- redis_url: "redis://127.0.0.1:6379/7"
34
- # features:
35
- # - bootstrap