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
6072b44e
Commit
6072b44e
authored
Dec 05, 2018
by
Francisco Javier López
Committed by
Grzegorz Bizon
Dec 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port of Rename project's pipelines relation
parent
da10f026
Changes
46
Show whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
287 additions
and
83 deletions
+287
-83
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+1
-1
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+5
-5
app/controllers/projects/tags_controller.rb
app/controllers/projects/tags_controller.rb
+1
-1
app/finders/pipelines_finder.rb
app/finders/pipelines_finder.rb
+1
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+7
-2
app/models/commit.rb
app/models/commit.rb
+2
-2
app/models/commit_collection.rb
app/models/commit_collection.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+2
-2
app/models/project.rb
app/models/project.rb
+15
-5
app/models/project_services/pipelines_email_service.rb
app/models/project_services/pipelines_email_service.rb
+2
-2
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+1
-1
app/services/projects/auto_devops/disable_service.rb
app/services/projects/auto_devops/disable_service.rb
+1
-1
app/services/test_hooks/project_service.rb
app/services/test_hooks/project_service.rb
+1
-1
db/fixtures/development/14_pipelines.rb
db/fixtures/development/14_pipelines.rb
+1
-1
db/fixtures/development/20_vulnerabilities.rb
db/fixtures/development/20_vulnerabilities.rb
+2
-2
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+2
-2
ee/app/models/project_services/github_service.rb
ee/app/models/project_services/github_service.rb
+2
-2
ee/lib/ee/gitlab/ci/pipeline/quota/activity.rb
ee/lib/ee/gitlab/ci/pipeline/quota/activity.rb
+1
-1
ee/spec/features/projects/services/user_activates_github_spec.rb
.../features/projects/services/user_activates_github_spec.rb
+1
-1
ee/spec/lib/gitlab/import_export/all_models.yml
ee/spec/lib/gitlab/import_export/all_models.yml
+1
-1
ee/spec/models/project_services/github_service_spec.rb
ee/spec/models/project_services/github_service_spec.rb
+2
-2
lib/api/commit_statuses.rb
lib/api/commit_statuses.rb
+2
-2
lib/api/jobs.rb
lib/api/jobs.rb
+1
-1
lib/api/pipelines.rb
lib/api/pipelines.rb
+1
-1
lib/gitlab/badge/coverage/report.rb
lib/gitlab/badge/coverage/report.rb
+1
-1
lib/gitlab/badge/pipeline/status.rb
lib/gitlab/badge/pipeline/status.rb
+1
-1
lib/gitlab/ci/charts.rb
lib/gitlab/ci/charts.rb
+2
-2
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+1
-1
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+3
-1
lib/gitlab/import_export/project_tree_saver.rb
lib/gitlab/import_export/project_tree_saver.rb
+2
-0
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+1
-0
lib/gitlab/import_export/relation_rename_service.rb
lib/gitlab/import_export/relation_rename_service.rb
+48
-0
spec/features/projects/commit/builds_spec.rb
spec/features/projects/commit/builds_spec.rb
+1
-1
spec/features/projects/pages_spec.rb
spec/features/projects/pages_spec.rb
+1
-1
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+3
-2
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+2
-2
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+5
-5
spec/lib/gitlab/import_export/relation_rename_service_spec.rb
.../lib/gitlab/import_export/relation_rename_service_spec.rb
+111
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+4
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+26
-3
spec/requests/api/commit_statuses_spec.rb
spec/requests/api/commit_statuses_spec.rb
+2
-2
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+1
-1
spec/requests/api/pipelines_spec.rb
spec/requests/api/pipelines_spec.rb
+6
-6
spec/requests/api/triggers_spec.rb
spec/requests/api/triggers_spec.rb
+1
-1
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+3
-3
spec/workers/pipeline_schedule_worker_spec.rb
spec/workers/pipeline_schedule_worker_spec.rb
+6
-6
No files found.
app/controllers/projects/branches_controller.rb
View file @
6072b44e
...
...
@@ -22,7 +22,7 @@ class Projects::BranchesController < Projects::ApplicationController
# Fetch branches for the specified mode
fetch_branches_by_mode
@refs_pipelines
=
@project
.
pipelines
.
latest_successful_for_refs
(
@branches
.
map
(
&
:name
))
@refs_pipelines
=
@project
.
ci_
pipelines
.
latest_successful_for_refs
(
@branches
.
map
(
&
:name
))
@merged_branch_names
=
repository
.
merged_branch_names
(
@branches
.
map
(
&
:name
))
# n+1: https://gitlab.com/gitlab-org/gitaly/issues/992
...
...
app/controllers/projects/pipelines_controller.rb
View file @
6072b44e
...
...
@@ -48,7 +48,7 @@ class Projects::PipelinesController < Projects::ApplicationController
end
def
new
@pipeline
=
project
.
pipelines
.
new
(
ref:
@project
.
default_branch
)
@pipeline
=
project
.
all_
pipelines
.
new
(
ref:
@project
.
default_branch
)
end
def
create
...
...
@@ -144,9 +144,9 @@ class Projects::PipelinesController < Projects::ApplicationController
@charts
[
:pipeline_times
]
=
Gitlab
::
Ci
::
Charts
::
PipelineTime
.
new
(
project
)
@counts
=
{}
@counts
[
:total
]
=
@project
.
pipelines
.
count
(
:all
)
@counts
[
:success
]
=
@project
.
pipelines
.
success
.
count
(
:all
)
@counts
[
:failed
]
=
@project
.
pipelines
.
failed
.
count
(
:all
)
@counts
[
:total
]
=
@project
.
all_
pipelines
.
count
(
:all
)
@counts
[
:success
]
=
@project
.
all_
pipelines
.
success
.
count
(
:all
)
@counts
[
:failed
]
=
@project
.
all_
pipelines
.
failed
.
count
(
:all
)
end
private
...
...
@@ -166,7 +166,7 @@ class Projects::PipelinesController < Projects::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def
pipeline
@pipeline
||=
project
.
pipelines
.
all_
pipelines
.
includes
(
user: :status
)
.
find_by!
(
id:
params
[
:id
])
.
present
(
current_user:
current_user
)
...
...
app/controllers/projects/tags_controller.rb
View file @
6072b44e
...
...
@@ -20,7 +20,7 @@ class Projects::TagsController < Projects::ApplicationController
@tags
=
Kaminari
.
paginate_array
(
@tags
).
page
(
params
[
:page
])
tag_names
=
@tags
.
map
(
&
:name
)
@tags_pipelines
=
@project
.
pipelines
.
latest_successful_for_refs
(
tag_names
)
@tags_pipelines
=
@project
.
ci_
pipelines
.
latest_successful_for_refs
(
tag_names
)
@releases
=
project
.
releases
.
where
(
tag:
tag_names
)
respond_to
do
|
format
|
...
...
app/finders/pipelines_finder.rb
View file @
6072b44e
...
...
@@ -8,7 +8,7 @@ class PipelinesFinder
def
initialize
(
project
,
current_user
,
params
=
{})
@project
=
project
@current_user
=
current_user
@pipelines
=
project
.
pipelines
@pipelines
=
project
.
all_
pipelines
@params
=
params
end
...
...
app/models/ci/pipeline.rb
View file @
6072b44e
...
...
@@ -14,14 +14,14 @@ module Ci
prepend
::
EE
::
Ci
::
Pipeline
belongs_to
:project
,
inverse_of: :pipelines
belongs_to
:project
,
inverse_of: :
all_
pipelines
belongs_to
:user
belongs_to
:auto_canceled_by
,
class_name:
'Ci::Pipeline'
belongs_to
:pipeline_schedule
,
class_name:
'Ci::PipelineSchedule'
belongs_to
:merge_request
,
class_name:
'MergeRequest'
has_internal_id
:iid
,
scope: :project
,
presence:
false
,
init:
->
(
s
)
do
s
&
.
project
&
.
pipelines
&
.
maximum
(
:iid
)
||
s
&
.
project
&
.
pipelines
&
.
count
s
&
.
project
&
.
all_pipelines
&
.
maximum
(
:iid
)
||
s
&
.
project
&
.
all_
pipelines
&
.
count
end
has_one
:source_pipeline
,
class_name:
Ci
::
Sources
::
Pipeline
...
...
@@ -186,6 +186,7 @@ module Ci
end
scope
:internal
,
->
{
where
(
source:
internal_sources
)
}
scope
:ci_sources
,
->
{
where
(
config_source:
ci_sources_values
)
}
scope
:sort_by_merge_request_pipelines
,
->
do
sql
=
'CASE ci_pipelines.source WHEN (?) THEN 0 ELSE 1 END, ci_pipelines.id DESC'
...
...
@@ -283,6 +284,10 @@ module Ci
sources
.
reject
{
|
source
|
source
==
"external"
}.
values
end
def
self
.
ci_sources_values
config_sources
.
values_at
(
:repository_source
,
:auto_devops_source
,
:unknown_source
)
end
def
stages_count
statuses
.
select
(
:stage
).
distinct
.
count
end
...
...
app/models/commit.rb
View file @
6072b44e
...
...
@@ -298,7 +298,7 @@ class Commit
end
def
pipelines
project
.
pipelines
.
where
(
sha:
sha
)
project
.
ci_
pipelines
.
where
(
sha:
sha
)
end
def
last_pipeline
...
...
@@ -312,7 +312,7 @@ class Commit
end
def
status_for_project
(
ref
,
pipeline_project
)
pipeline_project
.
pipelines
.
latest_status_per_commit
(
id
,
ref
)[
id
]
pipeline_project
.
ci_
pipelines
.
latest_status_per_commit
(
id
,
ref
)[
id
]
end
def
set_status_for_ref
(
ref
,
status
)
...
...
app/models/commit_collection.rb
View file @
6072b44e
...
...
@@ -24,7 +24,7 @@ class CommitCollection
# Setting this status ahead of time removes the need for running a query for
# every commit we're displaying.
def
with_pipeline_status
statuses
=
project
.
pipelines
.
latest_status_per_commit
(
map
(
&
:id
),
ref
)
statuses
=
project
.
ci_
pipelines
.
latest_status_per_commit
(
map
(
&
:id
),
ref
)
each
do
|
commit
|
commit
.
set_status_for_ref
(
ref
,
statuses
[
commit
.
id
])
...
...
app/models/merge_request.rb
View file @
6072b44e
...
...
@@ -1058,7 +1058,7 @@ class MergeRequest < ActiveRecord::Base
def
all_pipelines
(
shas:
all_commit_shas
)
return
Ci
::
Pipeline
.
none
unless
source_project
@all_pipelines
||=
source_project
.
pipelines
@all_pipelines
||=
source_project
.
ci_
pipelines
.
where
(
sha:
shas
,
ref:
source_branch
)
.
where
(
merge_request:
[
nil
,
self
])
.
sort_by_merge_request_pipelines
...
...
@@ -1222,7 +1222,7 @@ class MergeRequest < ActiveRecord::Base
end
def
base_pipeline
@base_pipeline
||=
project
.
pipelines
@base_pipeline
||=
project
.
ci_
pipelines
.
order
(
id: :desc
)
.
find_by
(
sha:
diff_base_sha
)
end
...
...
app/models/project.rb
View file @
6072b44e
...
...
@@ -248,7 +248,17 @@ class Project < ActiveRecord::Base
has_many
:container_repositories
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:commit_statuses
has_many
:pipelines
,
class_name:
'Ci::Pipeline'
,
inverse_of: :project
# The relation :all_pipelines is intented to be used when we want to get the
# whole list of pipelines associated to the project
has_many
:all_pipelines
,
class_name:
'Ci::Pipeline'
,
inverse_of: :project
# The relation :ci_pipelines is intented to be used when we want to get only
# those pipeline which are directly related to CI. There are
# other pipelines, like webide ones, that we won't retrieve
# if we use this relation.
has_many
:ci_pipelines
,
->
{
Feature
.
enabled?
(
:pipeline_ci_sources_only
,
default_enabled:
true
)
?
ci_sources
:
all
},
class_name:
'Ci::Pipeline'
,
inverse_of: :project
has_many
:stages
,
class_name:
'Ci::Stage'
,
inverse_of: :project
# Ci::Build objects store data on the file system such as artifact files and
...
...
@@ -621,7 +631,7 @@ class Project < ActiveRecord::Base
# ref can't be HEAD, can only be branch/tag name or SHA
def
latest_successful_builds_for
(
ref
=
default_branch
)
latest_pipeline
=
pipelines
.
latest_successful_for
(
ref
)
latest_pipeline
=
ci_
pipelines
.
latest_successful_for
(
ref
)
if
latest_pipeline
latest_pipeline
.
builds
.
latest
.
with_artifacts_archive
...
...
@@ -1376,7 +1386,7 @@ class Project < ActiveRecord::Base
return
unless
sha
pipelines
.
order
(
id: :desc
).
find_by
(
sha:
sha
,
ref:
ref
)
ci_
pipelines
.
order
(
id: :desc
).
find_by
(
sha:
sha
,
ref:
ref
)
end
def
latest_successful_pipeline_for_default_branch
...
...
@@ -1385,12 +1395,12 @@ class Project < ActiveRecord::Base
end
@latest_successful_pipeline_for_default_branch
=
pipelines
.
latest_successful_for
(
default_branch
)
ci_
pipelines
.
latest_successful_for
(
default_branch
)
end
def
latest_successful_pipeline_for
(
ref
=
nil
)
if
ref
&&
ref
!=
default_branch
pipelines
.
latest_successful_for
(
ref
)
ci_
pipelines
.
latest_successful_for
(
ref
)
else
latest_successful_pipeline_for_default_branch
end
...
...
app/models/project_services/pipelines_email_service.rb
View file @
6072b44e
...
...
@@ -38,11 +38,11 @@ class PipelinesEmailService < Service
end
def
can_test?
project
.
pipelines
.
any?
project
.
ci_
pipelines
.
any?
end
def
test_data
(
project
,
user
)
data
=
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
project
.
pipelines
.
last
)
data
=
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
project
.
ci_
pipelines
.
last
)
data
[
:user
]
=
user
.
hook_attrs
data
end
...
...
app/services/ci/create_pipeline_service.rb
View file @
6072b44e
...
...
@@ -86,7 +86,7 @@ module Ci
# rubocop: disable CodeReuse/ActiveRecord
def
auto_cancelable_pipelines
project
.
pipelines
project
.
ci_
pipelines
.
where
(
ref:
pipeline
.
ref
)
.
where
.
not
(
id:
pipeline
.
id
)
.
where
.
not
(
sha:
project
.
commit
(
pipeline
.
ref
).
try
(
:id
))
...
...
app/services/projects/auto_devops/disable_service.rb
View file @
6072b44e
...
...
@@ -34,7 +34,7 @@ module Projects
end
def
auto_devops_pipelines
@auto_devops_pipelines
||=
project
.
pipelines
.
auto_devops_source
@auto_devops_pipelines
||=
project
.
ci_
pipelines
.
auto_devops_source
end
end
end
...
...
app/services/test_hooks/project_service.rb
View file @
6072b44e
...
...
@@ -49,7 +49,7 @@ module TestHooks
end
def
pipeline_events_data
pipeline
=
project
.
pipelines
.
first
pipeline
=
project
.
ci_
pipelines
.
first
throw
(
:validation_error
,
'Ensure the project has CI pipelines.'
)
unless
pipeline
.
present?
Gitlab
::
DataBuilder
::
Pipeline
.
build
(
pipeline
)
...
...
db/fixtures/development/14_pipelines.rb
View file @
6072b44e
...
...
@@ -111,7 +111,7 @@ class Gitlab::Seeder::Pipelines
end
def
create_pipeline!
(
project
,
ref
,
commit
)
project
.
pipelines
.
create!
(
sha:
commit
.
id
,
ref:
ref
,
source: :push
)
project
.
ci_
pipelines
.
create!
(
sha:
commit
.
id
,
ref:
ref
,
source: :push
)
end
def
build_create!
(
pipeline
,
opts
=
{})
...
...
db/fixtures/development/20_vulnerabilities.rb
View file @
6072b44e
...
...
@@ -115,7 +115,7 @@ class Gitlab::Seeder::Vulnerabilities
end
def
pipeline
@pipeline
||=
project
.
pipelines
.
where
(
ref:
project
.
default_branch
).
last
@pipeline
||=
project
.
ci_
pipelines
.
where
(
ref:
project
.
default_branch
).
last
end
def
author
...
...
@@ -124,7 +124,7 @@ class Gitlab::Seeder::Vulnerabilities
end
Gitlab
::
Seeder
.
quiet
do
Project
.
joins
(
:pipelines
).
uniq
.
all
.
sample
(
5
).
each
do
|
project
|
Project
.
joins
(
:
ci_
pipelines
).
uniq
.
all
.
sample
(
5
).
each
do
|
project
|
seeder
=
Gitlab
::
Seeder
::
Vulnerabilities
.
new
(
project
)
seeder
.
seed!
end
...
...
ee/app/models/ee/project.rb
View file @
6072b44e
...
...
@@ -127,8 +127,8 @@ module EE
end
def
latest_pipeline_with_security_reports
pipelines
.
newest_first
(
ref:
default_branch
).
with_security_reports
.
first
||
pipelines
.
newest_first
(
ref:
default_branch
).
with_legacy_security_reports
.
first
ci_
pipelines
.
newest_first
(
ref:
default_branch
).
with_security_reports
.
first
||
ci_
pipelines
.
newest_first
(
ref:
default_branch
).
with_legacy_security_reports
.
first
end
def
environments_for_scope
(
scope
)
...
...
ee/app/models/project_services/github_service.rb
View file @
6072b44e
...
...
@@ -56,7 +56,7 @@ class GithubService < Service
end
def
can_test?
project
.
pipelines
.
any?
project
.
ci_
pipelines
.
any?
end
def
disabled_title
...
...
@@ -72,7 +72,7 @@ class GithubService < Service
end
def
test_data
(
project
,
user
)
pipeline
=
project
.
pipelines
.
newest_first
.
first
pipeline
=
project
.
ci_
pipelines
.
newest_first
.
first
raise
disabled_title
unless
pipeline
...
...
ee/lib/ee/gitlab/ci/pipeline/quota/activity.rb
View file @
6072b44e
...
...
@@ -35,7 +35,7 @@ module EE
end
def
alive_pipelines_count
@project
.
pipelines
.
alive
.
count
@project
.
ci_
pipelines
.
alive
.
count
end
def
max_active_pipelines_count
...
...
ee/spec/features/projects/services/user_activates_github_spec.rb
View file @
6072b44e
...
...
@@ -47,7 +47,7 @@ describe 'User activates GitHub Service' do
context
'with pipelines'
,
:js
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
)
}
let
(
:project
)
{
create
(
:project
,
pipelines:
[
pipeline
])}
let
(
:project
)
{
create
(
:project
,
ci_
pipelines:
[
pipeline
])}
it
'tests service before save'
do
click_button
'Test settings and save changes'
...
...
ee/spec/lib/gitlab/import_export/all_models.yml
View file @
6072b44e
...
...
@@ -10,7 +10,7 @@ merge_requests:
-
approver_groups
-
approved_by_users
-
draft_notes
pipelines
:
ci_
pipelines
:
-
source_pipeline
-
sourced_pipelines
-
triggered_by_pipeline
...
...
ee/spec/models/project_services/github_service_spec.rb
View file @
6072b44e
...
...
@@ -167,7 +167,7 @@ describe GithubService do
describe
'#can_test?'
do
it
'is false if there are no pipelines'
do
project
.
pipelines
.
delete_all
project
.
ci_
pipelines
.
delete_all
expect
(
subject
.
can_test?
).
to
eq
false
end
...
...
@@ -184,7 +184,7 @@ describe GithubService do
let
(
:test_data
)
{
subject
.
test_data
(
project
,
user
)
}
it
'raises error if no pipeline found'
do
project
.
pipelines
.
delete_all
project
.
ci_
pipelines
.
delete_all
expect
{
test_data
}.
to
raise_error
'Please set up a pipeline on your repository.'
end
...
...
lib/api/commit_statuses.rb
View file @
6072b44e
...
...
@@ -29,7 +29,7 @@ module API
not_found!
(
'Commit'
)
unless
user_project
.
commit
(
params
[
:sha
])
pipelines
=
user_project
.
pipelines
.
where
(
sha:
params
[
:sha
])
pipelines
=
user_project
.
ci_
pipelines
.
where
(
sha:
params
[
:sha
])
statuses
=
::
CommitStatus
.
where
(
pipeline:
pipelines
)
statuses
=
statuses
.
latest
unless
to_boolean
(
params
[
:all
])
statuses
=
statuses
.
where
(
ref:
params
[
:ref
])
if
params
[
:ref
].
present?
...
...
@@ -75,7 +75,7 @@ module API
pipeline
=
@project
.
pipeline_for
(
ref
,
commit
.
sha
)
unless
pipeline
pipeline
=
@project
.
pipelines
.
create!
(
pipeline
=
@project
.
ci_
pipelines
.
create!
(
source: :external
,
sha:
commit
.
sha
,
ref:
ref
,
...
...
lib/api/jobs.rb
View file @
6072b44e
...
...
@@ -56,7 +56,7 @@ module API
end
# rubocop: disable CodeReuse/ActiveRecord
get
':id/pipelines/:pipeline_id/jobs'
do
pipeline
=
user_project
.
pipelines
.
find
(
params
[
:pipeline_id
])
pipeline
=
user_project
.
ci_
pipelines
.
find
(
params
[
:pipeline_id
])
builds
=
pipeline
.
builds
builds
=
filter_builds
(
builds
,
params
[
:scope
])
builds
=
builds
.
preload
(
:job_artifacts_archive
,
:job_artifacts
,
project:
[
:namespace
])
...
...
lib/api/pipelines.rb
View file @
6072b44e
...
...
@@ -130,7 +130,7 @@ module API
helpers
do
def
pipeline
@pipeline
||=
user_project
.
pipelines
.
find
(
params
[
:pipeline_id
])
@pipeline
||=
user_project
.
ci_
pipelines
.
find
(
params
[
:pipeline_id
])
end
end
end
...
...
lib/gitlab/badge/coverage/report.rb
View file @
6072b44e
...
...
@@ -14,7 +14,7 @@ module Gitlab
@ref
=
ref
@job
=
job
@pipeline
=
@project
.
pipelines
.
latest_successful_for
(
@ref
)
@pipeline
=
@project
.
ci_
pipelines
.
latest_successful_for
(
@ref
)
end
def
entity
...
...
lib/gitlab/badge/pipeline/status.rb
View file @
6072b44e
...
...
@@ -22,7 +22,7 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def
status
@project
.
pipelines
@project
.
ci_
pipelines
.
where
(
sha:
@sha
)
.
latest_status
(
@ref
)
||
'unknown'
end
...
...
lib/gitlab/ci/charts.rb
View file @
6072b44e
...
...
@@ -54,7 +54,7 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def
collect
query
=
project
.
pipelines
query
=
project
.
all_
pipelines
.
where
(
"? >
#{
::
Ci
::
Pipeline
.
table_name
}
.created_at AND
#{
::
Ci
::
Pipeline
.
table_name
}
.created_at > ?"
,
@to
,
@from
)
# rubocop:disable GitlabSecurity/SqlInjection
totals_count
=
grouped_count
(
query
)
...
...
@@ -115,7 +115,7 @@ module Gitlab
class
PipelineTime
<
Chart
def
collect
commits
=
project
.
pipelines
.
last
(
30
)
commits
=
project
.
all_
pipelines
.
last
(
30
)
commits
.
each
do
|
commit
|
@labels
<<
commit
.
short_sha
...
...
lib/gitlab/import_export/import_export.yml
View file @
6072b44e
...
...
@@ -51,7 +51,7 @@ project_tree:
-
resource_label_events
:
-
label
:
:priorities
-
pipelines
:
-
ci_
pipelines
:
-
notes
:
-
:author
-
events
:
...
...
lib/gitlab/import_export/project_tree_restorer.rb
View file @
6072b44e
...
...
@@ -26,6 +26,8 @@ module Gitlab
@project_members
=
@tree_hash
.
delete
(
'project_members'
)
RelationRenameService
.
rename
(
@tree_hash
)
ActiveRecord
::
Base
.
uncached
do
ActiveRecord
::
Base
.
no_touching
do
create_relations
...
...
@@ -214,7 +216,7 @@ module Gitlab
end
def
nil_iid_pipeline?
(
relation_key
,
relation_item
)
relation_key
==
'pipelines'
&&
relation_item
[
'iid'
].
nil?
relation_key
==
'
ci_
pipelines'
&&
relation_item
[
'iid'
].
nil?
end
end
end
...
...
lib/gitlab/import_export/project_tree_saver.rb
View file @
6072b44e
...
...
@@ -34,6 +34,8 @@ module Gitlab
project_json
[
'project_members'
]
+=
group_members_json
RelationRenameService
.
add_new_associations
(
project_json
)
project_json
.
to_json
end
...
...
lib/gitlab/import_export/relation_factory.rb
View file @
6072b44e
...
...
@@ -6,6 +6,7 @@ module Gitlab
prepend
::
EE
::
Gitlab
::
ImportExport
::
RelationFactory
OVERRIDES
=
{
snippets: :project_snippets
,
ci_pipelines:
'Ci::Pipeline'
,
pipelines:
'Ci::Pipeline'
,
stages:
'Ci::Stage'
,
statuses:
'commit_status'
,
...
...
lib/gitlab/import_export/relation_rename_service.rb
0 → 100644
View file @
6072b44e
# frozen_string_literal: true
# This class is intended to help with relation renames within Gitlab versions
# and allow compatibility between versions.
# If you have to change one relationship name that is imported/exported,
# you should add it to the RENAMES constant indicating the old name and the
# new one.
# The behavior of these renamed relationships should be transient and it should
# only last one release until you completely remove the renaming from the list.
#
# When importing, this class will check the project hash and:
# - if only the old relationship name is found, it will rename it with the new one
# - if only the new relationship name is found, it will do nothing
# - if it finds both, it will use the new relationship data
#
# When exporting, this class will duplicate the keys in the resulting file.
# This way, if we open the file in an old version of the exporter it will work
# and also it will with the newer versions.
module
Gitlab
module
ImportExport
class
RelationRenameService
RENAMES
=
{
'pipelines'
=>
'ci_pipelines'
# Added in 11.6, remove in 11.7
}.
freeze
def
self
.
rename
(
tree_hash
)
return
unless
tree_hash
&
.
present?
RENAMES
.
each
do
|
old_name
,
new_name
|
old_entry
=
tree_hash
.
delete
(
old_name
)
next
if
tree_hash
[
new_name
]
next
unless
old_entry
tree_hash
[
new_name
]
=
old_entry
end
end
def
self
.
add_new_associations
(
tree_hash
)
RENAMES
.
each
do
|
old_name
,
new_name
|
next
if
tree_hash
.
key?
(
old_name
)
tree_hash
[
old_name
]
=
tree_hash
[
new_name
]
end
end
end
end
end
spec/features/projects/commit/builds_spec.rb
View file @
6072b44e
...
...
@@ -20,7 +20,7 @@ describe 'project commit pipelines', :js do
visit
pipelines_project_commit_path
(
project
,
project
.
commit
.
sha
)
page
.
within
(
'.table-holder'
)
do
expect
(
page
).
to
have_content
project
.
pipelines
[
0
].
id
# pipeline ids
expect
(
page
).
to
have_content
project
.
ci_
pipelines
[
0
].
id
# pipeline ids
end
end
end
...
...
spec/features/projects/pages_spec.rb
View file @
6072b44e
...
...
@@ -300,7 +300,7 @@ describe 'Pages' do
let
(
:pipeline
)
do
commit_sha
=
project
.
commit
(
'HEAD'
).
sha
project
.
pipelines
.
create
(
project
.
ci_
pipelines
.
create
(
ref:
'HEAD'
,
sha:
commit_sha
,
source: :push
,
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
6072b44e
...
...
@@ -103,7 +103,7 @@ merge_request_diff_commits:
-
merge_request_diff
merge_request_diff_files
:
-
merge_request_diff
pipelines
:
ci_
pipelines
:
-
project
-
user
-
stages
...
...
@@ -265,7 +265,8 @@ project:
-
notification_settings
-
import_data
-
commit_statuses
-
pipelines
-
ci_pipelines
-
all_pipelines
-
stages
-
builds
-
runner_projects
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
6072b44e
...
...
@@ -197,9 +197,9 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end
it
'has the correct number of pipelines and statuses'
do
expect
(
@project
.
pipelines
.
size
).
to
eq
(
5
)
expect
(
@project
.
ci_
pipelines
.
size
).
to
eq
(
5
)
@project
.
pipelines
.
zip
([
2
,
2
,
2
,
2
,
2
])
@project
.
ci_
pipelines
.
zip
([
2
,
2
,
2
,
2
,
2
])
.
each
do
|
(
pipeline
,
expected_status_size
)
|
expect
(
pipeline
.
statuses
.
size
).
to
eq
(
expected_status_size
)
end
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
6072b44e
...
...
@@ -123,16 +123,16 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
end
it
'has pipeline stages'
do
expect
(
saved_project_json
.
dig
(
'pipelines'
,
0
,
'stages'
)).
not_to
be_empty
expect
(
saved_project_json
.
dig
(
'
ci_
pipelines'
,
0
,
'stages'
)).
not_to
be_empty
end
it
'has pipeline statuses'
do
expect
(
saved_project_json
.
dig
(
'pipelines'
,
0
,
'stages'
,
0
,
'statuses'
)).
not_to
be_empty
expect
(
saved_project_json
.
dig
(
'
ci_
pipelines'
,
0
,
'stages'
,
0
,
'statuses'
)).
not_to
be_empty
end
it
'has pipeline builds'
do
builds_count
=
saved_project_json
.
dig
(
'pipelines'
,
0
,
'stages'
,
0
,
'statuses'
)
.
dig
(
'
ci_
pipelines'
,
0
,
'stages'
,
0
,
'statuses'
)
.
count
{
|
hash
|
hash
[
'type'
]
==
'Ci::Build'
}
expect
(
builds_count
).
to
eq
(
1
)
...
...
@@ -146,11 +146,11 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
end
it
'has pipeline commits'
do
expect
(
saved_project_json
[
'pipelines'
]).
not_to
be_empty
expect
(
saved_project_json
[
'
ci_
pipelines'
]).
not_to
be_empty
end
it
'has ci pipeline notes'
do
expect
(
saved_project_json
[
'pipelines'
].
first
[
'notes'
]).
not_to
be_empty
expect
(
saved_project_json
[
'
ci_
pipelines'
].
first
[
'notes'
]).
not_to
be_empty
end
it
'has labels with no associations'
do
...
...
spec/lib/gitlab/import_export/relation_rename_service_spec.rb
0 → 100644
View file @
6072b44e
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
RelationRenameService
do
let
(
:renames
)
do
{
'example_relation1'
=>
'new_example_relation1'
,
'example_relation2'
=>
'new_example_relation2'
}
end
let
(
:user
)
{
create
(
:admin
)
}
let
(
:group
)
{
create
(
:group
,
:nested
)
}
let!
(
:project
)
{
create
(
:project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
}
let
(
:shared
)
{
project
.
import_export_shared
}
before
do
stub_const
(
"
#{
described_class
}
::RENAMES"
,
renames
)
end
context
'when importing'
do
let
(
:project_tree_restorer
)
{
Gitlab
::
ImportExport
::
ProjectTreeRestorer
.
new
(
user:
user
,
shared:
shared
,
project:
project
)
}
let
(
:import_path
)
{
'spec/lib/gitlab/import_export'
}
let
(
:file_content
)
{
IO
.
read
(
"
#{
import_path
}
/project.json"
)
}
let!
(
:json_file
)
{
ActiveSupport
::
JSON
.
decode
(
file_content
)
}
let
(
:tree_hash
)
{
project_tree_restorer
.
instance_variable_get
(
:@tree_hash
)
}
before
do
allow
(
shared
).
to
receive
(
:export_path
).
and_return
(
import_path
)
allow
(
ActiveSupport
::
JSON
).
to
receive
(
:decode
).
with
(
file_content
).
and_return
(
json_file
)
end
context
'when the file has only old relationship names'
do
# Configuring the json as an old version exported file, with only
# the previous association with the old name
before
do
renames
.
each
do
|
old_name
,
_
|
json_file
[
old_name
.
to_s
]
=
[]
end
end
it
'renames old relationships to the new name'
do
expect
(
json_file
.
keys
).
to
include
(
*
renames
.
keys
)
project_tree_restorer
.
restore
expect
(
json_file
.
keys
).
to
include
(
*
renames
.
values
)
expect
(
json_file
.
keys
).
not_to
include
(
*
renames
.
keys
)
end
end
context
'when the file has both the old and new relationships'
do
# Configuring the json as the new version exported file, with both
# the old association name and the new one
before
do
renames
.
each
do
|
old_name
,
new_name
|
json_file
[
old_name
.
to_s
]
=
[
1
]
json_file
[
new_name
.
to_s
]
=
[
2
]
end
end
it
'uses the new relationships and removes the old ones from the hash'
do
expect
(
json_file
.
keys
).
to
include
(
*
renames
.
keys
)
project_tree_restorer
.
restore
expect
(
json_file
.
keys
).
to
include
(
*
renames
.
values
)
expect
(
json_file
.
values_at
(
*
renames
.
values
).
flatten
.
uniq
.
first
).
to
eq
2
expect
(
json_file
.
keys
).
not_to
include
(
*
renames
.
keys
)
end
end
context
'when the file has only new relationship names'
do
# Configuring the json as the future version exported file, with only
# the new association name
before
do
renames
.
each
do
|
_
,
new_name
|
json_file
[
new_name
.
to_s
]
=
[]
end
end
it
'uses the new relationships'
do
expect
(
json_file
.
keys
).
not_to
include
(
*
renames
.
keys
)
project_tree_restorer
.
restore
expect
(
json_file
.
keys
).
to
include
(
*
renames
.
values
)
end
end
end
context
'when exporting'
do
let
(
:project_tree_saver
)
{
Gitlab
::
ImportExport
::
ProjectTreeSaver
.
new
(
project:
project
,
current_user:
user
,
shared:
shared
)
}
let
(
:project_tree
)
{
project_tree_saver
.
send
(
:project_json
)
}
it
'adds old relationships to the exported file'
do
project_tree
.
merge!
(
renames
.
values
.
map
{
|
new_name
|
[
new_name
,
[]]
}.
to_h
)
allow
(
project_tree_saver
).
to
receive
(
:save
)
do
|
arg
|
project_tree_saver
.
send
(
:project_json_tree
)
end
result
=
project_tree_saver
.
save
saved_data
=
ActiveSupport
::
JSON
.
decode
(
result
)
expect
(
saved_data
.
keys
).
to
include
(
*
(
renames
.
keys
+
renames
.
values
))
end
end
end
spec/models/ci/pipeline_spec.rb
View file @
6072b44e
...
...
@@ -37,8 +37,9 @@ describe Ci::Pipeline, :mailer do
describe
'associations'
do
it
'has a bidirectional relationship with projects'
do
expect
(
described_class
.
reflect_on_association
(
:project
).
has_inverse?
).
to
eq
(
:pipelines
)
expect
(
Project
.
reflect_on_association
(
:pipelines
).
has_inverse?
).
to
eq
(
:project
)
expect
(
described_class
.
reflect_on_association
(
:project
).
has_inverse?
).
to
eq
(
:all_pipelines
)
expect
(
Project
.
reflect_on_association
(
:all_pipelines
).
has_inverse?
).
to
eq
(
:project
)
expect
(
Project
.
reflect_on_association
(
:ci_pipelines
).
has_inverse?
).
to
eq
(
:project
)
end
end
...
...
@@ -1195,7 +1196,7 @@ describe Ci::Pipeline, :mailer do
create
(
:ci_build
,
:allowed_to_fail
,
:failed
,
pipeline:
pipeline
,
name:
'rubocop'
)
create
(
:ci_build
,
:allowed_to_fail
,
:failed
,
pipeline:
pipeline2
,
name:
'rubocop'
)
pipelines
=
project
.
pipelines
.
to_a
pipelines
=
project
.
ci_
pipelines
.
to_a
pipelines
.
each
(
&
:number_of_warnings
)
...
...
spec/models/project_spec.rb
View file @
6072b44e
...
...
@@ -64,7 +64,7 @@ describe Project do
it
{
is_expected
.
to
have_one
(
:forked_from_project
).
through
(
:fork_network_member
)
}
it
{
is_expected
.
to
have_one
(
:auto_devops
).
class_name
(
'ProjectAutoDevops'
)
}
it
{
is_expected
.
to
have_many
(
:commit_statuses
)
}
it
{
is_expected
.
to
have_many
(
:pipelines
)
}
it
{
is_expected
.
to
have_many
(
:
ci_
pipelines
)
}
it
{
is_expected
.
to
have_many
(
:builds
)
}
it
{
is_expected
.
to
have_many
(
:build_trace_section_names
)}
it
{
is_expected
.
to
have_many
(
:runner_projects
)
}
...
...
@@ -134,6 +134,29 @@ describe Project do
let
(
:namespace
)
{
project
}
end
end
describe
'ci_pipelines association'
do
context
'when feature flag pipeline_ci_sources_only is enabled'
do
it
'returns only pipelines from ci_sources'
do
stub_feature_flags
(
pipeline_ci_sources_only:
true
)
expect
(
Ci
::
Pipeline
).
to
receive
(
:ci_sources
).
and_call_original
subject
.
ci_pipelines
end
end
context
'when feature flag pipeline_ci_sources_only is disabled'
do
it
'returns all pipelines'
do
stub_feature_flags
(
pipeline_ci_sources_only:
false
)
expect
(
Ci
::
Pipeline
).
not_to
receive
(
:ci_sources
).
and_call_original
expect
(
Ci
::
Pipeline
).
to
receive
(
:all
).
and_call_original
.
at_least
(
:once
)
subject
.
ci_pipelines
end
end
end
end
describe
'modules'
do
...
...
@@ -3654,7 +3677,7 @@ describe Project do
context
'with a ref that is not the default branch'
do
it
'returns the latest successful pipeline for the given ref'
do
expect
(
project
.
pipelines
).
to
receive
(
:latest_successful_for
).
with
(
'foo'
)
expect
(
project
.
ci_
pipelines
).
to
receive
(
:latest_successful_for
).
with
(
'foo'
)
project
.
latest_successful_pipeline_for
(
'foo'
)
end
...
...
@@ -3682,7 +3705,7 @@ describe Project do
it
'memoizes and returns the latest successful pipeline for the default branch'
do
pipeline
=
double
(
:pipeline
)
expect
(
project
.
pipelines
).
to
receive
(
:latest_successful_for
)
expect
(
project
.
ci_
pipelines
).
to
receive
(
:latest_successful_for
)
.
with
(
project
.
default_branch
)
.
and_return
(
pipeline
)
.
once
...
...
spec/requests/api/commit_statuses_spec.rb
View file @
6072b44e
...
...
@@ -16,8 +16,8 @@ describe API::CommitStatuses do
let
(
:get_url
)
{
"/projects/
#{
project
.
id
}
/repository/commits/
#{
sha
}
/statuses"
}
context
'ci commit exists'
do
let!
(
:master
)
{
project
.
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'master'
,
protected:
false
)
}
let!
(
:develop
)
{
project
.
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'develop'
,
protected:
false
)
}
let!
(
:master
)
{
project
.
ci_
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'master'
,
protected:
false
)
}
let!
(
:develop
)
{
project
.
ci_
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'develop'
,
protected:
false
)
}
context
"reporter user"
do
let
(
:statuses_id
)
{
json_response
.
map
{
|
status
|
status
[
'id'
]
}
}
...
...
spec/requests/api/commits_spec.rb
View file @
6072b44e
...
...
@@ -818,7 +818,7 @@ describe API::Commits do
end
context
'when the ref has a pipeline'
do
let!
(
:pipeline
)
{
project
.
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
commit
.
sha
,
protected:
false
)
}
let!
(
:pipeline
)
{
project
.
ci_
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
commit
.
sha
,
protected:
false
)
}
it
'includes a "created" status'
do
get
api
(
route
,
current_user
)
...
...
spec/requests/api/pipelines_spec.rb
View file @
6072b44e
...
...
@@ -304,7 +304,7 @@ describe API::Pipelines do
it
'creates and returns a new pipeline'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/pipeline"
,
user
),
ref:
project
.
default_branch
end
.
to
change
{
project
.
pipelines
.
count
}.
by
(
1
)
end
.
to
change
{
project
.
ci_
pipelines
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
).
to
be_a
Hash
...
...
@@ -317,8 +317,8 @@ describe API::Pipelines do
it
'creates and returns a new pipeline using the given variables'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/pipeline"
,
user
),
ref:
project
.
default_branch
,
variables:
variables
end
.
to
change
{
project
.
pipelines
.
count
}.
by
(
1
)
expect_variables
(
project
.
pipelines
.
last
.
variables
,
variables
)
end
.
to
change
{
project
.
ci_
pipelines
.
count
}.
by
(
1
)
expect_variables
(
project
.
ci_
pipelines
.
last
.
variables
,
variables
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
).
to
be_a
Hash
...
...
@@ -338,8 +338,8 @@ describe API::Pipelines do
it
'creates and returns a new pipeline using the given variables'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/pipeline"
,
user
),
ref:
project
.
default_branch
,
variables:
variables
end
.
to
change
{
project
.
pipelines
.
count
}.
by
(
1
)
expect_variables
(
project
.
pipelines
.
last
.
variables
,
variables
)
end
.
to
change
{
project
.
ci_
pipelines
.
count
}.
by
(
1
)
expect_variables
(
project
.
ci_
pipelines
.
last
.
variables
,
variables
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
).
to
be_a
Hash
...
...
@@ -353,7 +353,7 @@ describe API::Pipelines do
it
"doesn't create a job"
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/pipeline"
,
user
),
ref:
project
.
default_branch
end
.
not_to
change
{
project
.
pipelines
.
count
}
end
.
not_to
change
{
project
.
ci_
pipelines
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
...
...
spec/requests/api/triggers_spec.rb
View file @
6072b44e
...
...
@@ -39,7 +39,7 @@ describe API::Triggers do
end
context
'Have a commit'
do
let
(
:pipeline
)
{
project
.
pipelines
.
last
}
let
(
:pipeline
)
{
project
.
ci_
pipelines
.
last
}
it
'creates pipeline'
do
post
api
(
"/projects/
#{
project
.
id
}
/trigger/pipeline"
),
options
.
merge
(
ref:
'master'
)
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
6072b44e
...
...
@@ -44,7 +44,7 @@ describe Ci::CreatePipelineService do
expect
(
pipeline
).
to
be_valid
expect
(
pipeline
).
to
be_persisted
expect
(
pipeline
).
to
be_push
expect
(
pipeline
).
to
eq
(
project
.
pipelines
.
last
)
expect
(
pipeline
).
to
eq
(
project
.
ci_
pipelines
.
last
)
expect
(
pipeline
).
to
have_attributes
(
user:
user
)
expect
(
pipeline
).
to
have_attributes
(
status:
'pending'
)
expect
(
pipeline
.
repository_source?
).
to
be
true
...
...
@@ -731,8 +731,8 @@ describe Ci::CreatePipelineService do
it
'creates a merge request pipeline in the forked project'
do
expect
(
pipeline
).
to
be_persisted
expect
(
project
.
pipelines
).
to
eq
([
pipeline
])
expect
(
target_project
.
pipelines
).
to
be_empty
expect
(
project
.
ci_
pipelines
).
to
eq
([
pipeline
])
expect
(
target_project
.
ci_
pipelines
).
to
be_empty
end
end
...
...
spec/workers/pipeline_schedule_worker_spec.rb
View file @
6072b44e
...
...
@@ -25,12 +25,12 @@ describe PipelineScheduleWorker do
context
'when there is a scheduled pipeline within next_run_at'
do
shared_examples
'successful scheduling'
do
it
'creates a new pipeline'
do
expect
{
subject
}.
to
change
{
project
.
pipelines
.
count
}.
by
(
1
)
expect
{
subject
}.
to
change
{
project
.
ci_
pipelines
.
count
}.
by
(
1
)
expect
(
Ci
::
Pipeline
.
last
).
to
be_schedule
pipeline_schedule
.
reload
expect
(
pipeline_schedule
.
next_run_at
).
to
be
>
Time
.
now
expect
(
pipeline_schedule
).
to
eq
(
project
.
pipelines
.
last
.
pipeline_schedule
)
expect
(
pipeline_schedule
).
to
eq
(
project
.
ci_
pipelines
.
last
.
pipeline_schedule
)
expect
(
pipeline_schedule
).
to
be_active
end
end
...
...
@@ -54,7 +54,7 @@ describe PipelineScheduleWorker do
end
it
'does not creates a new pipeline'
do
expect
{
subject
}.
not_to
change
{
project
.
pipelines
.
count
}
expect
{
subject
}.
not_to
change
{
project
.
ci_
pipelines
.
count
}
end
end
...
...
@@ -64,7 +64,7 @@ describe PipelineScheduleWorker do
end
it
'creates a failed pipeline with the reason'
do
expect
{
subject
}.
to
change
{
project
.
pipelines
.
count
}.
by
(
1
)
expect
{
subject
}.
to
change
{
project
.
ci_
pipelines
.
count
}.
by
(
1
)
expect
(
Ci
::
Pipeline
.
last
).
to
be_config_error
expect
(
Ci
::
Pipeline
.
last
.
yaml_errors
).
not_to
be_nil
end
...
...
@@ -105,7 +105,7 @@ describe PipelineScheduleWorker do
end
it
'does not create a pipeline'
do
expect
{
subject
}.
not_to
change
{
project
.
pipelines
.
count
}
expect
{
subject
}.
not_to
change
{
project
.
ci_
pipelines
.
count
}
end
it
'does not raise an exception'
do
...
...
@@ -135,7 +135,7 @@ describe PipelineScheduleWorker do
end
it
'does not create a pipeline'
do
expect
{
subject
}.
not_to
change
{
project
.
pipelines
.
count
}
expect
{
subject
}.
not_to
change
{
project
.
ci_
pipelines
.
count
}
end
it
'does not raise an exception'
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