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
6f2a4269
Commit
6f2a4269
authored
Feb 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Style/MultilineHashBraceLayout
parent
0f8c99d7
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
98 additions
and
103 deletions
+98
-103
.rubocop.yml
.rubocop.yml
+1
-1
app/controllers/jwt_controller.rb
app/controllers/jwt_controller.rb
+4
-2
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+2
-1
app/models/project_services/chat_message/issue_message.rb
app/models/project_services/chat_message/issue_message.rb
+2
-1
app/models/project_services/irker_service.rb
app/models/project_services/irker_service.rb
+2
-1
app/models/project_services/kubernetes_service.rb
app/models/project_services/kubernetes_service.rb
+4
-8
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+2
-4
lib/gitlab/ci/config/entry/environment.rb
lib/gitlab/ci/config/entry/environment.rb
+4
-2
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+2
-1
spec/lib/expand_variables_spec.rb
spec/lib/expand_variables_spec.rb
+9
-18
spec/lib/gitlab/template/issue_template_spec.rb
spec/lib/gitlab/template/issue_template_spec.rb
+2
-1
spec/lib/gitlab/template/merge_request_template_spec.rb
spec/lib/gitlab/template/merge_request_template_spec.rb
+2
-1
spec/lib/mattermost/command_spec.rb
spec/lib/mattermost/command_spec.rb
+3
-3
spec/lib/mattermost/team_spec.rb
spec/lib/mattermost/team_spec.rb
+13
-12
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+2
-1
spec/models/project_services/drone_ci_service_spec.rb
spec/models/project_services/drone_ci_service_spec.rb
+3
-3
spec/models/project_services/mattermost_slash_commands_service_spec.rb
...roject_services/mattermost_slash_commands_service_spec.rb
+2
-1
spec/requests/lfs_http_spec.rb
spec/requests/lfs_http_spec.rb
+25
-32
spec/services/create_deployment_service_spec.rb
spec/services/create_deployment_service_spec.rb
+7
-4
spec/support/kubernetes_helpers.rb
spec/support/kubernetes_helpers.rb
+7
-6
No files found.
.rubocop.yml
View file @
6f2a4269
...
...
@@ -277,7 +277,7 @@ Style/MultilineBlockLayout:
# Checks that the closing brace in a hash literal is either on the same line as
# the last hash element, or a new line.
Style/MultilineHashBraceLayout
:
Enabled
:
fals
e
Enabled
:
tru
e
EnforcedStyle
:
symmetrical
# Do not use then for multi-line if/unless.
...
...
app/controllers/jwt_controller.rb
View file @
6f2a4269
...
...
@@ -39,7 +39,8 @@ class JwtController < ApplicationController
message:
"HTTP Basic: Access denied
\n
"
\
"You have 2FA enabled, please use a personal access token for Git over HTTP.
\n
"
\
"You can generate one at
#{
profile_personal_access_tokens_url
}
"
}
]
},
status:
401
]
},
status:
401
end
def
render_unauthorized
...
...
@@ -47,7 +48,8 @@ class JwtController < ApplicationController
errors:
[
{
code:
'UNAUTHORIZED'
,
message:
'HTTP Basic: Access denied'
}
]
},
status:
401
]
},
status:
401
end
def
auth_params
...
...
app/controllers/snippets_controller.rb
View file @
6f2a4269
...
...
@@ -28,7 +28,8 @@ class SnippetsController < ApplicationController
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
{
filter: :by_user
,
user:
@user
,
scope:
params
[
:scope
]
})
scope:
params
[
:scope
]
})
.
page
(
params
[
:page
])
render
'index'
...
...
app/models/project_services/chat_message/issue_message.rb
View file @
6f2a4269
...
...
@@ -51,7 +51,8 @@ module ChatMessage
title:
issue_title
,
title_link:
issue_url
,
text:
format
(
description
),
color:
"#C95823"
}]
color:
"#C95823"
}]
end
def
project_link
...
...
app/models/project_services/irker_service.rb
View file @
6f2a4269
...
...
@@ -33,7 +33,8 @@ class IrkerService < Service
end
def
settings
{
server_host:
server_host
.
present?
?
server_host
:
'localhost'
,
{
server_host:
server_host
.
present?
?
server_host
:
'localhost'
,
server_port:
server_port
.
present?
?
server_port
:
6659
}
end
...
...
app/models/project_services/kubernetes_service.rb
View file @
6f2a4269
...
...
@@ -62,23 +62,19 @@ class KubernetesService < DeploymentService
{
type:
'text'
,
name:
'namespace'
,
title:
'Kubernetes namespace'
,
placeholder:
'Kubernetes namespace'
,
},
placeholder:
'Kubernetes namespace'
},
{
type:
'text'
,
name:
'api_url'
,
title:
'API URL'
,
placeholder:
'Kubernetes API URL, like https://kube.example.com/'
,
},
placeholder:
'Kubernetes API URL, like https://kube.example.com/'
},
{
type:
'text'
,
name:
'token'
,
title:
'Service token'
,
placeholder:
'Service token'
,
},
placeholder:
'Service token'
},
{
type:
'textarea'
,
name:
'ca_pem'
,
title:
'Custom CA bundle'
,
placeholder:
'Certificate Authority bundle (PEM format)'
,
},
placeholder:
'Certificate Authority bundle (PEM format)'
},
]
end
...
...
app/models/project_services/pushover_service.rb
View file @
6f2a4269
...
...
@@ -29,8 +29,7 @@ class PushoverService < Service
[
'Normal Priority'
,
0
],
[
'High Priority'
,
1
]
],
default_choice:
0
},
default_choice:
0
},
{
type:
'select'
,
name:
'sound'
,
choices:
[
[
'Device default sound'
,
nil
],
...
...
@@ -56,8 +55,7 @@ class PushoverService < Service
[
'Pushover Echo (long)'
,
'echo'
],
[
'Up Down (long)'
,
'updown'
],
[
'None (silent)'
,
'none'
]
]
},
]},
]
end
...
...
lib/gitlab/ci/config/entry/environment.rb
View file @
6f2a4269
...
...
@@ -21,12 +21,14 @@ module Gitlab
validates
:name
,
type:
{
with:
String
,
message:
Gitlab
::
Regex
.
environment_name_regex_message
}
message:
Gitlab
::
Regex
.
environment_name_regex_message
}
validates
:name
,
format:
{
with:
Gitlab
::
Regex
.
environment_name_regex
,
message:
Gitlab
::
Regex
.
environment_name_regex_message
}
message:
Gitlab
::
Regex
.
environment_name_regex_message
}
with_options
if: :hash?
do
validates
:config
,
allowed_keys:
ALLOWED_KEYS
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
6f2a4269
...
...
@@ -54,7 +54,8 @@ describe Projects::MergeRequestsController do
project_id:
fork_project
.
to_param
,
merge_request:
{
source_branch:
'remove-submodule'
,
target_branch:
'master'
},
target_branch:
'master'
},
format:
format
end
end
...
...
spec/lib/expand_variables_spec.rb
View file @
6f2a4269
...
...
@@ -7,58 +7,49 @@ describe ExpandVariables do
tests
=
[
{
value:
'key'
,
result:
'key'
,
variables:
[]
},
variables:
[]
},
{
value:
'key$variable'
,
result:
'key'
,
variables:
[]
},
variables:
[]
},
{
value:
'key$variable'
,
result:
'keyvalue'
,
variables:
[
{
key:
'variable'
,
value:
'value'
}
]
},
]},
{
value:
'key${variable}'
,
result:
'keyvalue'
,
variables:
[
{
key:
'variable'
,
value:
'value'
}
]
},
]},
{
value:
'key$variable$variable2'
,
result:
'keyvalueresult'
,
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
},
]
},
]},
{
value:
'key${variable}${variable2}'
,
result:
'keyvalueresult'
,
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
}
]
},
]},
{
value:
'key$variable2$variable'
,
result:
'keyresultvalue'
,
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
},
]
},
]},
{
value:
'key${variable2}${variable}'
,
result:
'keyresultvalue'
,
variables:
[
{
key:
'variable'
,
value:
'value'
},
{
key:
'variable2'
,
value:
'result'
}
]
},
]},
{
value:
'review/$CI_BUILD_REF_NAME'
,
result:
'review/feature/add-review-apps'
,
variables:
[
{
key:
'CI_BUILD_REF_NAME'
,
value:
'feature/add-review-apps'
}
]
},
]},
]
tests
.
each
do
|
test
|
...
...
spec/lib/gitlab/template/issue_template_spec.rb
View file @
6f2a4269
...
...
@@ -11,7 +11,8 @@ describe Gitlab::Template::IssueTemplate do
create_template:
{
user:
user
,
access:
Gitlab
::
Access
::
MASTER
,
path:
'issue_templates'
})
path:
'issue_templates'
})
end
describe
'.all'
do
...
...
spec/lib/gitlab/template/merge_request_template_spec.rb
View file @
6f2a4269
...
...
@@ -11,7 +11,8 @@ describe Gitlab::Template::MergeRequestTemplate do
create_template:
{
user:
user
,
access:
Gitlab
::
Access
::
MASTER
,
path:
'merge_request_templates'
})
path:
'merge_request_templates'
})
end
describe
'.all'
do
...
...
spec/lib/mattermost/command_spec.rb
View file @
6f2a4269
...
...
@@ -13,8 +13,7 @@ describe Mattermost::Command do
describe
'#create'
do
let
(
:params
)
do
{
team_id:
'abc'
,
trigger:
'gitlab'
}
trigger:
'gitlab'
}
end
subject
{
described_class
.
new
(
nil
).
create
(
params
)
}
...
...
@@ -24,7 +23,8 @@ describe Mattermost::Command do
stub_request
(
:post
,
'http://mattermost.example.com/api/v3/teams/abc/commands/create'
)
.
with
(
body:
{
team_id:
'abc'
,
trigger:
'gitlab'
}.
to_json
)
trigger:
'gitlab'
}.
to_json
)
.
to_return
(
status:
200
,
headers:
{
'Content-Type'
=>
'application/json'
},
...
...
spec/lib/mattermost/team_spec.rb
View file @
6f2a4269
...
...
@@ -25,7 +25,8 @@ describe Mattermost::Team do
"company_name"
=>
""
,
"allowed_domains"
=>
""
,
"invite_id"
=>
"o4utakb9jtb7imctdfzbf9r5ro"
,
"allow_open_invite"
=>
false
}]
"allow_open_invite"
=>
false
}]
end
before
do
...
...
spec/models/environment_spec.rb
View file @
6f2a4269
...
...
@@ -76,7 +76,8 @@ describe Environment, models: true do
end
describe
'#update_merge_request_metrics?'
do
{
'production'
=>
true
,
{
'production'
=>
true
,
'production/eu'
=>
true
,
'production/www.gitlab.com'
=>
true
,
'productioneu'
=>
false
,
...
...
spec/models/project_services/drone_ci_service_spec.rb
View file @
6f2a4269
...
...
@@ -95,12 +95,12 @@ describe DroneCiService, models: true, caching: true do
is_expected
.
to
eq
(
:error
)
end
{
"killed"
=>
:canceled
,
{
"killed"
=>
:canceled
,
"failure"
=>
:failed
,
"error"
=>
:failed
,
"success"
=>
"success"
,
"success"
=>
"success"
}.
each
do
|
drone_status
,
our_status
|
it
"sets commit status to
#{
our_status
.
inspect
}
when returned status is
#{
drone_status
.
inspect
}
"
do
stub_request
(
body:
%({"status":"#{drone_status}"})
)
...
...
spec/models/project_services/mattermost_slash_commands_service_spec.rb
View file @
6f2a4269
...
...
@@ -36,7 +36,8 @@ describe MattermostSlashCommandsService, :models do
description:
"Perform common operations on:
#{
project
.
name_with_namespace
}
"
,
display_name:
"GitLab /
#{
project
.
name_with_namespace
}
"
,
method:
'P'
,
username:
'GitLab'
}.
to_json
)
username:
'GitLab'
}.
to_json
)
.
to_return
(
status:
200
,
headers:
{
'Content-Type'
=>
'application/json'
},
...
...
spec/requests/lfs_http_spec.rb
View file @
6f2a4269
...
...
@@ -25,11 +25,9 @@ describe 'Git LFS API and storage' do
{
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
},
'size'
=>
1575078
},
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
],
'operation'
=>
'upload'
}
...
...
@@ -53,11 +51,9 @@ describe 'Git LFS API and storage' do
{
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
},
'size'
=>
1575078
},
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
],
'operation'
=>
'upload'
}
...
...
@@ -378,8 +374,7 @@ describe 'Git LFS API and storage' do
'operation'
=>
'download'
,
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
]
}
end
...
...
@@ -397,7 +392,8 @@ describe 'Git LFS API and storage' do
it
'with href to download'
do
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
sample_oid
,
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'actions'
=>
{
'download'
=>
{
...
...
@@ -424,7 +420,8 @@ describe 'Git LFS API and storage' do
it
'with href to download'
do
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
sample_oid
,
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'error'
=>
{
'code'
=>
404
,
...
...
@@ -442,8 +439,7 @@ describe 'Git LFS API and storage' do
'operation'
=>
'download'
,
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
}
'size'
=>
1575078
}
]
}
end
...
...
@@ -455,7 +451,8 @@ describe 'Git LFS API and storage' do
it
'with an 404 for specific object'
do
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
,
'error'
=>
{
'code'
=>
404
,
...
...
@@ -469,14 +466,13 @@ describe 'Git LFS API and storage' do
context
'when downloading one new and one existing lfs object'
do
let
(
:body
)
do
{
'operation'
=>
'download'
,
{
'operation'
=>
'download'
,
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
},
'size'
=>
1575078
},
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
]
}
end
...
...
@@ -617,7 +613,8 @@ describe 'Git LFS API and storage' do
it
'responds with status 200 and href to download'
do
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
sample_oid
,
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'authenticated'
=>
true
,
'actions'
=>
{
...
...
@@ -651,8 +648,7 @@ describe 'Git LFS API and storage' do
'operation'
=>
'upload'
,
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
]
}
end
...
...
@@ -695,8 +691,7 @@ describe 'Git LFS API and storage' do
'operation'
=>
'upload'
,
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
]
}
end
...
...
@@ -749,14 +744,13 @@ describe 'Git LFS API and storage' do
context
'when pushing one new and one existing lfs object'
do
let
(
:body
)
do
{
'operation'
=>
'upload'
,
{
'operation'
=>
'upload'
,
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
},
'size'
=>
1575078
},
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
]
}
end
...
...
@@ -854,8 +848,7 @@ describe 'Git LFS API and storage' do
'operation'
=>
'other'
,
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}
'size'
=>
sample_size
}
]
}
end
...
...
spec/services/create_deployment_service_spec.rb
View file @
6f2a4269
...
...
@@ -9,7 +9,8 @@ describe CreateDeploymentService, services: true do
describe
'#execute'
do
let
(
:options
)
{
nil
}
let
(
:params
)
do
{
environment:
'production'
,
{
environment:
'production'
,
ref:
'master'
,
tag:
false
,
sha:
'97de212e80737a608d939f648d959671fb0a0142'
,
...
...
@@ -83,10 +84,11 @@ describe CreateDeploymentService, services: true do
context
'for environment with invalid name'
do
let
(
:params
)
do
{
environment:
'name,with,commas'
,
{
environment:
'name,with,commas'
,
ref:
'master'
,
tag:
false
,
sha:
'97de212e80737a608d939f648d959671fb0a0142'
,
sha:
'97de212e80737a608d939f648d959671fb0a0142'
}
end
...
...
@@ -101,7 +103,8 @@ describe CreateDeploymentService, services: true do
context
'when variables are used'
do
let
(
:params
)
do
{
environment:
'review-apps/$CI_BUILD_REF_NAME'
,
{
environment:
'review-apps/$CI_BUILD_REF_NAME'
,
ref:
'master'
,
tag:
false
,
sha:
'97de212e80737a608d939f648d959671fb0a0142'
,
...
...
spec/support/kubernetes_helpers.rb
View file @
6f2a4269
...
...
@@ -2,23 +2,24 @@ module KubernetesHelpers
include
Gitlab
::
Kubernetes
def
kube_discovery_body
{
"kind"
=>
"APIResourceList"
,
{
"kind"
=>
"APIResourceList"
,
"resources"
=>
[
{
"name"
=>
"pods"
,
"namespaced"
=>
true
,
"kind"
=>
"Pod"
},
]
,
]
}
end
def
kube_pods_body
(
*
pods
)
{
"kind"
=>
"PodList"
,
"items"
=>
[
kube_pod
],
}
"items"
=>
[
kube_pod
]
}
end
# This is a partial response, it will have many more elements in reality but
# these are the ones we care about at the moment
def
kube_pod
(
app:
"valid-pod-label"
)
{
"metadata"
=>
{
{
"metadata"
=>
{
"name"
=>
"kube-pod"
,
"creationTimestamp"
=>
"2016-11-25T19:55:19Z"
,
"labels"
=>
{
"app"
=>
app
},
...
...
@@ -29,7 +30,7 @@ module KubernetesHelpers
{
"name"
=>
"container-1"
},
],
},
"status"
=>
{
"phase"
=>
"Running"
}
,
"status"
=>
{
"phase"
=>
"Running"
}
}
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