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
c8e28a0b
Commit
c8e28a0b
authored
Jan 27, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
eace733d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
8 deletions
+62
-8
.gitlab/CODEOWNERS
.gitlab/CODEOWNERS
+1
-2
app/assets/stylesheets/framework/blocks.scss
app/assets/stylesheets/framework/blocks.scss
+0
-1
app/models/hooks/web_hook_log.rb
app/models/hooks/web_hook_log.rb
+4
-0
app/services/web_hook_service.rb
app/services/web_hook_service.rb
+3
-1
app/views/projects/hook_logs/_index.html.haml
app/views/projects/hook_logs/_index.html.haml
+1
-1
app/views/shared/hook_logs/_status_label.html.haml
app/views/shared/hook_logs/_status_label.html.haml
+2
-2
changelogs/unreleased/118791-clean-up-spacing-on-recent-deliveries-section-of-project-service-s.yml
...ing-on-recent-deliveries-section-of-project-service-s.yml
+5
-0
doc/ci/parent_child_pipelines.md
doc/ci/parent_child_pipelines.md
+1
-1
lib/api/project_import.rb
lib/api/project_import.rb
+16
-0
spec/models/hooks/web_hook_log_spec.rb
spec/models/hooks/web_hook_log_spec.rb
+16
-0
spec/requests/api/project_import_spec.rb
spec/requests/api/project_import_spec.rb
+13
-0
No files found.
.gitlab/CODEOWNERS
View file @
c8e28a0b
...
@@ -2,9 +2,8 @@
...
@@ -2,9 +2,8 @@
*.rb @gitlab-org/maintainers/rails-backend
*.rb @gitlab-org/maintainers/rails-backend
*.rake @gitlab-org/maintainers/rails-backend
*.rake @gitlab-org/maintainers/rails-backend
# Technical writing team are the default reviewers for
everything in `doc/`
# Technical writing team are the default reviewers for
all markdown docs
*.md @gl-docsteam
*.md @gl-docsteam
doc/ @gl-docsteam
# Frontend maintainers should see everything in `app/assets/`
# Frontend maintainers should see everything in `app/assets/`
app/assets/ @gitlab-org/maintainers/frontend
app/assets/ @gitlab-org/maintainers/frontend
...
...
app/assets/stylesheets/framework/blocks.scss
View file @
c8e28a0b
...
@@ -69,7 +69,6 @@
...
@@ -69,7 +69,6 @@
&
.footer-block
{
&
.footer-block
{
margin-top
:
$gl-padding-24
;
margin-top
:
$gl-padding-24
;
border-bottom
:
0
;
border-bottom
:
0
;
margin-bottom
:
-
$gl-padding
;
}
}
&
.content-component-block
{
&
.content-component-block
{
...
...
app/models/hooks/web_hook_log.rb
View file @
c8e28a0b
...
@@ -23,6 +23,10 @@ class WebHookLog < ApplicationRecord
...
@@ -23,6 +23,10 @@ class WebHookLog < ApplicationRecord
response_status
=~
/^2/
response_status
=~
/^2/
end
end
def
internal_error?
response_status
==
WebHookService
::
InternalErrorResponse
::
ERROR_MESSAGE
end
private
private
def
obfuscate_basic_auth
def
obfuscate_basic_auth
...
...
app/services/web_hook_service.rb
View file @
c8e28a0b
...
@@ -2,12 +2,14 @@
...
@@ -2,12 +2,14 @@
class
WebHookService
class
WebHookService
class
InternalErrorResponse
class
InternalErrorResponse
ERROR_MESSAGE
=
'internal error'
attr_reader
:body
,
:headers
,
:code
attr_reader
:body
,
:headers
,
:code
def
initialize
def
initialize
@headers
=
Gitlab
::
HTTP
::
Response
::
Headers
.
new
({})
@headers
=
Gitlab
::
HTTP
::
Response
::
Headers
.
new
({})
@body
=
''
@body
=
''
@code
=
'internal error'
@code
=
ERROR_MESSAGE
end
end
end
end
...
...
app/views/projects/hook_logs/_index.html.haml
View file @
c8e28a0b
.row.prepend-top-
default
.append-bottom-default
.row.prepend-top-
32
.append-bottom-default
.col-lg-3
.col-lg-3
%h4
.prepend-top-0
%h4
.prepend-top-0
Recent Deliveries
Recent Deliveries
...
...
app/views/shared/hook_logs/_status_label.html.haml
View file @
c8e28a0b
-
label_status
=
hook_log
.
success?
?
'badge-success'
:
'badge-danger'
-
label_status
=
hook_log
.
success?
?
'badge-success'
:
'badge-danger'
%span
{
class:
"
label
#{label_status}"
}
%span
{
class:
"
badge
#{label_status}"
}
=
hook_log
.
response_status
=
hook_log
.
internal_error?
?
_
(
'Error'
)
:
hook_log
.
response_status
changelogs/unreleased/118791-clean-up-spacing-on-recent-deliveries-section-of-project-service-s.yml
0 → 100644
View file @
c8e28a0b
---
title
:
Fix spacing and UI on Recent Deliveries section of Project Services
merge_request
:
22666
author
:
type
:
fixed
doc/ci/parent_child_pipelines.md
View file @
c8e28a0b
...
@@ -4,7 +4,7 @@ type: reference
...
@@ -4,7 +4,7 @@ type: reference
# Parent-child pipelines
# Parent-child pipelines
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/16094) in GitLab
Starter
12.7.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/16094) in GitLab 12.7.
As pipelines grow more complex, a few related problems start to emerge:
As pipelines grow more complex, a few related problems start to emerge:
...
...
lib/api/project_import.rb
View file @
c8e28a0b
...
@@ -18,6 +18,14 @@ module API
...
@@ -18,6 +18,14 @@ module API
def
validate_file!
def
validate_file!
render_api_error!
(
'The file is invalid'
,
400
)
unless
file_is_valid?
render_api_error!
(
'The file is invalid'
,
400
)
unless
file_is_valid?
end
end
def
throttled?
(
key
,
scope
)
rate_limiter
.
throttled?
(
key
,
scope:
scope
)
end
def
rate_limiter
::
Gitlab
::
ApplicationRateLimiter
end
end
end
before
do
before
do
...
@@ -43,6 +51,14 @@ module API
...
@@ -43,6 +51,14 @@ module API
success
Entities
::
ProjectImportStatus
success
Entities
::
ProjectImportStatus
end
end
post
'import'
do
post
'import'
do
key
=
"project_import"
.
to_sym
if
throttled?
(
key
,
[
current_user
,
key
])
rate_limiter
.
log_request
(
request
,
"
#{
key
}
_request_limit"
.
to_sym
,
current_user
)
render_api_error!
({
error:
_
(
'This endpoint has been requested too many times. Try again later.'
)
},
429
)
end
validate_file!
validate_file!
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-foss/issues/42437'
)
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-foss/issues/42437'
)
...
...
spec/models/hooks/web_hook_log_spec.rb
View file @
c8e28a0b
...
@@ -69,4 +69,20 @@ describe WebHookLog do
...
@@ -69,4 +69,20 @@ describe WebHookLog do
it
{
expect
(
web_hook_log
.
success?
).
to
be_falsey
}
it
{
expect
(
web_hook_log
.
success?
).
to
be_falsey
}
end
end
end
end
describe
'#internal_error?'
do
let
(
:web_hook_log
)
{
build_stubbed
(
:web_hook_log
,
response_status:
status
)
}
context
'when response status is not an internal error'
do
let
(
:status
)
{
'200'
}
it
{
expect
(
web_hook_log
.
internal_error?
).
to
be_falsey
}
end
context
'when response status is an internal error'
do
let
(
:status
)
{
'internal error'
}
it
{
expect
(
web_hook_log
.
internal_error?
).
to
be_truthy
}
end
end
end
end
spec/requests/api/project_import_spec.rb
View file @
c8e28a0b
...
@@ -196,6 +196,19 @@ describe API::ProjectImport do
...
@@ -196,6 +196,19 @@ describe API::ProjectImport do
end
end
end
end
context
'when request exceeds the rate limit'
do
before
do
allow
(
::
Gitlab
::
ApplicationRateLimiter
).
to
receive
(
:throttled?
).
and_return
(
true
)
end
it
'prevents users from importing projects'
do
post
api
(
'/projects/import'
,
user
),
params:
{
path:
'test-import'
,
file:
fixture_file_upload
(
file
),
namespace:
namespace
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
429
)
expect
(
json_response
[
'message'
][
'error'
]).
to
eq
(
'This endpoint has been requested too many times. Try again later.'
)
end
end
def
stub_import
(
namespace
)
def
stub_import
(
namespace
)
expect_any_instance_of
(
ProjectImportState
).
to
receive
(
:schedule
)
expect_any_instance_of
(
ProjectImportState
).
to
receive
(
:schedule
)
expect
(
::
Projects
::
CreateService
).
to
receive
(
:new
).
with
(
user
,
hash_including
(
namespace_id:
namespace
.
id
)).
and_call_original
expect
(
::
Projects
::
CreateService
).
to
receive
(
:new
).
with
(
user
,
hash_including
(
namespace_id:
namespace
.
id
)).
and_call_original
...
...
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