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
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
Show 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
cookies
.
permanent
[
:diff_view
]
=
params
.
delete
(
:view
)
if
params
[
:view
].
present?
end
def
builds_enabled
return
render_404
unless
@project
.
feature_available?
(
:builds
,
current_user
)
end
def
require_pages_enabled!
not_found
unless
Gitlab
.
config
.
pages
.
enabled
end
...
...
app/services/git_push_service.rb
View file @
25b99a5b
...
...
@@ -101,9 +101,10 @@ class GitPushService < BaseService
UpdateMergeRequestsWorker
.
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
)
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_services
(
build_push_data
.
dup
,
:push_hooks
)
...
...
app/services/git_tag_push_service.rb
View file @
25b99a5b
...
...
@@ -9,9 +9,11 @@ class GitTagPushService < BaseService
EventCreateService
.
new
.
push
(
project
,
current_user
,
@push_data
)
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
@push_data
).
execute
(
:push
)
SystemHooksService
.
new
.
execute_hooks
(
build_system_push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_hooks
(
@push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_services
(
@push_data
.
dup
,
:tag_push_hooks
)
ProjectCacheWorker
.
perform_async
(
project
.
id
,
[],
[
:commit_count
,
:repository_size
])
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
module
External
module
Common
def
label
subject
.
description
||
super
subject
.
description
end
def
has_details?
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
25b99a5b
...
...
@@ -5,9 +5,12 @@ describe Projects::PipelinesController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:feature
)
{
ProjectFeature
::
DISABLED
}
before
do
project
.
add_developer
(
user
)
project
.
project_feature
.
update
(
builds_access_level:
feature
)
sign_in
(
user
)
end
...
...
@@ -153,12 +156,22 @@ describe Projects::PipelinesController do
format: :json
end
context
'when builds are enabled'
do
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
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
describe
'POST cancel.json'
do
let!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let!
(
:build
)
{
create
(
:ci_build
,
:running
,
pipeline:
pipeline
)
}
...
...
@@ -170,9 +183,19 @@ describe Projects::PipelinesController do
format: :json
end
context
'when builds are enabled'
do
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
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
spec/features/projects/features_visibility_spec.rb
View file @
25b99a5b
...
...
@@ -68,9 +68,12 @@ describe 'Edit Project Settings', feature: true do
end
describe
'project features visibility pages'
do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let
(
:job
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
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
),
wiki:
namespace_project_wiki_path
(
project
.
namespace
,
project
,
:home
),
snippets:
namespace_project_snippets_path
(
project
.
namespace
,
project
),
...
...
spec/helpers/projects_helper_spec.rb
View file @
25b99a5b
...
...
@@ -300,4 +300,37 @@ describe ProjectsHelper do
expect
(
helper
.
send
(
:visibility_select_options
,
project
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)).
to
include
(
'Private'
)
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
spec/lib/gitlab/ci/status/external/common_spec.rb
View file @
25b99a5b
...
...
@@ -4,9 +4,10 @@ describe Gitlab::Ci::Status::External::Common do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
external_status
.
project
}
let
(
:external_target_url
)
{
'http://example.gitlab.com/status'
}
let
(
:external_description
)
{
'my description'
}
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
subject
do
...
...
@@ -15,6 +16,12 @@ describe Gitlab::Ci::Status::External::Common do
.
extend
(
described_class
)
end
describe
'#label'
do
it
'returns description'
do
expect
(
subject
.
label
).
to
eq
external_description
end
end
describe
'#has_action?'
do
it
{
is_expected
.
not_to
have_action
}
end
...
...
spec/policies/project_policy_spec.rb
View file @
25b99a5b
...
...
@@ -139,6 +139,18 @@ describe ProjectPolicy, models: true do
is_expected
.
not_to
include
(
:read_build
,
:read_pipeline
)
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
context
'reporter'
do
...
...
spec/serializers/job_entity_spec.rb
View file @
25b99a5b
...
...
@@ -39,7 +39,7 @@ describe JobEntity do
expect
(
subject
[
:status
]).
to
include
:icon
,
:favicon
,
:text
,
:label
end
context
'when
build
is retryable'
do
context
'when
job
is retryable'
do
before
do
job
.
update
(
status: :failed
)
end
...
...
@@ -49,7 +49,7 @@ describe JobEntity do
end
end
context
'when
build
is cancelable'
do
context
'when
job
is cancelable'
do
before
do
job
.
update
(
status: :running
)
end
...
...
spec/serializers/pipeline_details_entity_spec.rb
View file @
25b99a5b
...
...
@@ -91,6 +91,20 @@ describe PipelineDetailsEntity do
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
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
config:
{
rspec:
{
invalid: :value
}
})
...
...
spec/serializers/stage_entity_spec.rb
View file @
25b99a5b
...
...
@@ -54,6 +54,17 @@ describe StageEntity do
it
'exposes the group key'
do
expect
(
subject
).
to
include
:groups
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
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