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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
48d9a722
Commit
48d9a722
authored
Sep 25, 2017
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix locked shared runners problem
parent
8b1a3d40
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
52 deletions
+19
-52
app/models/ci/runner.rb
app/models/ci/runner.rb
+1
-1
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+18
-51
No files found.
app/models/ci/runner.rb
View file @
48d9a722
...
@@ -174,7 +174,7 @@ module Ci
...
@@ -174,7 +174,7 @@ module Ci
end
end
def
assignable_for?
(
project
)
def
assignable_for?
(
project
)
!
lock
ed?
||
projects
.
exists?
(
id:
project
.
id
)
is_shar
ed?
||
projects
.
exists?
(
id:
project
.
id
)
end
end
def
accepting_tags?
(
build
)
def
accepting_tags?
(
build
)
...
...
spec/models/ci/runner_spec.rb
View file @
48d9a722
...
@@ -183,77 +183,44 @@ describe Ci::Runner do
...
@@ -183,77 +183,44 @@ describe Ci::Runner do
end
end
end
end
context
'when runner is locked'
do
context
'when runner is shared'
do
before
do
runner
.
locked
=
true
end
shared_examples
'locked build picker'
do
context
'when runner cannot pick untagged jobs'
do
before
do
runner
.
run_untagged
=
false
end
it
'cannot handle builds without tags'
do
expect
(
runner
.
can_pick?
(
build
)).
to
be_falsey
end
end
context
'when having runner tags'
do
before
do
before
do
runner
.
tag_list
=
%w(bb cc)
runner
.
is_shared
=
true
end
build
.
project
.
runners
=
[]
it
'cannot handle it for builds without matching tags'
do
build
.
tag_list
=
[
'aa'
]
expect
(
runner
.
can_pick?
(
build
)).
to
be_falsey
end
end
end
end
context
'when serving the same project'
do
it
'can handle builds'
do
it
'can handle it'
do
expect
(
runner
.
can_pick?
(
build
)).
to
be_truthy
expect
(
runner
.
can_pick?
(
build
)).
to
be_truthy
end
end
it_behaves_like
'locked build picker'
context
'when runner is locked'
do
context
'when having runner tags'
do
before
do
before
do
runner
.
tag_list
=
%w(bb cc)
runner
.
locked
=
true
build
.
tag_list
=
[
'bb'
]
end
end
it
'can handle it for matching tag
s'
do
it
'can handle build
s'
do
expect
(
runner
.
can_pick?
(
build
)).
to
be_truthy
expect
(
runner
.
can_pick?
(
build
)).
to
be_truthy
end
end
end
end
end
end
context
'serving a different project'
do
context
'when runner is not shared'
do
before
do
context
'when runner is assigned to a project'
do
runner
.
runner_projects
.
destroy_all
it
'can handle builds'
do
expect
(
runner
.
can_pick?
(
build
)).
to
be_truthy
end
end
it
'cannot handle it'
do
expect
(
runner
.
can_pick?
(
build
)).
to
be_falsey
end
end
it_behaves_like
'locked build picker'
context
'when runner is not assigned to a project'
do
context
'when having runner tags'
do
before
do
before
do
runner
.
tag_list
=
%w(bb cc)
build
.
project
.
runners
=
[]
build
.
tag_list
=
[
'bb'
]
end
end
it
'cannot handle it for matching tag
s'
do
it
'cannot handle build
s'
do
expect
(
runner
.
can_pick?
(
build
)).
to
be_falsey
expect
(
runner
.
can_pick?
(
build
)).
to
be_falsey
end
end
end
end
end
end
end
context
'when access_level of runner is not_protected'
do
context
'when access_level of runner is not_protected'
do
before
do
before
do
...
...
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