Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
0970e7b9
Commit
0970e7b9
authored
May 02, 2018
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename RunnerGroup -> RunnerNamespace
parent
2261188f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
19 deletions
+40
-19
app/models/ci/runner.rb
app/models/ci/runner.rb
+3
-3
app/models/ci/runner_group.rb
app/models/ci/runner_group.rb
+0
-8
app/models/ci/runner_namespace.rb
app/models/ci/runner_namespace.rb
+9
-0
app/models/group.rb
app/models/group.rb
+0
-2
app/models/namespace.rb
app/models/namespace.rb
+3
-0
db/migrate/20170301101006_add_ci_runner_namespaces.rb
db/migrate/20170301101006_add_ci_runner_namespaces.rb
+19
-0
db/schema.rb
db/schema.rb
+6
-6
No files found.
app/models/ci/runner.rb
View file @
0970e7b9
...
...
@@ -14,8 +14,8 @@ module Ci
has_many
:builds
has_many
:runner_projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:projects
,
through: :runner_projects
has_many
:runner_
group
s
has_many
:groups
,
through: :runner_
group
s
has_many
:runner_
namespace
s
has_many
:groups
,
through: :runner_
namespace
s
has_one
:last_build
,
->
()
{
order
(
'id DESC'
)
},
class_name:
'Ci::Build'
...
...
@@ -144,7 +144,7 @@ module Ci
end
def
assigned_to_group?
runner_
group
s
.
any?
runner_
namespace
s
.
any?
end
def
assigned_to_project?
...
...
app/models/ci/runner_group.rb
deleted
100644 → 0
View file @
2261188f
module
Ci
class
RunnerGroup
<
ActiveRecord
::
Base
extend
Gitlab
::
Ci
::
Model
belongs_to
:runner
belongs_to
:group
,
class_name:
'::Group'
end
end
app/models/ci/runner_namespace.rb
0 → 100644
View file @
0970e7b9
module
Ci
class
RunnerNamespace
<
ActiveRecord
::
Base
extend
Gitlab
::
Ci
::
Model
belongs_to
:runner
belongs_to
:namespace
,
class_name:
'::Namespace'
belongs_to
:group
,
class_name:
'::Group'
,
foreign_key: :namespace_id
end
end
app/models/group.rb
View file @
0970e7b9
...
...
@@ -29,8 +29,6 @@ class Group < Namespace
has_many
:labels
,
class_name:
'GroupLabel'
has_many
:variables
,
class_name:
'Ci::GroupVariable'
has_many
:custom_attributes
,
class_name:
'GroupCustomAttribute'
has_many
:runner_groups
,
class_name:
'Ci::RunnerGroup'
has_many
:runners
,
through: :runner_groups
,
source: :runner
,
class_name:
'Ci::Runner'
has_many
:uploads
,
as: :model
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
...
...
app/models/namespace.rb
View file @
0970e7b9
...
...
@@ -21,6 +21,9 @@ class Namespace < ActiveRecord::Base
has_many
:projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:project_statistics
has_many
:runner_namespaces
,
class_name:
'Ci::RunnerNamespace'
has_many
:runners
,
through: :runner_namespaces
,
source: :runner
,
class_name:
'Ci::Runner'
# This should _not_ be `inverse_of: :namespace`, because that would also set
# `user.namespace` when this user creates a group with themselves as `owner`.
belongs_to
:owner
,
class_name:
"User"
...
...
db/migrate/20170301101006_add_ci_runner_
group
s.rb
→
db/migrate/20170301101006_add_ci_runner_
namespace
s.rb
View file @
0970e7b9
class
AddCiRunner
Group
s
<
ActiveRecord
::
Migration
class
AddCiRunner
Namespace
s
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
...
...
@@ -6,14 +6,14 @@ class AddCiRunnerGroups < ActiveRecord::Migration
disable_ddl_transaction!
def
change
create_table
:ci_runner_
group
s
do
|
t
|
create_table
:ci_runner_
namespace
s
do
|
t
|
t
.
integer
:runner_id
t
.
integer
:
group
_id
t
.
integer
:
namespace
_id
t
.
index
[
:runner_id
,
:
group
_id
],
unique:
true
t
.
index
:
group
_id
t
.
index
[
:runner_id
,
:
namespace
_id
],
unique:
true
t
.
index
:
namespace
_id
t
.
foreign_key
:ci_runners
,
column: :runner_id
,
on_delete: :cascade
t
.
foreign_key
:namespaces
,
column: :
group
_id
,
on_delete: :cascade
t
.
foreign_key
:namespaces
,
column: :
namespace
_id
,
on_delete: :cascade
end
end
end
db/schema.rb
View file @
0970e7b9
...
...
@@ -443,13 +443,13 @@ ActiveRecord::Schema.define(version: 20180430143705) do
add_index
"ci_pipelines"
,
[
"status"
],
name:
"index_ci_pipelines_on_status"
,
using: :btree
add_index
"ci_pipelines"
,
[
"user_id"
],
name:
"index_ci_pipelines_on_user_id"
,
using: :btree
create_table
"ci_runner_
group
s"
,
force: :cascade
do
|
t
|
create_table
"ci_runner_
namespace
s"
,
force: :cascade
do
|
t
|
t
.
integer
"runner_id"
t
.
integer
"
group
_id"
t
.
integer
"
namespace
_id"
end
add_index
"ci_runner_
groups"
,
[
"group_id"
],
name:
"index_ci_runner_groups_on_group
_id"
,
using: :btree
add_index
"ci_runner_
groups"
,
[
"runner_id"
,
"group_id"
],
name:
"index_ci_runner_groups_on_runner_id_and_group
_id"
,
unique:
true
,
using: :btree
add_index
"ci_runner_
namespaces"
,
[
"namespace_id"
],
name:
"index_ci_runner_namespaces_on_namespace
_id"
,
using: :btree
add_index
"ci_runner_
namespaces"
,
[
"runner_id"
,
"namespace_id"
],
name:
"index_ci_runner_namespaces_on_runner_id_and_namespace
_id"
,
unique:
true
,
using: :btree
create_table
"ci_runner_projects"
,
force: :cascade
do
|
t
|
t
.
integer
"runner_id"
,
null:
false
...
...
@@ -2096,8 +2096,8 @@ ActiveRecord::Schema.define(version: 20180430143705) do
add_foreign_key
"ci_pipelines"
,
"ci_pipeline_schedules"
,
column:
"pipeline_schedule_id"
,
name:
"fk_3d34ab2e06"
,
on_delete: :nullify
add_foreign_key
"ci_pipelines"
,
"ci_pipelines"
,
column:
"auto_canceled_by_id"
,
name:
"fk_262d4c2d19"
,
on_delete: :nullify
add_foreign_key
"ci_pipelines"
,
"projects"
,
name:
"fk_86635dbd80"
,
on_delete: :cascade
add_foreign_key
"ci_runner_
group
s"
,
"ci_runners"
,
column:
"runner_id"
,
on_delete: :cascade
add_foreign_key
"ci_runner_
group
s"
,
"namespaces"
,
column:
"group_id"
,
on_delete: :cascade
add_foreign_key
"ci_runner_
namespace
s"
,
"ci_runners"
,
column:
"runner_id"
,
on_delete: :cascade
add_foreign_key
"ci_runner_
namespace
s"
,
"namespaces"
,
column:
"group_id"
,
on_delete: :cascade
add_foreign_key
"ci_runner_projects"
,
"projects"
,
name:
"fk_4478a6f1e4"
,
on_delete: :cascade
add_foreign_key
"ci_stages"
,
"ci_pipelines"
,
column:
"pipeline_id"
,
name:
"fk_fb57e6cc56"
,
on_delete: :cascade
add_foreign_key
"ci_stages"
,
"projects"
,
name:
"fk_2360681d1d"
,
on_delete: :cascade
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment