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
Boxiang Sun
gitlab-ce
Commits
25b99a5b
Commit
25b99a5b
authored
Jun 07, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests and application
parent
d03e6878
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
124 additions
and
18 deletions
+124
-18
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+0
-4
app/services/git_push_service.rb
app/services/git_push_service.rb
+3
-2
app/services/git_tag_push_service.rb
app/services/git_tag_push_service.rb
+2
-0
changelogs/unreleased/fix-support-for-external-ci-services.yml
...elogs/unreleased/fix-support-for-external-ci-services.yml
+4
-0
lib/gitlab/ci/status/external/common.rb
lib/gitlab/ci/status/external/common.rb
+1
-1
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+30
-7
spec/features/projects/features_visibility_spec.rb
spec/features/projects/features_visibility_spec.rb
+4
-1
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+33
-0
spec/lib/gitlab/ci/status/external/common_spec.rb
spec/lib/gitlab/ci/status/external/common_spec.rb
+8
-1
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+12
-0
spec/serializers/job_entity_spec.rb
spec/serializers/job_entity_spec.rb
+2
-2
spec/serializers/pipeline_details_entity_spec.rb
spec/serializers/pipeline_details_entity_spec.rb
+14
-0
spec/serializers/stage_entity_spec.rb
spec/serializers/stage_entity_spec.rb
+11
-0
No files found.
app/controllers/projects/application_controller.rb
View file @
25b99a5b
...
@@ -80,10 +80,6 @@ class Projects::ApplicationController < ApplicationController
...
@@ -80,10 +80,6 @@ class Projects::ApplicationController < ApplicationController
cookies
.
permanent
[
:diff_view
]
=
params
.
delete
(
:view
)
if
params
[
:view
].
present?
cookies
.
permanent
[
:diff_view
]
=
params
.
delete
(
:view
)
if
params
[
:view
].
present?
end
end
def
builds_enabled
return
render_404
unless
@project
.
feature_available?
(
:builds
,
current_user
)
end
def
require_pages_enabled!
def
require_pages_enabled!
not_found
unless
Gitlab
.
config
.
pages
.
enabled
not_found
unless
Gitlab
.
config
.
pages
.
enabled
end
end
...
...
app/services/git_push_service.rb
View file @
25b99a5b
...
@@ -101,9 +101,10 @@ class GitPushService < BaseService
...
@@ -101,9 +101,10 @@ class GitPushService < BaseService
UpdateMergeRequestsWorker
UpdateMergeRequestsWorker
.
perform_async
(
@project
.
id
,
current_user
.
id
,
params
[
:oldrev
],
params
[
:newrev
],
params
[
:ref
])
.
perform_async
(
@project
.
id
,
current_user
.
id
,
params
[
:oldrev
],
params
[
:newrev
],
params
[
:ref
])
SystemHookPushWorker
.
perform_async
(
build_push_data
.
dup
,
:push_hooks
)
Ci
::
CreatePipelineService
.
new
(
@project
,
current_user
,
build_push_data
).
execute
(
:push
)
EventCreateService
.
new
.
push
(
@project
,
current_user
,
build_push_data
)
EventCreateService
.
new
.
push
(
@project
,
current_user
,
build_push_data
)
Ci
::
CreatePipelineService
.
new
(
@project
,
current_user
,
build_push_data
).
execute
(
:push
)
SystemHookPushWorker
.
perform_async
(
build_push_data
.
dup
,
:push_hooks
)
@project
.
execute_hooks
(
build_push_data
.
dup
,
:push_hooks
)
@project
.
execute_hooks
(
build_push_data
.
dup
,
:push_hooks
)
@project
.
execute_services
(
build_push_data
.
dup
,
:push_hooks
)
@project
.
execute_services
(
build_push_data
.
dup
,
:push_hooks
)
...
...
app/services/git_tag_push_service.rb
View file @
25b99a5b
...
@@ -9,9 +9,11 @@ class GitTagPushService < BaseService
...
@@ -9,9 +9,11 @@ class GitTagPushService < BaseService
EventCreateService
.
new
.
push
(
project
,
current_user
,
@push_data
)
EventCreateService
.
new
.
push
(
project
,
current_user
,
@push_data
)
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
@push_data
).
execute
(
:push
)
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
@push_data
).
execute
(
:push
)
SystemHooksService
.
new
.
execute_hooks
(
build_system_push_data
.
dup
,
:tag_push_hooks
)
SystemHooksService
.
new
.
execute_hooks
(
build_system_push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_hooks
(
@push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_hooks
(
@push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_services
(
@push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_services
(
@push_data
.
dup
,
:tag_push_hooks
)
ProjectCacheWorker
.
perform_async
(
project
.
id
,
[],
[
:commit_count
,
:repository_size
])
ProjectCacheWorker
.
perform_async
(
project
.
id
,
[],
[
:commit_count
,
:repository_size
])
true
true
...
...
changelogs/unreleased/fix-support-for-external-ci-services.yml
0 → 100644
View file @
25b99a5b
---
title
:
Fix support for external CI services
merge_request
:
11176
author
:
lib/gitlab/ci/status/external/common.rb
View file @
25b99a5b
...
@@ -4,7 +4,7 @@ module Gitlab
...
@@ -4,7 +4,7 @@ module Gitlab
module
External
module
External
module
Common
module
Common
def
label
def
label
subject
.
description
||
super
subject
.
description
end
end
def
has_details?
def
has_details?
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
25b99a5b
...
@@ -5,9 +5,12 @@ describe Projects::PipelinesController do
...
@@ -5,9 +5,12 @@ describe Projects::PipelinesController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:feature
)
{
ProjectFeature
::
DISABLED
}
before
do
before
do
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
project
.
project_feature
.
update
(
builds_access_level:
feature
)
sign_in
(
user
)
sign_in
(
user
)
end
end
...
@@ -153,16 +156,26 @@ describe Projects::PipelinesController do
...
@@ -153,16 +156,26 @@ describe Projects::PipelinesController do
format: :json
format: :json
end
end
it
'retries a pipeline without returning any content'
do
context
'when builds are enabled'
do
expect
(
response
).
to
have_http_status
(
:no_content
)
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
expect
(
build
.
reload
).
to
be_retried
it
'retries a pipeline without returning any content'
do
expect
(
response
).
to
have_http_status
(
:no_content
)
expect
(
build
.
reload
).
to
be_retried
end
end
context
'when builds are disabled'
do
it
'fails to retry pipeline'
do
expect
(
response
).
to
have_http_status
(
:not_found
)
end
end
end
end
end
describe
'POST cancel.json'
do
describe
'POST cancel.json'
do
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:running
,
pipeline:
pipeline
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:running
,
pipeline:
pipeline
)
}
before
do
before
do
post
:cancel
,
namespace_id:
project
.
namespace
,
post
:cancel
,
namespace_id:
project
.
namespace
,
project_id:
project
,
project_id:
project
,
...
@@ -170,9 +183,19 @@ describe Projects::PipelinesController do
...
@@ -170,9 +183,19 @@ describe Projects::PipelinesController do
format: :json
format: :json
end
end
it
'cancels a pipeline without returning any content'
do
context
'when builds are enabled'
do
expect
(
response
).
to
have_http_status
(
:no_content
)
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
expect
(
pipeline
.
reload
).
to
be_canceled
it
'cancels a pipeline without returning any content'
do
expect
(
response
).
to
have_http_status
(
:no_content
)
expect
(
pipeline
.
reload
).
to
be_canceled
end
end
context
'when builds are disabled'
do
it
'fails to retry pipeline'
do
expect
(
response
).
to
have_http_status
(
:not_found
)
end
end
end
end
end
end
end
spec/features/projects/features_visibility_spec.rb
View file @
25b99a5b
...
@@ -68,9 +68,12 @@ describe 'Edit Project Settings', feature: true do
...
@@ -68,9 +68,12 @@ describe 'Edit Project Settings', feature: true do
end
end
describe
'project features visibility pages'
do
describe
'project features visibility pages'
do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
(
:tools
)
do
let
(
:tools
)
do
{
{
builds:
namespace_project_
pipelines_path
(
project
.
namespace
,
project
),
builds:
namespace_project_
job_path
(
project
.
namespace
,
project
,
job
),
issues:
namespace_project_issues_path
(
project
.
namespace
,
project
),
issues:
namespace_project_issues_path
(
project
.
namespace
,
project
),
wiki:
namespace_project_wiki_path
(
project
.
namespace
,
project
,
:home
),
wiki:
namespace_project_wiki_path
(
project
.
namespace
,
project
,
:home
),
snippets:
namespace_project_snippets_path
(
project
.
namespace
,
project
),
snippets:
namespace_project_snippets_path
(
project
.
namespace
,
project
),
...
...
spec/helpers/projects_helper_spec.rb
View file @
25b99a5b
...
@@ -300,4 +300,37 @@ describe ProjectsHelper do
...
@@ -300,4 +300,37 @@ describe ProjectsHelper do
expect
(
helper
.
send
(
:visibility_select_options
,
project
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
include
(
'Private'
)
expect
(
helper
.
send
(
:visibility_select_options
,
project
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
include
(
'Private'
)
end
end
end
end
describe
'#get_project_nav_tabs'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
allow
(
helper
).
to
receive
(
:can?
)
{
true
}
end
subject
do
helper
.
send
(
:get_project_nav_tabs
,
project
,
user
)
end
context
'when builds feature is enabled'
do
before
do
allow
(
project
).
to
receive
(
:builds_enabled?
).
and_return
(
true
)
end
it
"does include pipelines tab"
do
is_expected
.
to
include
(
:pipelines
)
end
end
context
'when builds feature is disabled'
do
before
do
allow
(
project
).
to
receive
(
:builds_enabled?
).
and_return
(
false
)
end
it
"do not include pipelines tab"
do
is_expected
.
not_to
include
(
:pipelines
)
end
end
end
end
end
spec/lib/gitlab/ci/status/external/common_spec.rb
View file @
25b99a5b
...
@@ -4,9 +4,10 @@ describe Gitlab::Ci::Status::External::Common do
...
@@ -4,9 +4,10 @@ describe Gitlab::Ci::Status::External::Common do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
external_status
.
project
}
let
(
:project
)
{
external_status
.
project
}
let
(
:external_target_url
)
{
'http://example.gitlab.com/status'
}
let
(
:external_target_url
)
{
'http://example.gitlab.com/status'
}
let
(
:external_description
)
{
'my description'
}
let
(
:external_status
)
do
let
(
:external_status
)
do
create
(
:generic_commit_status
,
target_url:
external_target_url
)
create
(
:generic_commit_status
,
target_url:
external_target_url
,
description:
external_description
)
end
end
subject
do
subject
do
...
@@ -15,6 +16,12 @@ describe Gitlab::Ci::Status::External::Common do
...
@@ -15,6 +16,12 @@ describe Gitlab::Ci::Status::External::Common do
.
extend
(
described_class
)
.
extend
(
described_class
)
end
end
describe
'#label'
do
it
'returns description'
do
expect
(
subject
.
label
).
to
eq
external_description
end
end
describe
'#has_action?'
do
describe
'#has_action?'
do
it
{
is_expected
.
not_to
have_action
}
it
{
is_expected
.
not_to
have_action
}
end
end
...
...
spec/policies/project_policy_spec.rb
View file @
25b99a5b
...
@@ -139,6 +139,18 @@ describe ProjectPolicy, models: true do
...
@@ -139,6 +139,18 @@ describe ProjectPolicy, models: true do
is_expected
.
not_to
include
(
:read_build
,
:read_pipeline
)
is_expected
.
not_to
include
(
:read_build
,
:read_pipeline
)
end
end
end
end
context
'when builds are disabled'
do
before
do
project
.
project_feature
.
update
(
builds_access_level:
ProjectFeature
::
DISABLED
)
end
it
do
is_expected
.
not_to
include
(
:read_build
)
is_expected
.
to
include
(
:read_pipeline
)
end
end
end
end
context
'reporter'
do
context
'reporter'
do
...
...
spec/serializers/job_entity_spec.rb
View file @
25b99a5b
...
@@ -39,7 +39,7 @@ describe JobEntity do
...
@@ -39,7 +39,7 @@ describe JobEntity do
expect
(
subject
[
:status
]).
to
include
:icon
,
:favicon
,
:text
,
:label
expect
(
subject
[
:status
]).
to
include
:icon
,
:favicon
,
:text
,
:label
end
end
context
'when
build
is retryable'
do
context
'when
job
is retryable'
do
before
do
before
do
job
.
update
(
status: :failed
)
job
.
update
(
status: :failed
)
end
end
...
@@ -49,7 +49,7 @@ describe JobEntity do
...
@@ -49,7 +49,7 @@ describe JobEntity do
end
end
end
end
context
'when
build
is cancelable'
do
context
'when
job
is cancelable'
do
before
do
before
do
job
.
update
(
status: :running
)
job
.
update
(
status: :running
)
end
end
...
...
spec/serializers/pipeline_details_entity_spec.rb
View file @
25b99a5b
...
@@ -91,6 +91,20 @@ describe PipelineDetailsEntity do
...
@@ -91,6 +91,20 @@ describe PipelineDetailsEntity do
end
end
end
end
context
'when pipeline has commit statuses'
do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
)
}
before
do
create
(
:generic_commit_status
,
pipeline:
pipeline
)
end
it
'contains stages'
do
expect
(
subject
).
to
include
(
:details
)
expect
(
subject
[
:details
]).
to
include
(
:stages
)
expect
(
subject
[
:details
][
:stages
].
first
).
to
include
(
name:
'external'
)
end
end
context
'when pipeline has YAML errors'
do
context
'when pipeline has YAML errors'
do
let
(
:pipeline
)
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
config:
{
rspec:
{
invalid: :value
}
})
create
(
:ci_pipeline
,
config:
{
rspec:
{
invalid: :value
}
})
...
...
spec/serializers/stage_entity_spec.rb
View file @
25b99a5b
...
@@ -54,6 +54,17 @@ describe StageEntity do
...
@@ -54,6 +54,17 @@ describe StageEntity do
it
'exposes the group key'
do
it
'exposes the group key'
do
expect
(
subject
).
to
include
:groups
expect
(
subject
).
to
include
:groups
end
end
context
'and contains commit status'
do
before
do
create
(
:generic_commit_status
,
pipeline:
pipeline
,
stage:
'test'
)
end
it
'contains commit status'
do
groups
=
subject
[
:groups
].
map
{
|
group
|
group
[
:name
]
}
expect
(
groups
).
to
include
(
'generic'
)
end
end
end
end
end
end
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