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
8001eed0
Commit
8001eed0
authored
May 06, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method that check if build has tags
parent
82523331
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
app/models/ci/build.rb
app/models/ci/build.rb
+5
-3
spec/models/build_spec.rb
spec/models/build_spec.rb
+12
-0
No files found.
app/models/ci/build.rb
View file @
8001eed0
...
@@ -290,13 +290,15 @@ module Ci
...
@@ -290,13 +290,15 @@ module Ci
end
end
def
can_be_served?
(
runner
)
def
can_be_served?
(
runner
)
if
tag_list
.
empty?
&&
!
runner
.
run_untagged?
return
false
unless
has_tags?
||
runner
.
run_untagged?
return
false
end
(
tag_list
-
runner
.
tag_list
).
empty?
(
tag_list
-
runner
.
tag_list
).
empty?
end
end
def
has_tags?
tag_list
.
any?
end
def
any_runners_online?
def
any_runners_online?
project
.
any_runners?
{
|
runner
|
runner
.
active?
&&
runner
.
online?
&&
can_be_served?
(
runner
)
}
project
.
any_runners?
{
|
runner
|
runner
.
active?
&&
runner
.
online?
&&
can_be_served?
(
runner
)
}
end
end
...
...
spec/models/build_spec.rb
View file @
8001eed0
...
@@ -309,6 +309,18 @@ describe Ci::Build, models: true do
...
@@ -309,6 +309,18 @@ describe Ci::Build, models: true do
end
end
end
end
describe
'#has_tags?'
do
context
'when build has tags'
do
subject
{
create
(
:ci_build
,
tag_list:
[
'tag'
])
}
it
{
is_expected
.
to
have_tags
}
end
context
'when build does not have tags'
do
subject
{
create
(
:ci_build
,
tag_list:
[])
}
it
{
is_expected
.
to_not
have_tags
}
end
end
describe
'#any_runners_online?'
do
describe
'#any_runners_online?'
do
subject
{
build
.
any_runners_online?
}
subject
{
build
.
any_runners_online?
}
...
...
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