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
41cb5582
Commit
41cb5582
authored
Apr 07, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
3d064c73
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
560 additions
and
59 deletions
+560
-59
.gitlab/ci/global.gitlab-ci.yml
.gitlab/ci/global.gitlab-ci.yml
+2
-2
app/models/concerns/spammable.rb
app/models/concerns/spammable.rb
+16
-8
app/views/shared/issuable/form/_branch_chooser.html.haml
app/views/shared/issuable/form/_branch_chooser.html.haml
+1
-1
changelogs/unreleased/213367-snippet-update-error-when-version-feature-flag-disabled.yml
...ippet-update-error-when-version-feature-flag-disabled.yml
+5
-0
changelogs/unreleased/approval-by-me-icon.yml
changelogs/unreleased/approval-by-me-icon.yml
+5
-0
changelogs/unreleased/sh-flatten-sidekiq-exception-logs.yml
changelogs/unreleased/sh-flatten-sidekiq-exception-logs.yml
+5
-0
doc/.vale/gitlab/Spelling.yml
doc/.vale/gitlab/Spelling.yml
+14
-0
doc/.vale/gitlab/spelling-exceptions.txt
doc/.vale/gitlab/spelling-exceptions.txt
+387
-0
doc/ci/caching/index.md
doc/ci/caching/index.md
+24
-0
doc/subscriptions/index.md
doc/subscriptions/index.md
+6
-3
lib/api/internal/base.rb
lib/api/internal/base.rb
+1
-1
lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
...b/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
+1
-1
lib/gitlab/sidekiq_logging/json_formatter.rb
lib/gitlab/sidekiq_logging/json_formatter.rb
+5
-0
lib/gitlab/sidekiq_logging/logs_jobs.rb
lib/gitlab/sidekiq_logging/logs_jobs.rb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+6
-3
qa/qa/page/component/ci_badge_link.rb
qa/qa/page/component/ci_badge_link.rb
+4
-0
qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb
...ine/parent_child_pipelines_dependent_relationship_spec.rb
+2
-2
qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb
...e/parent_child_pipelines_independent_relationship_spec.rb
+2
-2
spec/lib/gitlab/sidekiq_logging/json_formatter_spec.rb
spec/lib/gitlab/sidekiq_logging/json_formatter_spec.rb
+31
-13
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
+0
-19
spec/requests/api/internal/base_spec.rb
spec/requests/api/internal/base_spec.rb
+42
-3
No files found.
.gitlab/ci/global.gitlab-ci.yml
View file @
41cb5582
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
policy
:
pull
policy
:
pull
.use-pg9
:
.use-pg9
:
image
:
"
registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.1
2
-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34"
image
:
"
registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.1
4
-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34"
services
:
services
:
-
name
:
postgres:9.6.17
-
name
:
postgres:9.6.17
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
key
:
"
debian-stretch-ruby-2.6.5-pg11-node-12.x"
key
:
"
debian-stretch-ruby-2.6.5-pg11-node-12.x"
.use-pg9-ee
:
.use-pg9-ee
:
image
:
"
registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.1
2
-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34"
image
:
"
registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.1
4
-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34"
services
:
services
:
-
name
:
postgres:9.6.17
-
name
:
postgres:9.6.17
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
command
:
[
"
postgres"
,
"
-c"
,
"
fsync=off"
,
"
-c"
,
"
synchronous_commit=off"
,
"
-c"
,
"
full_page_writes=off"
]
...
...
app/models/concerns/spammable.rb
View file @
41cb5582
...
@@ -37,15 +37,23 @@ module Spammable
...
@@ -37,15 +37,23 @@ module Spammable
end
end
end
end
def
needs_recaptcha!
self
.
errors
.
add
(
:base
,
"Your
#{
spammable_entity_type
}
has been recognized as spam. "
\
"Please, change the content or solve the reCAPTCHA to proceed."
)
end
def
unrecoverable_spam_error!
self
.
errors
.
add
(
:base
,
"Your
#{
spammable_entity_type
}
has been recognized as spam and has been discarded."
)
end
def
invalidate_if_spam
def
invalidate_if_spam
error_msg
=
if
Gitlab
::
Recaptcha
.
enabled?
return
unless
spam?
"Your
#{
spammable_entity_type
}
has been recognized as spam. "
\
"Please, change the content or solve the reCAPTCHA to proceed."
if
Gitlab
::
Recaptcha
.
enabled?
needs_recaptcha!
else
else
"Your
#{
spammable_entity_type
}
has been recognized as spam and has been discarded."
unrecoverable_spam_error!
end
end
self
.
errors
.
add
(
:base
,
error_msg
)
if
spam?
end
end
def
spammable_entity_type
def
spammable_entity_type
...
...
app/views/shared/issuable/form/_branch_chooser.html.haml
View file @
41cb5582
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
=
_
(
'From <code>%{source_title}</code> into'
).
html_safe
%
{
source_title:
source_title
}
=
_
(
'From <code>%{source_title}</code> into'
).
html_safe
%
{
source_title:
source_title
}
-
if
issuable
.
new_record?
-
if
issuable
.
new_record?
%code
=
target_title
%code
#js-target-branch-title
=
target_title
=
link_to
_
(
'Change branches'
),
mr_change_branches_path
(
issuable
)
=
link_to
_
(
'Change branches'
),
mr_change_branches_path
(
issuable
)
-
elsif
issuable
.
for_fork?
-
elsif
issuable
.
for_fork?
...
...
changelogs/unreleased/213367-snippet-update-error-when-version-feature-flag-disabled.yml
0 → 100644
View file @
41cb5582
---
title
:
Resolve Snippet update error with version flag disabled
merge_request
:
28815
author
:
type
:
fixed
changelogs/unreleased/approval-by-me-icon.yml
0 → 100644
View file @
41cb5582
---
title
:
Use different approval icon if current user approved
merge_request
:
28290
author
:
Steffen Köhler
type
:
changed
changelogs/unreleased/sh-flatten-sidekiq-exception-logs.yml
0 → 100644
View file @
41cb5582
---
title
:
Stringify Sidekiq job args in exception logs
merge_request
:
28996
author
:
type
:
fixed
doc/.vale/gitlab/Spelling.yml
0 → 100644
View file @
41cb5582
# Checks for possible spelling mistakes in content, not code. May find false positives
# due to links using angle brackets: <https://example.com>. These can be ignored.
#
# If a word is flagged as a spelling mistake incorrectly, such as a product name,
# you can submit an MR to update `spelling-exceptions.txt` with the missing word.
# Commands, like `git clone` must use backticks, and must not be added to the
# exceptions.
#
# For a list of all options, see https://errata-ai.github.io/vale/styles/
extends
:
spelling
message
:
'
Spelling
check:
"%s"?'
level
:
warning
ignore
:
-
gitlab/spelling-exceptions.txt
doc/.vale/gitlab/spelling-exceptions.txt
0 → 100644
View file @
41cb5582
Akismet
Alertmanager
Algolia
Ansible
API
approvers
Artifactory
Asana
Asciidoctor
Atlassian
Auth0
Authentiq
autocomplete
autocompleted
autocompletes
autocompleting
autogenerated
autoloaded
autoloader
autoloading
autoscale
autoscaled
autoscaler
autoscales
autoscaling
awardable
Azure
backport
backported
backporting
backports
backtrace
backtraced
backtraces
backtracing
Bamboo
Bitbucket
blockquote
blockquoted
blockquotes
blockquoting
boolean
browsable
Bugzilla
Buildkite
buildpack
buildpacks
bundler
bundlers
burndown
cacheable
CAS
CentOS
Chatops
Citrix
Cloudwatch
Cognito
colocated
colocating
compilable
composable
Conda
Consul
cron
crons
crontab
crontabs
crosslinked
crosslinking
crosslinks
Crossplane
CrowdIn
Debian
deduplicate
deduplicated
deduplicates
deduplicating
deduplication
deprovision
deprovisioned
deprovisioning
deprovisions
discoverability
Disqus
Dockerfile
Dockerfiles
downvoted
downvotes
Dpl
Elasticsearch
enablement
enqueued
expirable
Facebook
failover
failovers
failsafe
favicon
firewalled
Flowdock
Fluentd
Forgerock
Gantt
Gemnasium
Git
Gitaly
Gitea
GitHub
GitLab
gitlabsos
Gitter
Gmail
Google
Gradle
Grafana
gravatar
hardcode
hardcoded
hardcodes
Helm
HipChat
hostname
hostnames
hotfix
hotfixed
hotfixes
hotfixing
http
https
Ingress
initializer
initializers
interdependencies
interdependency
Irker
jasmine-jquery
JavaScript
Jaeger
Jenkins
Jira
jQuery
JupyterHub
kanban
kanbans
Karma
Kerberos
Kibana
Knative
Kramdown
Kubernetes
Laravel
LDAP
Libravatar
Lograge
lookahead
lookaheads
lookbehind
lookbehinds
lookups
Lucene
Maildir
Makefile
Makefiles
Markdown
markdownlint
Mattermost
mbox
mergeable
Microsoft
middleware
middlewares
MinIO
mitmproxy
misconfigure
misconfigured
misconfigures
misconfiguration
misconfigurations
misconfiguring
mitigations
mockup
mockups
nameserver
nameservers
namespace
namespaced
namespaces
Nanoc
NGINX
OAuth
Okta
offboarded
offboarding
offboards
OmniAuth
OpenID
OpenShift
Packagist
parallelization
parallelizations
performant
Piwik
PgBouncer
plaintext
PostgreSQL
preconfigure
preconfigured
preconfigures
prefill
prefilled
prefilling
prefills
prepend
prepended
prepends
Pritaly
profiler
Prometheus
proxied
proxies
proxying
Pseudonymized
Pseudonymizer
Puma
Python
Qualys
Rackspace
Raketask
Raketasks
rebase
rebased
rebases
rebasing
Redis
Redmine
reCAPTCHA
referer
referers
reindex
reindexed
reindexes
reindexing
relicensing
Repmgr
Repmgrd
requeue
requeued
requeues
reusability
resynced
resyncing
resyncs
rollout
rollouts
rsync
rsynced
rsyncing
rsyncs
resync
reverified
reverifies
reverify
runbook
runbooks
runit
runtime
runtimes
Salesforce
SAML
Sendmail
Sentry
serverless
Sidekiq
sharding
Shibboleth
sanitization
serializer
serializers
serializing
Slack
Slony
SMTP
Sourcegraph
Splunk
SSH
storable
strace
subfolder
subfolders
sublicense
sublicensed
sublicenses
sublicensing
subnet
subnets
subnetting
subtree
subtrees
subqueried
subqueries
subquery
subquerying
syslog
Tiller
todos
tokenizer
Tokenizers
tokenizing
toolchain
toolchains
tooltip
tooltips
Trello
triaging
TypeScript
Twitter
Ubuntu
unarchive
unarchived
unarchives
Unassign
Unassigns
uncheck
unchecked
unchecking
unchecks
uncomment
uncommented
unencrypted
Unicorn
unindexed
unlink
unlinking
unlinks
unmergeable
unmerged
unmerges
unmerging
unoptimize
unoptimized
unoptimizes
unoptimizing
unprotect
unprotects
unprotected
unpublish
unpublished
unpublishes
unreferenced
unresolve
unresolved
unresolving
unstage
unstaged
unstages
unstaging
untracked
untrusted
unverified
unverifies
unverify
unverifying
uploader
uploaders
upvoted
upvotes
validator
validators
vendored
virtualized
virtualizing
Vue
Vuex
walkthrough
walkthroughs
WebdriverIO
webpack
webserver
whitepaper
whitepapers
Wireshark
Wordpress
Xcode
Xeon
YouTrack
Zeitwerk
Zendesk
doc/ci/caching/index.md
View file @
41cb5582
...
@@ -329,6 +329,30 @@ rspec:
...
@@ -329,6 +329,30 @@ rspec:
-
rspec spec
-
rspec spec
```
```
### Caching Go dependencies
Assuming your project is using
[
Go Modules
](
https://github.com/golang/go/wiki/Modules
)
to install
Go dependencies, the following example defines
`cache`
in a
`go-cache`
template, that
any job can extend. Go modules are installed in
`${GOPATH}/pkg/mod/`
and
are cached for all of the
`go`
projects:
```
yaml
.go-cache
:
variables
:
GOPATH
:
$CI_PROJECT_DIR/.go
before_script
:
-
mkdir -p .go
cache
:
paths
:
-
.go/pkg/mod/
test
:
image
:
golang:1.13
extends
:
.go-cache
script
:
-
go test ./... -v -short
```
## Availability of the cache
## Availability of the cache
Caching is an optimization, but isn't guaranteed to always work, so you need to
Caching is an optimization, but isn't guaranteed to always work, so you need to
...
...
doc/subscriptions/index.md
View file @
41cb5582
...
@@ -306,9 +306,12 @@ Sg0KU1hNMGExaE9SVGR2V2pKQlBUMWNiaUo5DQo=',
...
@@ -306,9 +306,12 @@ Sg0KU1hNMGExaE9SVGR2V2pKQlBUMWNiaUo5DQo=',
#### Disable Seat Link
#### Disable Seat Link
Seat Link is enabled by default. To disable this feature, go to
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/212375) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.10.
**{admin}**
**Admin Area > Settings > Metrics and profiling**
and
clear the Seat Link checkbox.
Seat Link is enabled by default.
To disable this feature, go to
**{admin}**
**Admin Area > Settings > Metrics and profiling**
and clear the
**Seat Link**
checkbox.
To disable Seat Link in an Omnibus GitLab installation, and prevent it from
To disable Seat Link in an Omnibus GitLab installation, and prevent it from
being configured in the future through the administration panel, set the following in
being configured in the future through the administration panel, set the following in
...
...
lib/api/internal/base.rb
View file @
41cb5582
...
@@ -108,7 +108,7 @@ module API
...
@@ -108,7 +108,7 @@ module API
# check_ip - optional, only in EE version, may limit access to
# check_ip - optional, only in EE version, may limit access to
# group resources based on its IP restrictions
# group resources based on its IP restrictions
post
"/allowed"
do
post
"/allowed"
do
if
repo_type
.
snippet?
&&
Feature
.
disabled?
(
:version_snippets
,
actor
.
user
)
if
repo_type
.
snippet?
&&
params
[
:protocol
]
!=
'web'
&&
Feature
.
disabled?
(
:version_snippets
,
actor
.
user
)
break
response_with_status
(
code:
401
,
success:
false
,
message:
'Snippet git access is disabled.'
)
break
response_with_status
(
code:
401
,
success:
false
,
message:
'Snippet git access is disabled.'
)
end
end
...
...
lib/gitlab/ci/templates/Managed-Cluster-Applications.gitlab-ci.yml
View file @
41cb5582
apply
:
apply
:
stage
:
deploy
stage
:
deploy
image
:
"
registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v0.1
2.0
"
image
:
"
registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v0.1
3.1
"
environment
:
environment
:
name
:
production
name
:
production
variables
:
variables
:
...
...
lib/gitlab/sidekiq_logging/json_formatter.rb
View file @
41cb5582
...
@@ -19,6 +19,7 @@ module Gitlab
...
@@ -19,6 +19,7 @@ module Gitlab
output
[
:message
]
=
data
output
[
:message
]
=
data
when
Hash
when
Hash
convert_to_iso8601!
(
data
)
convert_to_iso8601!
(
data
)
stringify_args!
(
data
)
output
.
merge!
(
data
)
output
.
merge!
(
data
)
end
end
...
@@ -39,6 +40,10 @@ module Gitlab
...
@@ -39,6 +40,10 @@ module Gitlab
Time
.
at
(
timestamp
).
utc
.
iso8601
(
3
)
Time
.
at
(
timestamp
).
utc
.
iso8601
(
3
)
end
end
def
stringify_args!
(
payload
)
payload
[
'args'
]
=
Gitlab
::
Utils
::
LogLimitedArray
.
log_limited_array
(
payload
[
'args'
].
map
(
&
:to_s
))
if
payload
[
'args'
]
end
end
end
end
end
end
end
lib/gitlab/sidekiq_logging/logs_jobs.rb
View file @
41cb5582
...
@@ -7,6 +7,7 @@ module Gitlab
...
@@ -7,6 +7,7 @@ module Gitlab
"
#{
payload
[
'class'
]
}
JID-
#{
payload
[
'jid'
]
}
"
"
#{
payload
[
'class'
]
}
JID-
#{
payload
[
'jid'
]
}
"
end
end
# NOTE: Arguments are truncated/stringified in sidekiq_logging/json_formatter.rb
def
parse_job
(
job
)
def
parse_job
(
job
)
# Error information from the previous try is in the payload for
# Error information from the previous try is in the payload for
# displaying in the Sidekiq UI, but is very confusing in logs!
# displaying in the Sidekiq UI, but is very confusing in logs!
...
@@ -16,7 +17,6 @@ module Gitlab
...
@@ -16,7 +17,6 @@ module Gitlab
job
[
'pid'
]
=
::
Process
.
pid
job
[
'pid'
]
=
::
Process
.
pid
job
.
delete
(
'args'
)
unless
ENV
[
'SIDEKIQ_LOG_ARGUMENTS'
]
job
.
delete
(
'args'
)
unless
ENV
[
'SIDEKIQ_LOG_ARGUMENTS'
]
job
[
'args'
]
=
Gitlab
::
Utils
::
LogLimitedArray
.
log_limited_array
(
job
[
'args'
].
map
(
&
:to_s
))
if
job
[
'args'
]
job
job
end
end
...
...
locale/gitlab.pot
View file @
41cb5582
...
@@ -380,9 +380,6 @@ msgstr ""
...
@@ -380,9 +380,6 @@ msgstr ""
msgid "%{name}'s avatar"
msgid "%{name}'s avatar"
msgstr ""
msgstr ""
msgid "%{numberOfDays} days"
msgstr ""
msgid "%{number_commits_behind} commits behind %{default_branch}, %{number_commits_ahead} commits ahead"
msgid "%{number_commits_behind} commits behind %{default_branch}, %{number_commits_ahead} commits ahead"
msgstr ""
msgstr ""
...
@@ -2266,6 +2263,9 @@ msgstr ""
...
@@ -2266,6 +2263,9 @@ msgstr ""
msgid "Approvals"
msgid "Approvals"
msgstr ""
msgstr ""
msgid "Approvals (you've approved)"
msgstr ""
msgid "Approve"
msgid "Approve"
msgstr ""
msgstr ""
...
@@ -10082,6 +10082,9 @@ msgstr ""
...
@@ -10082,6 +10082,9 @@ msgstr ""
msgid "Group: %{name}"
msgid "Group: %{name}"
msgstr ""
msgstr ""
msgid "GroupActivityMetrics|New Members created"
msgstr ""
msgid "GroupActivyMetrics|Issues created"
msgid "GroupActivyMetrics|Issues created"
msgstr ""
msgstr ""
...
...
qa/qa/page/component/ci_badge_link.rb
View file @
41cb5582
...
@@ -13,6 +13,10 @@ module QA
...
@@ -13,6 +13,10 @@ module QA
timeout
?
completed?
(
timeout:
timeout
)
:
completed?
timeout
?
completed?
(
timeout:
timeout
)
:
completed?
status_badge
==
status
status_badge
==
status
end
end
# has_passed? => passed?
# has_failed? => failed?
alias_method
:"has_
#{
status
}
?"
,
:"
#{
status
}
?"
end
end
# e.g. def pending?; status_badge == 'pending'; end
# e.g. def pending?; status_badge == 'pending'; end
...
...
qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb
View file @
41cb5582
...
@@ -32,7 +32,7 @@ module QA
...
@@ -32,7 +32,7 @@ module QA
parent_pipeline
.
click_linked_job
(
project
.
name
)
parent_pipeline
.
click_linked_job
(
project
.
name
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
b
e_passed
expect
(
parent_pipeline
).
to
hav
e_passed
end
end
end
end
...
@@ -44,7 +44,7 @@ module QA
...
@@ -44,7 +44,7 @@ module QA
parent_pipeline
.
click_linked_job
(
project
.
name
)
parent_pipeline
.
click_linked_job
(
project
.
name
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
b
e_failed
expect
(
parent_pipeline
).
to
hav
e_failed
end
end
end
end
...
...
qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb
View file @
41cb5582
...
@@ -32,7 +32,7 @@ module QA
...
@@ -32,7 +32,7 @@ module QA
parent_pipeline
.
click_linked_job
(
project
.
name
)
parent_pipeline
.
click_linked_job
(
project
.
name
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
b
e_passed
expect
(
parent_pipeline
).
to
hav
e_passed
end
end
end
end
...
@@ -44,7 +44,7 @@ module QA
...
@@ -44,7 +44,7 @@ module QA
parent_pipeline
.
click_linked_job
(
project
.
name
)
parent_pipeline
.
click_linked_job
(
project
.
name
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
have_job
(
"child_job"
)
expect
(
parent_pipeline
).
to
b
e_passed
expect
(
parent_pipeline
).
to
hav
e_passed
end
end
end
end
...
...
spec/lib/gitlab/sidekiq_logging/json_formatter_spec.rb
View file @
41cb5582
...
@@ -9,6 +9,8 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
...
@@ -9,6 +9,8 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
let
(
:timestamp_iso8601
)
{
now
.
iso8601
(
3
)
}
let
(
:timestamp_iso8601
)
{
now
.
iso8601
(
3
)
}
describe
'with a Hash'
do
describe
'with a Hash'
do
subject
{
JSON
.
parse
(
described_class
.
new
.
call
(
'INFO'
,
now
,
'my program'
,
hash_input
))
}
let
(
:hash_input
)
do
let
(
:hash_input
)
do
{
{
foo:
1
,
foo:
1
,
...
@@ -23,9 +25,6 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
...
@@ -23,9 +25,6 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
end
end
it
'properly formats timestamps into ISO 8601 form'
do
it
'properly formats timestamps into ISO 8601 form'
do
result
=
subject
.
call
(
'INFO'
,
now
,
'my program'
,
hash_input
)
data
=
JSON
.
parse
(
result
)
expected_output
=
hash_input
.
stringify_keys
.
merge!
(
expected_output
=
hash_input
.
stringify_keys
.
merge!
(
{
{
'severity'
=>
'INFO'
,
'severity'
=>
'INFO'
,
...
@@ -39,11 +38,29 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
...
@@ -39,11 +38,29 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
}
}
)
)
expect
(
data
).
to
eq
(
expected_output
)
expect
(
subject
).
to
eq
(
expected_output
)
end
context
'when the job args are bigger than the maximum allowed'
do
it
'keeps args from the front until they exceed the limit'
do
half_limit
=
Gitlab
::
Utils
::
LogLimitedArray
::
MAXIMUM_ARRAY_LENGTH
/
2
hash_input
[
'args'
]
=
[
1
,
2
,
'a'
*
half_limit
,
'b'
*
half_limit
,
3
]
expected_args
=
hash_input
[
'args'
].
take
(
3
).
map
(
&
:to_s
)
+
[
'...'
]
expect
(
subject
[
'args'
]).
to
eq
(
expected_args
)
end
end
it
'properly flattens arguments to a String'
do
hash_input
[
'args'
]
=
[
1
,
"test"
,
2
,
{
'test'
=>
1
}]
expect
(
subject
[
'args'
]).
to
eq
([
"1"
,
"test"
,
"2"
,
%({"test"=>1})
])
end
end
end
end
it
'wraps a String'
do
describe
'with a String'
do
it
'accepts strings with no changes'
do
result
=
subject
.
call
(
'DEBUG'
,
now
,
'my string'
,
message
)
result
=
subject
.
call
(
'DEBUG'
,
now
,
'my string'
,
message
)
data
=
JSON
.
parse
(
result
)
data
=
JSON
.
parse
(
result
)
...
@@ -55,4 +72,5 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
...
@@ -55,4 +72,5 @@ describe Gitlab::SidekiqLogging::JSONFormatter do
expect
(
data
).
to
eq
(
expected_output
.
stringify_keys
)
expect
(
data
).
to
eq
(
expected_output
.
stringify_keys
)
end
end
end
end
end
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
View file @
41cb5582
...
@@ -30,7 +30,6 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
...
@@ -30,7 +30,6 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
let
(
:clock_thread_cputime_end
)
{
1.333333799
}
let
(
:clock_thread_cputime_end
)
{
1.333333799
}
let
(
:start_payload
)
do
let
(
:start_payload
)
do
job
.
except
(
'error_backtrace'
,
'error_class'
,
'error_message'
).
merge
(
job
.
except
(
'error_backtrace'
,
'error_class'
,
'error_message'
).
merge
(
'args'
=>
%w(1234 hello {"key"=>"value"})
,
'message'
=>
'TestWorker JID-da883554ee4fe414012f5f42: start'
,
'message'
=>
'TestWorker JID-da883554ee4fe414012f5f42: start'
,
'job_status'
=>
'start'
,
'job_status'
=>
'start'
,
'pid'
=>
Process
.
pid
,
'pid'
=>
Process
.
pid
,
...
@@ -113,24 +112,6 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
...
@@ -113,24 +112,6 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
end
end
end
end
end
end
context
'when the job args are bigger than the maximum allowed'
do
it
'keeps args from the front until they exceed the limit'
do
Timecop
.
freeze
(
timestamp
)
do
half_limit
=
Gitlab
::
Utils
::
LogLimitedArray
::
MAXIMUM_ARRAY_LENGTH
/
2
job
[
'args'
]
=
[
1
,
2
,
'a'
*
half_limit
,
'b'
*
half_limit
,
3
]
expected_args
=
job
[
'args'
].
take
(
3
).
map
(
&
:to_s
)
+
[
'...'
]
expect
(
logger
).
to
receive
(
:info
).
with
(
start_payload
.
merge
(
'args'
=>
expected_args
)).
ordered
expect
(
logger
).
to
receive
(
:info
).
with
(
end_payload
.
merge
(
'args'
=>
expected_args
)).
ordered
expect
(
subject
).
to
receive
(
:log_job_start
).
and_call_original
expect
(
subject
).
to
receive
(
:log_job_done
).
and_call_original
subject
.
call
(
job
,
'test_queue'
)
{
}
end
end
end
end
end
context
'with SIDEKIQ_LOG_ARGUMENTS disabled'
do
context
'with SIDEKIQ_LOG_ARGUMENTS disabled'
do
...
...
spec/requests/api/internal/base_spec.rb
View file @
41cb5582
...
@@ -335,6 +335,27 @@ describe API::Internal::Base do
...
@@ -335,6 +335,27 @@ describe API::Internal::Base do
end
end
end
end
shared_examples
'snippet success'
do
it
'responds with success'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'status'
]).
to
be_truthy
end
end
shared_examples
'snippets with web protocol'
do
it_behaves_like
'snippet success'
context
'with disabled version flag'
do
before
do
stub_feature_flags
(
version_snippets:
false
)
end
it_behaves_like
'snippet success'
end
end
context
'git push with personal snippet'
do
context
'git push with personal snippet'
do
subject
{
push
(
key
,
personal_snippet
,
env:
env
.
to_json
,
changes:
snippet_changes
)
}
subject
{
push
(
key
,
personal_snippet
,
env:
env
.
to_json
,
changes:
snippet_changes
)
}
...
@@ -349,14 +370,21 @@ describe API::Internal::Base do
...
@@ -349,14 +370,21 @@ describe API::Internal::Base do
end
end
it_behaves_like
'snippets with disabled feature flag'
it_behaves_like
'snippets with disabled feature flag'
it_behaves_like
'snippets with web protocol'
do
subject
{
push
(
key
,
personal_snippet
,
'web'
,
env:
env
.
to_json
,
changes:
snippet_changes
)
}
end
it_behaves_like
'sets hook env'
do
it_behaves_like
'sets hook env'
do
let
(
:gl_repository
)
{
Gitlab
::
GlRepository
::
SNIPPET
.
identifier_for_container
(
personal_snippet
)
}
let
(
:gl_repository
)
{
Gitlab
::
GlRepository
::
SNIPPET
.
identifier_for_container
(
personal_snippet
)
}
end
end
end
end
context
'git pull with personal snippet'
do
context
'git pull with personal snippet'
do
subject
{
pull
(
key
,
personal_snippet
)
}
it
'responds with success'
do
it
'responds with success'
do
pull
(
key
,
personal_snippet
)
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
"status"
]).
to
be_truthy
expect
(
json_response
[
"status"
]).
to
be_truthy
...
@@ -365,8 +393,10 @@ describe API::Internal::Base do
...
@@ -365,8 +393,10 @@ describe API::Internal::Base do
expect
(
user
.
reload
.
last_activity_on
).
to
eql
(
Date
.
today
)
expect
(
user
.
reload
.
last_activity_on
).
to
eql
(
Date
.
today
)
end
end
it_behaves_like
'snippets with disabled feature flag'
do
it_behaves_like
'snippets with disabled feature flag'
subject
{
pull
(
key
,
personal_snippet
)
}
it_behaves_like
'snippets with web protocol'
do
subject
{
pull
(
key
,
personal_snippet
,
'web'
)
}
end
end
end
end
...
@@ -384,6 +414,11 @@ describe API::Internal::Base do
...
@@ -384,6 +414,11 @@ describe API::Internal::Base do
end
end
it_behaves_like
'snippets with disabled feature flag'
it_behaves_like
'snippets with disabled feature flag'
it_behaves_like
'snippets with web protocol'
do
subject
{
push
(
key
,
project_snippet
,
'web'
,
env:
env
.
to_json
,
changes:
snippet_changes
)
}
end
it_behaves_like
'sets hook env'
do
it_behaves_like
'sets hook env'
do
let
(
:gl_repository
)
{
Gitlab
::
GlRepository
::
SNIPPET
.
identifier_for_container
(
project_snippet
)
}
let
(
:gl_repository
)
{
Gitlab
::
GlRepository
::
SNIPPET
.
identifier_for_container
(
project_snippet
)
}
end
end
...
@@ -403,6 +438,10 @@ describe API::Internal::Base do
...
@@ -403,6 +438,10 @@ describe API::Internal::Base do
it_behaves_like
'snippets with disabled feature flag'
do
it_behaves_like
'snippets with disabled feature flag'
do
subject
{
pull
(
key
,
project_snippet
)
}
subject
{
pull
(
key
,
project_snippet
)
}
end
end
it_behaves_like
'snippets with web protocol'
do
subject
{
pull
(
key
,
project_snippet
,
'web'
)
}
end
end
end
context
"git pull"
do
context
"git pull"
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