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
ffcf3c68
Commit
ffcf3c68
authored
Feb 09, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip job only when canceling the pipeline it belongs to
parent
008f22cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+7
-1
app/models/commit_status.rb
app/models/commit_status.rb
+1
-2
spec/requests/api/commit_statuses_spec.rb
spec/requests/api/commit_statuses_spec.rb
+4
-1
No files found.
app/models/ci/pipeline.rb
View file @
ffcf3c68
...
...
@@ -214,7 +214,13 @@ module Ci
def
cancel_running
Gitlab
::
OptimisticLocking
.
retry_lock
(
statuses
.
cancelable
)
do
|
cancelable
|
cancelable
.
each
(
&
:cancel
)
cancelable
.
each
do
|
status
|
if
status
.
created?
status
.
skip
elsif
status
.
active?
status
.
cancel
end
end
end
end
...
...
app/models/commit_status.rb
View file @
ffcf3c68
...
...
@@ -65,8 +65,7 @@ class CommitStatus < ActiveRecord::Base
end
event
:cancel
do
transition
[
:created
]
=>
:skipped
transition
[
:pending
,
:running
]
=>
:canceled
transition
[
:created
,
:pending
,
:running
]
=>
:canceled
end
before_transition
created:
[
:pending
,
:running
]
do
|
commit_status
|
...
...
spec/requests/api/commit_statuses_spec.rb
View file @
ffcf3c68
...
...
@@ -5,12 +5,15 @@ describe API::CommitStatuses, api: true do
let!
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
repository
.
commit
}
let
(
:commit_status
)
{
create
(
:commit_status
,
pipeline:
pipeline
)
}
let
(
:guest
)
{
create_user
(
:guest
)
}
let
(
:reporter
)
{
create_user
(
:reporter
)
}
let
(
:developer
)
{
create_user
(
:developer
)
}
let
(
:sha
)
{
commit
.
id
}
let
(
:commit_status
)
do
create
(
:commit_status
,
status: :pending
,
pipeline:
pipeline
)
end
describe
"GET /projects/:id/repository/commits/:sha/statuses"
do
let
(
:get_url
)
{
"/projects/
#{
project
.
id
}
/repository/commits/
#{
sha
}
/statuses"
}
...
...
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