Commit e9609318 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '46010-runner-type-not-null' into 'master'

Set `ci_runners.runner_type` not null

See merge request gitlab-org/gitlab-ce!18825
parents 58086f82 89ec120f
...@@ -58,6 +58,7 @@ module Ci ...@@ -58,6 +58,7 @@ module Ci
validate :tag_constraints validate :tag_constraints
validate :either_projects_or_group validate :either_projects_or_group
validates :access_level, presence: true validates :access_level, presence: true
validates :runner_type, presence: true
acts_as_taggable acts_as_taggable
......
class SetRunnerTypeNotNull < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
change_column_null(:ci_runners, :runner_type, false)
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180508055821) do ActiveRecord::Schema.define(version: 20180508135515) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -497,7 +497,7 @@ ActiveRecord::Schema.define(version: 20180508055821) do ...@@ -497,7 +497,7 @@ ActiveRecord::Schema.define(version: 20180508055821) do
t.integer "access_level", default: 0, null: false t.integer "access_level", default: 0, null: false
t.string "ip_address" t.string "ip_address"
t.integer "maximum_timeout" t.integer "maximum_timeout"
t.integer "runner_type", limit: 2 t.integer "runner_type", limit: 2, null: false
end end
add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree
......
...@@ -6,6 +6,7 @@ FactoryBot.define do ...@@ -6,6 +6,7 @@ FactoryBot.define do
is_shared false is_shared false
active true active true
access_level :not_protected access_level :not_protected
runner_type :project_type
trait :online do trait :online do
contacted_at Time.now contacted_at Time.now
...@@ -13,6 +14,7 @@ FactoryBot.define do ...@@ -13,6 +14,7 @@ FactoryBot.define do
trait :shared do trait :shared do
is_shared true is_shared true
runner_type :instance_type
end end
trait :specific do trait :specific do
......
...@@ -3,6 +3,7 @@ require 'spec_helper' ...@@ -3,6 +3,7 @@ require 'spec_helper'
describe Ci::Runner do describe Ci::Runner do
describe 'validation' do describe 'validation' do
it { is_expected.to validate_presence_of(:access_level) } it { is_expected.to validate_presence_of(:access_level) }
it { is_expected.to validate_presence_of(:runner_type) }
context 'when runner is not allowed to pick untagged jobs' do context 'when runner is not allowed to pick untagged jobs' do
context 'when runner does not have tags' do context 'when runner does not have tags' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment