kuroko2 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/controllers/kuroko2/api/application_controller.rb +4 -0
- data/app/controllers/kuroko2/api/job_definitions_controller.rb +64 -0
- data/app/controllers/kuroko2/job_definitions_controller.rb +9 -2
- data/app/errors/http/unprocessable_entity.rb +4 -0
- data/app/models/kuroko2/api/job_definition_resource.rb +11 -0
- data/app/models/kuroko2/job_definition.rb +1 -1
- data/app/views/kuroko2/job_definitions/_alert.html.slim +1 -1
- data/app/views/kuroko2/job_definitions/_list.html.slim +4 -1
- data/app/views/kuroko2/job_definitions/_search_results.html.slim +4 -1
- data/app/views/kuroko2/job_definitions/show.html.slim +4 -2
- data/app/views/kuroko2/job_timelines/dataset.json.jbuilder +1 -1
- data/app/views/kuroko2/users/index.html.slim +1 -1
- data/config/routes.rb +2 -2
- data/db/migrate/030_add_notify_back_to_normal.rb +5 -0
- data/lib/autoload/kuroko2/workflow/engine.rb +6 -2
- data/lib/autoload/kuroko2/workflow/notifier/concerns/chat_message_builder.rb +4 -0
- data/lib/autoload/kuroko2/workflow/notifier/hipchat.rb +5 -0
- data/lib/autoload/kuroko2/workflow/notifier/mail.rb +4 -0
- data/lib/autoload/kuroko2/workflow/notifier/slack.rb +7 -0
- data/lib/autoload/kuroko2/workflow/notifier/webhook.rb +10 -0
- data/lib/kuroko2/version.rb +1 -1
- data/spec/controllers/job_definitions_controller_spec.rb +62 -0
- data/spec/dummy/db/schema.rb +133 -132
- data/spec/dummy/log/test.log +667 -0
- data/spec/features/job_instance_spec.rb +4 -5
- data/spec/requests/api/job_definitions_spec.rb +178 -0
- data/spec/workflow/engine_spec.rb +2 -0
- data/spec/workflow/notifier/hipchat_spec.rb +11 -0
- data/spec/workflow/notifier/mail_spec.rb +8 -0
- data/spec/workflow/notifier/slack_spec.rb +9 -0
- data/spec/workflow/notifier/webhook_spec.rb +11 -0
- metadata +9 -3
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,194 +10,195 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 30) do
|
14
14
|
|
15
|
-
create_table "admin_assignments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
16
|
-
t.integer
|
17
|
-
t.integer
|
15
|
+
create_table "admin_assignments", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
16
|
+
t.integer "user_id", null: false
|
17
|
+
t.integer "job_definition_id", null: false
|
18
18
|
t.datetime "created_at"
|
19
19
|
t.datetime "updated_at"
|
20
|
-
t.index ["user_id", "job_definition_id"], name: "user_id", unique: true
|
21
|
-
end
|
22
|
-
|
23
|
-
create_table "executions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
24
|
-
t.string
|
25
|
-
t.integer
|
26
|
-
t.integer
|
27
|
-
t.integer
|
28
|
-
t.integer
|
29
|
-
t.string
|
30
|
-
t.text
|
31
|
-
t.text
|
32
|
-
t.integer
|
33
|
-
t.text
|
34
|
-
t.integer
|
35
|
-
t.integer
|
20
|
+
t.index ["user_id", "job_definition_id"], name: "user_id", unique: true
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table "executions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
24
|
+
t.string "uuid", limit: 36, null: false
|
25
|
+
t.integer "job_definition_id"
|
26
|
+
t.integer "job_definition_version"
|
27
|
+
t.integer "job_instance_id"
|
28
|
+
t.integer "token_id"
|
29
|
+
t.string "queue", limit: 180, default: "@default", null: false
|
30
|
+
t.text "shell", null: false
|
31
|
+
t.text "context", null: false
|
32
|
+
t.integer "pid"
|
33
|
+
t.text "output", limit: 4294967295
|
34
|
+
t.integer "exit_status", limit: 2
|
35
|
+
t.integer "term_signal", limit: 1
|
36
36
|
t.datetime "started_at"
|
37
37
|
t.datetime "finished_at"
|
38
38
|
t.datetime "mailed_at"
|
39
39
|
t.datetime "created_at"
|
40
40
|
t.datetime "updated_at"
|
41
|
-
t.index ["job_definition_id", "token_id"], name: "
|
42
|
-
t.index ["started_at"], name: "started_at"
|
43
|
-
end
|
44
|
-
|
45
|
-
create_table "job_definition_tags", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
46
|
-
t.integer
|
47
|
-
t.integer
|
48
|
-
t.datetime "created_at",
|
49
|
-
t.datetime "updated_at",
|
50
|
-
t.index ["job_definition_id", "tag_id"], name: "
|
51
|
-
t.index ["tag_id"], name: "job_definition_tags_tag_id"
|
52
|
-
end
|
53
|
-
|
54
|
-
create_table "job_definitions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
55
|
-
t.integer
|
56
|
-
t.string
|
57
|
-
t.text
|
58
|
-
t.text
|
59
|
-
t.boolean
|
60
|
-
t.integer
|
61
|
-
t.boolean
|
62
|
-
t.string
|
63
|
-
t.boolean
|
64
|
-
t.string
|
65
|
-
t.string
|
66
|
-
t.boolean
|
41
|
+
t.index ["job_definition_id", "token_id"], name: "index_kuroko2_executions_on_job_definition_id_and_token_id", unique: true
|
42
|
+
t.index ["started_at"], name: "started_at"
|
43
|
+
end
|
44
|
+
|
45
|
+
create_table "job_definition_tags", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
46
|
+
t.integer "job_definition_id", null: false
|
47
|
+
t.integer "tag_id", null: false
|
48
|
+
t.datetime "created_at", null: false
|
49
|
+
t.datetime "updated_at", null: false
|
50
|
+
t.index ["job_definition_id", "tag_id"], name: "kuroko2_definition_tag_idx", unique: true
|
51
|
+
t.index ["tag_id"], name: "job_definition_tags_tag_id"
|
52
|
+
end
|
53
|
+
|
54
|
+
create_table "job_definitions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
55
|
+
t.integer "version", default: 0, null: false
|
56
|
+
t.string "name", limit: 180, null: false
|
57
|
+
t.text "description", null: false
|
58
|
+
t.text "script", null: false
|
59
|
+
t.boolean "suspended", default: false, null: false
|
60
|
+
t.integer "prevent_multi", default: 1, null: false
|
61
|
+
t.boolean "notify_cancellation", default: true, null: false
|
62
|
+
t.string "hipchat_room", limit: 180, default: "", null: false
|
63
|
+
t.boolean "hipchat_notify_finished", default: true, null: false
|
64
|
+
t.string "hipchat_additional_text", limit: 180
|
65
|
+
t.string "slack_channel", limit: 180, default: "", null: false
|
66
|
+
t.boolean "api_allowed", default: false, null: false
|
67
67
|
t.datetime "created_at"
|
68
68
|
t.datetime "updated_at"
|
69
|
-
t.text
|
70
|
-
t.index ["name"], name: "name"
|
69
|
+
t.text "webhook_url"
|
70
|
+
t.index ["name"], name: "name"
|
71
71
|
end
|
72
72
|
|
73
|
-
create_table "job_instances", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
74
|
-
t.integer
|
75
|
-
t.integer
|
76
|
-
t.text
|
73
|
+
create_table "job_instances", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
74
|
+
t.integer "job_definition_id"
|
75
|
+
t.integer "job_definition_version"
|
76
|
+
t.text "script"
|
77
77
|
t.datetime "finished_at"
|
78
78
|
t.datetime "canceled_at"
|
79
79
|
t.datetime "error_at"
|
80
80
|
t.datetime "created_at"
|
81
81
|
t.datetime "updated_at"
|
82
|
-
t.
|
83
|
-
t.index ["
|
82
|
+
t.boolean "retrying", default: false, null: false
|
83
|
+
t.index ["finished_at", "canceled_at", "job_definition_id"], name: "job_instance_idx"
|
84
|
+
t.index ["job_definition_id"], name: "index_kuroko2_job_instances_on_job_definition_id"
|
84
85
|
end
|
85
86
|
|
86
|
-
create_table "job_schedules", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
87
|
-
t.integer
|
88
|
-
t.string
|
87
|
+
create_table "job_schedules", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
88
|
+
t.integer "job_definition_id"
|
89
|
+
t.string "cron", limit: 180
|
89
90
|
t.datetime "created_at"
|
90
91
|
t.datetime "updated_at"
|
91
|
-
t.index ["job_definition_id", "cron"], name: "
|
92
|
+
t.index ["job_definition_id", "cron"], name: "kuroko2_schedules_definition_id_cron_idx", unique: true
|
92
93
|
end
|
93
94
|
|
94
|
-
create_table "job_suspend_schedules", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
95
|
-
t.integer
|
96
|
-
t.string
|
97
|
-
t.datetime "created_at",
|
98
|
-
t.datetime "updated_at",
|
99
|
-
t.index ["job_definition_id", "cron"], name: "
|
95
|
+
create_table "job_suspend_schedules", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
96
|
+
t.integer "job_definition_id"
|
97
|
+
t.string "cron", limit: 180
|
98
|
+
t.datetime "created_at", null: false
|
99
|
+
t.datetime "updated_at", null: false
|
100
|
+
t.index ["job_definition_id", "cron"], name: "kuroko2_suspend_schedules_definition_id_cron_idx", unique: true
|
100
101
|
end
|
101
102
|
|
102
|
-
create_table "logs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
103
|
-
t.integer
|
104
|
-
t.string
|
105
|
-
t.text
|
103
|
+
create_table "logs", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
104
|
+
t.integer "job_instance_id"
|
105
|
+
t.string "level", limit: 10
|
106
|
+
t.text "message", limit: 4294967295
|
106
107
|
t.datetime "created_at"
|
107
108
|
t.datetime "updated_at"
|
108
|
-
t.index ["job_instance_id"], name: "job_instance_id"
|
109
|
+
t.index ["job_instance_id"], name: "job_instance_id"
|
109
110
|
end
|
110
111
|
|
111
|
-
create_table "memory_consumption_logs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
112
|
-
t.integer
|
113
|
-
t.integer
|
114
|
-
t.datetime "created_at",
|
115
|
-
t.datetime "updated_at",
|
116
|
-
t.index ["job_instance_id"], name: "
|
112
|
+
create_table "memory_consumption_logs", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
113
|
+
t.integer "job_instance_id"
|
114
|
+
t.integer "value", null: false
|
115
|
+
t.datetime "created_at", null: false
|
116
|
+
t.datetime "updated_at", null: false
|
117
|
+
t.index ["job_instance_id"], name: "index_kuroko2_memory_consumption_logs_on_job_instance_id"
|
117
118
|
end
|
118
119
|
|
119
|
-
create_table "memory_expectancies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
120
|
-
t.integer
|
121
|
-
t.integer
|
122
|
-
t.datetime "created_at",
|
123
|
-
t.datetime "updated_at",
|
124
|
-
t.index ["job_definition_id"], name: "
|
120
|
+
create_table "memory_expectancies", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
121
|
+
t.integer "expected_value", default: 0, null: false
|
122
|
+
t.integer "job_definition_id"
|
123
|
+
t.datetime "created_at", null: false
|
124
|
+
t.datetime "updated_at", null: false
|
125
|
+
t.index ["job_definition_id"], name: "index_kuroko2_memory_expectancies_on_job_definition_id"
|
125
126
|
end
|
126
127
|
|
127
|
-
create_table "process_signals", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
128
|
-
t.string
|
129
|
-
t.integer
|
130
|
-
t.integer
|
128
|
+
create_table "process_signals", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
129
|
+
t.string "hostname", limit: 180, default: "", null: false
|
130
|
+
t.integer "pid", null: false
|
131
|
+
t.integer "number", limit: 1, default: 15, null: false
|
131
132
|
t.datetime "started_at"
|
132
133
|
t.datetime "created_at"
|
133
134
|
t.datetime "updated_at"
|
134
|
-
t.text
|
135
|
-
t.integer
|
136
|
-
t.index ["execution_id"], name: "index_kuroko2_process_signals_on_execution_id"
|
137
|
-
t.index ["hostname", "started_at"], name: "hostname_started_at"
|
135
|
+
t.text "message"
|
136
|
+
t.integer "execution_id"
|
137
|
+
t.index ["execution_id"], name: "index_kuroko2_process_signals_on_execution_id"
|
138
|
+
t.index ["hostname", "started_at"], name: "hostname_started_at"
|
138
139
|
end
|
139
140
|
|
140
|
-
create_table "stars", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
141
|
-
t.integer
|
142
|
-
t.integer
|
141
|
+
create_table "stars", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
142
|
+
t.integer "user_id", null: false
|
143
|
+
t.integer "job_definition_id", null: false
|
143
144
|
t.datetime "created_at"
|
144
145
|
t.datetime "updated_at"
|
145
|
-
t.index ["user_id", "job_definition_id"], name: "
|
146
|
+
t.index ["user_id", "job_definition_id"], name: "index_kuroko2_stars_on_user_id_and_job_definition_id", unique: true
|
146
147
|
end
|
147
148
|
|
148
|
-
create_table "tags", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
149
|
-
t.string
|
150
|
-
t.datetime "created_at",
|
151
|
-
t.datetime "updated_at",
|
152
|
-
t.index ["name"], name: "
|
149
|
+
create_table "tags", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
150
|
+
t.string "name", limit: 100, null: false
|
151
|
+
t.datetime "created_at", null: false
|
152
|
+
t.datetime "updated_at", null: false
|
153
|
+
t.index ["name"], name: "index_kuroko2_tags_on_name", unique: true
|
153
154
|
end
|
154
155
|
|
155
|
-
create_table "ticks", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
156
|
+
create_table "ticks", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
156
157
|
t.datetime "at"
|
157
158
|
end
|
158
159
|
|
159
|
-
create_table "tokens", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
160
|
-
t.string
|
161
|
-
t.integer
|
162
|
-
t.integer
|
163
|
-
t.integer
|
164
|
-
t.integer
|
165
|
-
t.text
|
166
|
-
t.string
|
167
|
-
t.integer
|
168
|
-
t.text
|
169
|
-
t.text
|
160
|
+
create_table "tokens", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
161
|
+
t.string "uuid", limit: 36, null: false
|
162
|
+
t.integer "job_definition_id"
|
163
|
+
t.integer "job_definition_version"
|
164
|
+
t.integer "job_instance_id"
|
165
|
+
t.integer "parent_id"
|
166
|
+
t.text "script", null: false
|
167
|
+
t.string "path", limit: 180, default: "/", null: false
|
168
|
+
t.integer "status", default: 0, null: false
|
169
|
+
t.text "message", null: false
|
170
|
+
t.text "context", null: false
|
170
171
|
t.datetime "created_at"
|
171
172
|
t.datetime "updated_at"
|
172
|
-
t.index ["parent_id"], name: "parent_id"
|
173
|
-
t.index ["status"], name: "status"
|
174
|
-
end
|
175
|
-
|
176
|
-
create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
177
|
-
t.string
|
178
|
-
t.string
|
179
|
-
t.string
|
180
|
-
t.string
|
181
|
-
t.string
|
182
|
-
t.string
|
183
|
-
t.string
|
173
|
+
t.index ["parent_id"], name: "parent_id"
|
174
|
+
t.index ["status"], name: "status"
|
175
|
+
end
|
176
|
+
|
177
|
+
create_table "users", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
178
|
+
t.string "provider", limit: 180, default: "google_oauth2", null: false
|
179
|
+
t.string "uid", limit: 180, null: false
|
180
|
+
t.string "name", limit: 180, default: "", null: false
|
181
|
+
t.string "email", limit: 180, null: false
|
182
|
+
t.string "first_name", limit: 180, default: "", null: false
|
183
|
+
t.string "last_name", limit: 180, default: "", null: false
|
184
|
+
t.string "image", limit: 180, default: "", null: false
|
184
185
|
t.datetime "suspended_at"
|
185
186
|
t.datetime "created_at"
|
186
187
|
t.datetime "updated_at"
|
187
|
-
t.index ["email"], name: "email"
|
188
|
-
t.index ["uid", "suspended_at"], name: "uid_2"
|
189
|
-
t.index ["uid"], name: "uid", unique: true
|
188
|
+
t.index ["email"], name: "email"
|
189
|
+
t.index ["uid", "suspended_at"], name: "uid_2"
|
190
|
+
t.index ["uid"], name: "uid", unique: true
|
190
191
|
end
|
191
192
|
|
192
|
-
create_table "workers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
193
|
-
t.string
|
194
|
-
t.integer
|
195
|
-
t.string
|
196
|
-
t.boolean
|
197
|
-
t.integer
|
193
|
+
create_table "workers", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
194
|
+
t.string "hostname", limit: 180, null: false
|
195
|
+
t.integer "worker_id", limit: 1, null: false
|
196
|
+
t.string "queue", limit: 180, default: "@default", null: false
|
197
|
+
t.boolean "working", default: false, null: false
|
198
|
+
t.integer "execution_id"
|
198
199
|
t.datetime "created_at"
|
199
200
|
t.datetime "updated_at"
|
200
|
-
t.index ["hostname", "worker_id"], name: "hostname", unique: true
|
201
|
+
t.index ["hostname", "worker_id"], name: "hostname", unique: true
|
201
202
|
end
|
202
203
|
|
203
204
|
end
|