summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-06 12:25:34 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-06 12:25:34 +0300
commit436d0c2d8102e2831b64e0cd43c375fada869a0e (patch)
treeb81e706b41b8abf8ca3aba9cddb7f0b803596bb7
parentc010c8a92cecc6d85661fdb9b989787020d27f11 (diff)
downloadgitlab-ci-436d0c2d8102e2831b64e0cd43c375fada869a0e.tar.gz
Remove public key from runner model
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/models/build.rb4
-rw-r--r--app/models/project.rb34
-rw-r--r--app/models/runner.rb7
-rw-r--r--app/models/runner_project.rb4
-rw-r--r--app/models/web_hook.rb11
-rw-r--r--config/application.yml.example.development7
-rw-r--r--db/migrate/20140506091853_remove_public_key_from_runner.rb5
-rw-r--r--db/schema.rb3
-rw-r--r--lib/api/runners.rb5
-rw-r--r--spec/factories/builds.rb4
-rw-r--r--spec/factories/projects.rb34
-rw-r--r--spec/factories/runner_projects.rb4
-rw-r--r--spec/factories/runners.rb5
-rw-r--r--spec/models/build_spec.rb4
-rw-r--r--spec/models/project_spec.rb34
-rw-r--r--spec/models/runner_project_spec.rb4
-rw-r--r--spec/models/runner_spec.rb5
-rw-r--r--spec/models/web_hook_spec.rb11
18 files changed, 107 insertions, 78 deletions
diff --git a/app/models/build.rb b/app/models/build.rb
index 811f87a..47ca196 100644
--- a/app/models/build.rb
+++ b/app/models/build.rb
@@ -8,8 +8,8 @@
# status :string(255)
# finished_at :datetime
# trace :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
# sha :string(255)
# started_at :datetime
# tmp_file :string(255)
diff --git a/app/models/project.rb b/app/models/project.rb
index 0ed2295..5a8f052 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2,23 +2,23 @@
#
# Table name: projects
#
-# id :integer not null, primary key
-# name :string(255) not null
-# timeout :integer default(1800), not null
-# scripts :text not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# token :string(255)
-# default_ref :string(255)
-# gitlab_url :string(255)
-# always_build :boolean default(FALSE), not null
-# polling_interval :integer
-# public :boolean default(FALSE), not null
-# ssh_url_to_repo :string(255)
-# gitlab_id :integer
-# allow_git_fetch :boolean default(TRUE), not null
-# email_recipients :string(255) default(""), not null
-# email_add_committer :boolean default(TRUE), not null
+# id :integer not null, primary key
+# name :string(255) not null
+# timeout :integer default(1800), not null
+# scripts :text not null
+# created_at :datetime
+# updated_at :datetime
+# token :string(255)
+# default_ref :string(255)
+# gitlab_url :string(255)
+# always_build :boolean default(FALSE), not null
+# polling_interval :integer
+# public :boolean default(FALSE), not null
+# ssh_url_to_repo :string(255)
+# gitlab_id :integer
+# allow_git_fetch :boolean default(TRUE), not null
+# email_recipients :string(255) default(""), not null
+# email_add_committer :boolean default(TRUE), not null
# email_only_broken_builds :boolean default(TRUE), not null
#
diff --git a/app/models/runner.rb b/app/models/runner.rb
index 9fd1891..d7b635d 100644
--- a/app/models/runner.rb
+++ b/app/models/runner.rb
@@ -4,9 +4,8 @@
#
# id :integer not null, primary key
# token :string(255)
-# public_key :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
# description :string(255)
#
@@ -17,7 +16,7 @@ class Runner < ActiveRecord::Base
has_one :last_build, ->() { order('id DESC') }, class_name: 'Build'
- attr_accessible :token, :public_key, :description
+ attr_accessible :token, :description
before_validation :set_default_values
diff --git a/app/models/runner_project.rb b/app/models/runner_project.rb
index bff0465..118ce07 100644
--- a/app/models/runner_project.rb
+++ b/app/models/runner_project.rb
@@ -5,8 +5,8 @@
# id :integer not null, primary key
# runner_id :integer not null
# project_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
#
class RunnerProject < ActiveRecord::Base
diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb
index 1d16961..0039c12 100644
--- a/app/models/web_hook.rb
+++ b/app/models/web_hook.rb
@@ -1,3 +1,14 @@
+# == Schema Information
+#
+# Table name: web_hooks
+#
+# id :integer not null, primary key
+# url :string(255) not null
+# project_id :integer not null
+# created_at :datetime
+# updated_at :datetime
+#
+
class WebHook < ActiveRecord::Base
include HTTParty
diff --git a/config/application.yml.example.development b/config/application.yml.example.development
index 4565bf6..aa6e164 100644
--- a/config/application.yml.example.development
+++ b/config/application.yml.example.development
@@ -5,3 +5,10 @@ development:
host: localhost
port: 9000
https: false
+test:
+ gitlab_server_urls:
+ - 'http://demo.gitlab.com/'
+ gitlab_ci:
+ host: localhost
+ port: 80
+ https: false
diff --git a/db/migrate/20140506091853_remove_public_key_from_runner.rb b/db/migrate/20140506091853_remove_public_key_from_runner.rb
new file mode 100644
index 0000000..3bf9f03
--- /dev/null
+++ b/db/migrate/20140506091853_remove_public_key_from_runner.rb
@@ -0,0 +1,5 @@
+class RemovePublicKeyFromRunner < ActiveRecord::Migration
+ def change
+ remove_column :runners, :public_key
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index d9418af..dcb3569 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140222210357) do
+ActiveRecord::Schema.define(version: 20140506091853) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -67,7 +67,6 @@ ActiveRecord::Schema.define(version: 20140222210357) do
create_table "runners", force: true do |t|
t.string "token"
- t.text "public_key"
t.datetime "created_at"
t.datetime "updated_at"
t.string "description"
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 2df6d6a..ef78b09 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -24,15 +24,14 @@ module API
#
# Parameters:
# token (required) - The unique token of runner
- # public_key (required) - Deploy key used to get projects
#
# Example Request:
# POST /runners/register
post "register" do
authenticate_runners!
- required_attributes! [:token, :public_key]
+ required_attributes! [:token]
- runner = Runner.create(public_key: params[:public_key])
+ runner = Runner.create
if runner.id
present runner, with: Entities::Runner
diff --git a/spec/factories/builds.rb b/spec/factories/builds.rb
index 2b754af..d90d16d 100644
--- a/spec/factories/builds.rb
+++ b/spec/factories/builds.rb
@@ -8,8 +8,8 @@
# status :string(255)
# finished_at :datetime
# trace :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
# sha :string(255)
# started_at :datetime
# tmp_file :string(255)
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index f67a49b..b28b4ab 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -2,23 +2,23 @@
#
# Table name: projects
#
-# id :integer not null, primary key
-# name :string(255) not null
-# timeout :integer default(1800), not null
-# scripts :text not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# token :string(255)
-# default_ref :string(255)
-# gitlab_url :string(255)
-# always_build :boolean default(FALSE), not null
-# polling_interval :integer
-# public :boolean default(FALSE), not null
-# ssh_url_to_repo :string(255)
-# gitlab_id :integer
-# allow_git_fetch :boolean default(TRUE), not null
-# email_recipients :string(255) default(""), not null
-# email_add_committer :boolean default(TRUE), not null
+# id :integer not null, primary key
+# name :string(255) not null
+# timeout :integer default(1800), not null
+# scripts :text not null
+# created_at :datetime
+# updated_at :datetime
+# token :string(255)
+# default_ref :string(255)
+# gitlab_url :string(255)
+# always_build :boolean default(FALSE), not null
+# polling_interval :integer
+# public :boolean default(FALSE), not null
+# ssh_url_to_repo :string(255)
+# gitlab_id :integer
+# allow_git_fetch :boolean default(TRUE), not null
+# email_recipients :string(255) default(""), not null
+# email_add_committer :boolean default(TRUE), not null
# email_only_broken_builds :boolean default(TRUE), not null
#
diff --git a/spec/factories/runner_projects.rb b/spec/factories/runner_projects.rb
index d72c525..b27632b 100644
--- a/spec/factories/runner_projects.rb
+++ b/spec/factories/runner_projects.rb
@@ -5,8 +5,8 @@
# id :integer not null, primary key
# runner_id :integer not null
# project_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
#
# Read about factories at https://github.com/thoughtbot/factory_girl
diff --git a/spec/factories/runners.rb b/spec/factories/runners.rb
index 9233ee3..f85f23d 100644
--- a/spec/factories/runners.rb
+++ b/spec/factories/runners.rb
@@ -4,9 +4,8 @@
#
# id :integer not null, primary key
# token :string(255)
-# public_key :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
# description :string(255)
#
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index 2e2dded..3ffb760 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -8,8 +8,8 @@
# status :string(255)
# finished_at :datetime
# trace :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
# sha :string(255)
# started_at :datetime
# tmp_file :string(255)
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 051bd2d..fc06414 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2,23 +2,23 @@
#
# Table name: projects
#
-# id :integer not null, primary key
-# name :string(255) not null
-# timeout :integer default(1800), not null
-# scripts :text not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# token :string(255)
-# default_ref :string(255)
-# gitlab_url :string(255)
-# always_build :boolean default(FALSE), not null
-# polling_interval :integer
-# public :boolean default(FALSE), not null
-# ssh_url_to_repo :string(255)
-# gitlab_id :integer
-# allow_git_fetch :boolean default(TRUE), not null
-# email_recipients :string(255) default(""), not null
-# email_add_committer :boolean default(TRUE), not null
+# id :integer not null, primary key
+# name :string(255) not null
+# timeout :integer default(1800), not null
+# scripts :text not null
+# created_at :datetime
+# updated_at :datetime
+# token :string(255)
+# default_ref :string(255)
+# gitlab_url :string(255)
+# always_build :boolean default(FALSE), not null
+# polling_interval :integer
+# public :boolean default(FALSE), not null
+# ssh_url_to_repo :string(255)
+# gitlab_id :integer
+# allow_git_fetch :boolean default(TRUE), not null
+# email_recipients :string(255) default(""), not null
+# email_add_committer :boolean default(TRUE), not null
# email_only_broken_builds :boolean default(TRUE), not null
#
diff --git a/spec/models/runner_project_spec.rb b/spec/models/runner_project_spec.rb
index 6428d8b..cbefb24 100644
--- a/spec/models/runner_project_spec.rb
+++ b/spec/models/runner_project_spec.rb
@@ -5,8 +5,8 @@
# id :integer not null, primary key
# runner_id :integer not null
# project_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
#
require 'spec_helper'
diff --git a/spec/models/runner_spec.rb b/spec/models/runner_spec.rb
index 3703de0..db2fac3 100644
--- a/spec/models/runner_spec.rb
+++ b/spec/models/runner_spec.rb
@@ -4,9 +4,8 @@
#
# id :integer not null, primary key
# token :string(255)
-# public_key :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# created_at :datetime
+# updated_at :datetime
# description :string(255)
#
diff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rb
index acbb136..2c3c1c3 100644
--- a/spec/models/web_hook_spec.rb
+++ b/spec/models/web_hook_spec.rb
@@ -1,3 +1,14 @@
+# == Schema Information
+#
+# Table name: web_hooks
+#
+# id :integer not null, primary key
+# url :string(255) not null
+# project_id :integer not null
+# created_at :datetime
+# updated_at :datetime
+#
+
require 'spec_helper'
describe WebHook do