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
fd724ace
Commit
fd724ace
authored
Sep 29, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable pipeline activity limit and add EE specs
parent
1ce7d9a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletion
+59
-1
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+2
-1
spec/ee/spec/services/ci/create_pipeline_service_spec.rb
spec/ee/spec/services/ci/create_pipeline_service_spec.rb
+57
-0
No files found.
app/services/ci/create_pipeline_service.rb
View file @
fd724ace
...
@@ -6,7 +6,8 @@ module Ci
...
@@ -6,7 +6,8 @@ module Ci
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Repository
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Repository
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Config
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Config
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Skip
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Skip
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Create
].
freeze
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Create
,
EE
::
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Limit
::
Activity
].
freeze
def
execute
(
source
,
ignore_skip_ci:
false
,
save_on_errors:
true
,
trigger_request:
nil
,
schedule:
nil
,
mirror_update:
false
,
&
block
)
def
execute
(
source
,
ignore_skip_ci:
false
,
save_on_errors:
true
,
trigger_request:
nil
,
schedule:
nil
,
mirror_update:
false
,
&
block
)
@pipeline
=
Ci
::
Pipeline
.
new
(
@pipeline
=
Ci
::
Pipeline
.
new
(
...
...
spec/ee/spec/services/ci/create_pipeline_service_spec.rb
0 → 100644
View file @
fd724ace
require
'spec_helper'
describe
Ci
::
CreatePipelineService
,
'#execute'
do
set
(
:namespace
)
{
create
(
:namespace
,
plan:
EE
::
Namespace
::
GOLD_PLAN
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
do
params
=
{
ref:
'master'
,
before:
'00000000'
,
after:
project
.
commit
.
id
,
commits:
[{
message:
'some commit'
}]
}
described_class
.
new
(
project
,
user
,
params
)
end
before
do
project
.
add_developer
(
user
)
stub_ci_pipeline_to_return_yaml_file
end
describe
'CI/CD Quotas / Limits'
do
context
'when there are not limits enabled'
do
it
'enqueues a new pipeline'
do
pipeline
=
create_pipeline!
expect
(
pipeline
).
to
be_persisted
expect
(
pipeline
).
to
be_pending
end
end
context
'when pipeline activity limit is exceeded'
do
before
do
namespace
.
plan
.
update_column
(
:active_pipelines_limit
,
2
)
create
(
:ci_pipeline
,
project:
project
,
status:
'pending'
)
create
(
:ci_pipeline
,
project:
project
,
status:
'running'
)
end
it
'drops the pipeline and cancels all jobs'
do
pipeline
=
create_pipeline!
# TODO, check failure reason
expect
(
pipeline
).
to
be_persisted
expect
(
pipeline
).
to
be_failed
expect
(
pipeline
.
statuses
).
to
all
(
be_canceled
)
end
end
context
'when pipeline size limit is exceeded'
do
end
end
def
create_pipeline!
service
.
execute
(
:push
)
end
end
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