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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
ac50f9dd
Commit
ac50f9dd
authored
Apr 12, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rest of rspec and spinach tests
parent
52be9e20
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
15 deletions
+26
-15
app/models/ci/commit.rb
app/models/ci/commit.rb
+5
-5
app/models/concerns/ci_status.rb
app/models/concerns/ci_status.rb
+4
-2
app/services/ci/create_builds_service.rb
app/services/ci/create_builds_service.rb
+1
-1
features/steps/shared/builds.rb
features/steps/shared/builds.rb
+3
-3
features/steps/shared/project.rb
features/steps/shared/project.rb
+1
-1
spec/lib/ci/status_spec.rb
spec/lib/ci/status_spec.rb
+12
-3
No files found.
app/models/ci/commit.rb
View file @
ac50f9dd
...
...
@@ -117,7 +117,7 @@ module Ci
# get status for all prior builds
prior_builds
=
latest_builds
.
reject
{
|
other_build
|
next_stages
.
include?
(
other_build
.
stage
)
}
status
=
Ci
::
Status
.
get_status
(
prior_builds
)
status
=
prior_builds
.
status
# create builds for next stages based
next_stages
.
any?
do
|
stage
|
...
...
@@ -185,7 +185,7 @@ module Ci
private
def
update_status
status
=
s
elf
.
s
tatus
=
if
yaml_errors
.
present?
'failed'
else
...
...
@@ -194,17 +194,17 @@ module Ci
end
def
update_started_at
started_at
=
s
elf
.
s
tarted_at
=
statuses
.
minimum
(
:started_at
)
end
def
update_finished_at
finished_at
=
self
.
finished_at
=
statuses
.
maximum
(
:finished_at
)
end
def
update_duration
duration
=
begin
self
.
duration
=
begin
duration_array
=
latest
.
map
(
&
:duration
).
compact
duration_array
.
reduce
(:
+
).
to_i
end
...
...
app/models/concerns/ci_status.rb
View file @
ac50f9dd
...
...
@@ -5,7 +5,7 @@ module CiStatus
def
status
objs
=
all
.
to_a
if
objs
.
none?
nil
nil
elsif
objs
.
all?
{
|
status
|
status
.
success?
||
status
.
try
(
:ignored?
)
}
'success'
elsif
objs
.
all?
(
&
:pending?
)
...
...
@@ -14,6 +14,8 @@ module CiStatus
'running'
elsif
objs
.
all?
(
&
:canceled?
)
'canceled'
elsif
objs
.
all?
(
&
:skipped?
)
'skipped'
else
'failed'
end
...
...
@@ -56,4 +58,4 @@ module CiStatus
def
complete?
canceled?
||
success?
||
failed?
end
end
\ No newline at end of file
end
app/services/ci/create_builds_service.rb
View file @
ac50f9dd
...
...
@@ -22,7 +22,7 @@ module Ci
builds_attrs
.
map
do
|
build_attrs
|
# don't create the same build twice
unless
@commit
.
builds
.
find_by
(
ref:
@commit
.
ref
,
tag:
@commit
.
tag
,
trigger_request:
trigger_request
,
name:
build_attrs
[
:name
])
trigger_request:
trigger_request
,
name:
build_attrs
[
:name
])
build_attrs
.
slice!
(
:name
,
:commands
,
:tag_list
,
...
...
features/steps/shared/builds.rb
View file @
ac50f9dd
...
...
@@ -10,16 +10,16 @@ module SharedBuilds
end
step
'project has a recent build'
do
@ci_commit
=
create
(
:ci_commit
,
project:
@project
,
sha:
@project
.
commit
.
sha
)
@ci_commit
=
create
(
:ci_commit
,
project:
@project
,
sha:
@project
.
commit
.
sha
,
ref:
'master'
)
@build
=
create
(
:ci_build_with_coverage
,
commit:
@ci_commit
)
end
step
'recent build is successful'
do
@build
.
update
_column
(
:status
,
'success'
)
@build
.
update
(
status:
'success'
)
end
step
'recent build failed'
do
@build
.
update
_column
(
:status
,
'failed'
)
@build
.
update
(
status:
'failed'
)
end
step
'project has another build that is running'
do
...
...
features/steps/shared/project.rb
View file @
ac50f9dd
...
...
@@ -230,7 +230,7 @@ module SharedProject
step
'project "Shop" has CI build'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
c
reate
:ci_commit
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
'master
'
c
ommit
=
create
:ci_commit
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
'master'
,
status:
'skipped
'
end
step
'I should see last commit with CI status'
do
...
...
spec/lib/ci/status_spec.rb
View file @
ac50f9dd
require
'spec_helper'
describe
Ci
::
Status
do
describe
'.get_status'
do
subject
{
described_class
.
get_status
(
statuses
)
}
describe
CiStatus
do
before
do
@object
=
Object
.
new
@object
.
extend
(
CiStatus
::
ClassMethods
)
end
describe
'.status'
do
before
do
allow
(
@object
).
to
receive
(
:all
).
and_return
(
statuses
)
end
subject
{
@object
.
status
}
shared_examples
'build status summary'
do
context
'all successful'
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