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
Léo-Paul Géneau
gitlab-ce
Commits
478990bb
Commit
478990bb
authored
8 years ago
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pipeline status change from pending to running
parent
99928aca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
1 deletion
+53
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+2
-1
app/models/commit_status.rb
app/models/commit_status.rb
+6
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+45
-0
No files found.
app/models/ci/pipeline.rb
View file @
478990bb
...
...
@@ -187,6 +187,7 @@ module Ci
def
process!
Ci
::
ProcessPipelineService
.
new
(
project
,
user
).
execute
(
self
)
reload_status!
end
...
...
@@ -197,7 +198,7 @@ module Ci
end
def
reload_status!
statuses
.
reload
reload
self
.
status
=
if
yaml_errors
.
blank?
statuses
.
latest
.
status
||
'skipped'
...
...
This diff is collapsed.
Click to expand it.
app/models/commit_status.rb
View file @
478990bb
...
...
@@ -76,6 +76,12 @@ class CommitStatus < ActiveRecord::Base
commit_status
.
pipeline
.
process!
if
commit_status
.
pipeline
end
around_transition
any
=>
[
:pending
,
:running
]
do
|
commit_status
,
block
|
block
.
call
commit_status
.
pipeline
.
reload_status!
if
commit_status
.
pipeline
end
end
delegate
:sha
,
:short_sha
,
to: :pipeline
...
...
This diff is collapsed.
Click to expand it.
spec/models/ci/pipeline_spec.rb
View file @
478990bb
...
...
@@ -257,6 +257,51 @@ describe Ci::Pipeline, models: true do
end
end
describe
'#status'
do
let!
(
:build
)
{
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
name:
'test'
)
}
subject
{
pipeline
.
reload
.
status
}
context
'on queuing'
do
before
{
build
.
queue
}
it
{
is_expected
.
to
eq
(
'pending'
)
}
end
context
'on run'
do
before
do
build
.
queue
build
.
run
end
it
{
is_expected
.
to
eq
(
'running'
)
}
end
context
'on drop'
do
before
do
build
.
drop
end
it
{
is_expected
.
to
eq
(
'failed'
)
}
end
context
'on success'
do
before
do
build
.
success
end
it
{
is_expected
.
to
eq
(
'success'
)
}
end
context
'on cancel'
do
before
do
build
.
cancel
end
it
{
is_expected
.
to
eq
(
'canceled'
)
}
end
end
describe
'#execute_hooks'
do
let!
(
:hook
)
do
create
(
:project_hook
,
project:
project
,
pipeline_events:
enabled
)
...
...
This diff is collapsed.
Click to expand it.
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