Commit Graph

16644 Commits

Author SHA1 Message Date
Stan Hu 0a94aac8a2 Merge branch 'jc-add-ff-for-all-lfs-pointers-go' into 'master'
Adding gitaly feature flag for go implementation of get all lfs pointers

See merge request gitlab-org/gitlab-ce!31696
2019-08-23 19:52:48 +00:00
John Cai 15227e633f Adding gitaly feature flag for go implementation of get all lfs pointers 2019-08-23 11:22:29 -07:00
Patrick Derichs f1e24d4d31 Add label_id parameter to label API for PUT and DELETE
Add specs for new parameter and updated documentation as well.
2019-08-23 17:45:42 +00:00
Lin Jen-Shin e84922906e Merge branch 'jc-fix-auto-rugged-detection' into 'master'
Handle when server info doesn't have the storage in question

See merge request gitlab-org/gitlab-ce!32023
2019-08-23 17:42:40 +00:00
Kamil Trzciński 99e8b77e5e Merge branch 'sh-eliminate-gitaly-nplus-one-notes' into 'master'
Eliminate Gitaly N+1 queries with notes API

See merge request gitlab-org/gitlab-ce!32089
2019-08-23 17:21:19 +00:00
John Cai ebbd2aeb5f Handle when server info doesn't have the storage in question 2019-08-23 08:42:00 -07:00
Jan Provaznik 2abeb0c358 Merge branch '57402-upate-issues-list-sort-options-ce' into 'master'
CE: Update sort options for issues list

See merge request gitlab-org/gitlab-ce!31849
2019-08-23 14:06:40 +00:00
Nick Thomas fd577b864f Merge branch 'frozen_string_lib_2' into 'master'
Add frozen_string_literal to lib part 2

See merge request gitlab-org/gitlab-ce!32094
2019-08-23 10:26:12 +00:00
Jan Provaznik 41d52bbfe9 Add direct upload support for personal snippets 2019-08-23 11:19:14 +02:00
Jan Provaznik a98b89e9bc Re-escape whole HTML content instead of only match
When we un-escape HTML text to find references in it, we should then
re-escape the whole text again, not only found matches.

Because we replace matches with milestone/label links (which contain
HTML tags we don't want to escape again), we re-escape HTML text
with placeholders instead of these links and then replace placeholders
in the escaped text.
2019-08-23 10:36:51 +02:00
Alexandru Croitor f5b855546e Update sort options for issues list
Increase sort options for issues list from updated_at and create_at,
to include more options close to what is required in actual issue list
UI.

This helps us to use REST API for issues list with sorting capabilities

https://gitlab.com/gitlab-org/gitlab-ce/issues/57402
2019-08-23 11:32:15 +03:00
Marius Bobin d51365efe7 Exempt `jwt/auth` for user `gitlab-ci-token` from rate limiting 2019-08-23 08:05:48 +00:00
Stan Hu e24b9c2502 Eliminate Gitaly N+1 queries with notes API
Similar to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31834,
we see that in https://gitlab.com/gitlab-org/gitlab-ce/issues/65957
there can be hundreds, even thousands, of Gitaly requests in the
`/api/:version/projects/:id/merge_requests/:noteable_id/notes` endpoint.

Previously, the API to retrieve notes generated hundreds of Gitaly calls
to determine whether a system note should be shown to the user. It did
this by:

1. Rendering the Markdown
2. Extracting cross-references from the Markdown
3. Issuing a Gitaly `FindCommit` RPC for every reference to validate
that the commit exists.

The last step is unnecessary because we don't need to display a commit
if the user doesn't have access to the project in the first place.
`RendersNotes#prepare_notes_for_rendering` is already used in
`MergeRequestsController`, which is why we don't see N+1 Gitaly calls
there. We use it here to optimize the note redaction process.
2019-08-22 22:28:47 -07:00
Tiger 08fcb2379e CE port: allow SRV records in DB service discovery 2019-08-23 14:19:51 +10:00
Thong Kuah a50703f1e6 Fix frozen string error 2019-08-23 12:52:35 +12:00
Alessio Caiazza 606a1d2d31 Expose namespace storage statistics with GraphQL
Root namespaces have storage statistics.
This commit allows namespace owners to get those stats via GraphQL
queries like the following one

{
  namespace(fullPath: "a_namespace_path") {
    rootStorageStatistics {
      storageSize
      repositorySize
      lfsObjectsSize
      buildArtifactsSize
      packagesSize
      wikiSize
    }
  }
}
2019-08-22 22:08:28 +00:00
Balakumar a47db86e90 Log time spent on CPU to sidekiq.log 2019-08-22 14:31:57 +00:00
Thong Kuah c5acf26e06 Fix frozen string errors 2019-08-23 00:17:11 +12:00
Sean McGivern 842b4d4ab5 Merge branch 'feat/smime-signed-notification-emails' into 'master'
feat: smime signed notification emails

See merge request gitlab-org/gitlab-ce!30644
2019-08-22 12:16:00 +00:00
Kushal Pandya 7b5708d1d9 Merge branch 'ee-2502-refactor-ee-app-assets-javascripts-approvals-components-approvers_select-vue-to-remove-approverusers' into 'master'
Add a new method to `Api.js`: `projectUsers`

See merge request gitlab-org/gitlab-ce!31801
2019-08-22 07:59:22 +00:00
Alexandru Croitor 5af535d919 Limit the size of issuable description and comments
Limiting the size of issuable description and comments to 1_000_000,
which is close to ~1MB of ASCII characters, which represents 99.9% of
all descriptions and comments we have in DB at the moment. This should
help prevent DoS attacks when comments contain refference strings.

Also this change updates regexp matching the namespaces paths by
limiting the namespaces paths to Namespace::NUMBER_OF_ANCESTORS_ALLOWED,
as we allow 20 levels deep groups.

see https://gitlab.com/gitlab-org/gitlab-ce/issues/61974#note_191274234
2019-08-22 10:43:13 +03:00
Paul Okstad d7ae3efb87 Add Gitaly info-ref cache feature flags 2019-08-22 06:53:14 +00:00
Stan Hu d57d8ddb72 Merge branch 'sidekiq-interrupt-running-jobs-deadset' into 'master'
Put cancelled job in DeadSet

See merge request gitlab-org/gitlab-ce!32070
2019-08-21 20:29:10 +00:00
Stan Hu 45b3f554aa Merge branch 'uncomment_commit_signatures_feature_flag' into 'master'
Upgrade to gitaly 1.60.0 and uncomment get_commit_signatures feature flag

Closes #65991

See merge request gitlab-org/gitlab-ce!31981
2019-08-21 20:18:00 +00:00
Kamil Trzciński dbd88c02d6 Put cancelled job in DeadSet
This replicates Sidekiq behavior
of pushing dead job into DeadSet.
2019-08-21 21:15:03 +02:00
Marius Bobin 65b20f35dc Ensure CI matching operator receives an object
Ensure the evaluation of right-hand side expression always
results in the returning of an object or an empty String
2019-08-21 18:48:16 +00:00
Stan Hu 9a0c1f64f5 Merge branch 'sidekiq-interrupt-running-jobs' into 'master'
Allow to interrupt running sidekiq jobs

See merge request gitlab-org/gitlab-ce!31818
2019-08-21 18:37:36 +00:00
Oswaldo Ferreira 4daf3dc0db Avoid exposing unaccessible repo data upon GFM processing
When post-processing relative links to absolute links
RelativeLinkFilter didn't take into consideration that
internal repository data could be exposed for users
that do not have repository access to the project.

This commit solves that by checking whether the user
can `download_code` at this repository, avoiding any
processing of this filter if the user can't.

Additionally, if we're processing for a group (
no project was given), we check if the user can
read it in order to expand the href as an extra.
That doesn't seem necessarily a breach now,
but an extra check doesn't hurt as after all
the user needs to be able to `read_group`.
2019-08-21 12:23:44 -03:00
Kamil Trzciński 8d17c4dae6 Properly handle `sidekiq` skip
Transform `CancelledError` into `JobRetry::Skip`
2019-08-21 13:21:55 +02:00
Kamil Trzciński cb193cd6b5 Improve resillency of monitor
- Retry connection when it fails
- Properly shutdown daemon
- Stop monitor if the Exception is raised
- Properly guard exception handling
2019-08-21 12:06:10 +02:00
Kamil Trzciński 3683d2d251 Perform cheap thread find
If we process message that is not designated to us
previously we would fire a separate Thread for that.
We don't need to do it. We can cheaply check if thread
is available, if it is, we can perform expensive operation
then.
2019-08-21 12:06:10 +02:00
Kamil Trzciński c2cbfc5c4a Rework `Sidekiq::JobsThreads` into `Monitor`
This makes:
- very shallow `Middleware::Monitor` to only request tracking
  of sidekiq jobs,
- `SidekiqStatus::Monitor` to be responsible to maintain persistent
  connection to receive messages,
- `SidekiqStatus::Monitor` to always use structured logging
  and instance variables
2019-08-21 12:05:30 +02:00
Kamil Trzciński 75e2302d01 Allow to interrupt running jobs
This adds a middleware to track all threads
for running jobs.

This makes sidekiq to watch for redis-delivered notifications.

This makes be able to send notification to interrupt
running sidekiq jobs.

This does not take into account any native code,
as `Thread.raise` generates exception once the control gets
back to Ruby.

The separate measure should be taken to interrupt gRPC, shellouts,
or anything else that escapes Ruby.
2019-08-21 18:50:46 +10:00
Fabio Pitino 45c5144e36 Add active_jobs_limit to plans table
This is a port from EE changes where
we introduce a new limit for Plan model.

https://dev.gitlab.org/gitlab/gitlab-ee/merge_requests/1182
2019-08-21 10:03:07 +02:00
Luke Duncalfe 37b17fa61a Add service classes for mutating AwardEmoji
Adding, destroying and toggling emoji previously lacked services and
instead were performed through methods called on Awardable models.

This led to inconsistencies where relevant todos would be marked as done
only when emoji were awarded through our controllers, but not through
the API. Todos could also be marked as done when an emoji was being
removed.

Behaviour changes

- Awarding emoji through the API will now mark a relevant Todo as done
- Toggling an emoji off (destroying it) through our controllers will no
  longer mark a relevant Todo as done

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63372
2019-08-21 11:39:41 +12:00
drew ac77bb9376 Introducing new Syntax for Ci::Build inclusion rules
- Added Gitlab::Ci::Config::Entry::Rules and Gitlab::Ci::Config::Entry::Rules:Rule
  to handle lists of Rule objects to be evalauted for job inclusion
- Added `if:` and `changes:` as available Rules::Rule::Clause classes
- Added Rules handling logic to Seed::Build#included? with extra specs
- Use DisallowedKeysValidator to mutually exclude rules: from only:/except: on job config
2019-08-20 20:03:43 +00:00
Stan Hu e632ae8084 Standardize remote_ip and path keys for auth.log and api_json.log
Current `auth.log` uses `fullpath` and `ip`, while `api_json.log` uses
`remote_ip` and `path` for the same fields. Let's standardize these
namings to make it easier for people working with the data.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66167
2019-08-20 18:12:28 +00:00
Douwe Maan 011c5cebfc Merge branch 'bvl-mr-commit-note-counter' into 'master'
Count notes for commits and merge requests

See merge request gitlab-org/gitlab-ce!31912
2019-08-20 16:05:58 +00:00
Diego Louzán 0dcb9d21ef feat: SMIME signed notification emails
- Add mail interceptor the signs outgoing email with SMIME
- Add lib and helpers to work with SMIME data
- New configuration params for setting up SMIME key and cert files
2019-08-20 16:13:32 +02:00
Andrew Newdigate 790f64561a Allow measurement for Sidekiq jobs taking > 2.5s
Fix for https://gitlab.com/gitlab-org/gitlab-ce/issues/66319.
2019-08-20 13:52:25 +00:00
Sean McGivern 57ec78d530 Merge branch 'sh-fix-issues-api-gitaly-nplusone' into 'master'
Fix Gitaly N+1 calls with listing issues/MRs via API

Closes #66202

See merge request gitlab-org/gitlab-ce!31938
2019-08-20 12:58:03 +00:00
Peter Leitzen 6767326267 Use ActiveModel's type instead of virtus
The virtus project has been discontinued:

https://github.com/solnic/virtus/commit/a6f896984
2019-08-20 10:52:21 +00:00
Cameron Swords dfabed5def Add missing SAST environment variables 2019-08-20 07:55:03 +00:00
Alex Kalderimis 2cbcab4679 Add support for sentry_extra_data in exceptions
This allows exceptions to advertise their support for sentry
and provide structured data.
2019-08-19 23:06:21 +00:00
Robert Speicher 9295cc6f2a Merge branch '64251-branch-name-set-cache' into 'master'
Cache branch and tag names as Redis sets

See merge request gitlab-org/gitlab-ce!30476
2019-08-19 20:26:02 +00:00
Felipe Artur 2aac2e828b Uncomment get_commit_signatures feature flag 2019-08-19 15:40:58 -03:00
Nick Thomas 3028cd687a Merge branch '39-count-unique-users-for-more-accurate-smau-reporting' into 'master'
Allow UsageData.count to use count_by:

See merge request gitlab-org/gitlab-ce!30770
2019-08-19 14:45:24 +00:00
Aleksei Lipniagov dcfaf49550 Clean Sidekiq metrics from multiproc dir on start
After moving the multiproc dir cleanup into `config.ru`:`warmup`, we
stopped cleaning Sidekiq metrics dir which is not correct.
This MR intended to fix that. More details:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31668
2019-08-19 12:52:07 +00:00
Nick Thomas f7f91e84f7 Add a skip_users filter to the project users API
This functionality is available in the /autocomplete users pseudo-API.
We're attempting to replace that with the canonical API, so it needs
support for this parameter too.
2019-08-19 14:21:56 +05:30
Stan Hu ba7c501fef Fix Gitaly N+1 calls with listing issues/MRs via API
In GitLab 9.0,
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9661 removed the
`subscribed` flag from the API when the user requested a list of issues
or merge requests since calculating this value triggers extensive
Markdown processing.

In GitLab 12.0 via a4fbf39e, we accidentally reintroduced this
performance regression by changing `IssueBasic` to `Issue` in
`entities.rb`. This showed up as a Gitaly N+1 issue since the Markdown
processing would attempt to extract a commit if it detected a regex that
matched a commit.

We restore the prior behavior by once again removing the `subscribed`
flag for the bulk list of issues and merge requests and add a test to
ensure they aren't reintroduced.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66202
2019-08-17 20:35:37 -07:00
Stan Hu b46b9d5e89 Fix pipelines not always being created after a push
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31741 introduced
a regression where not all the right parameters would be passed into
`Ci::CreatePipelineService`. We fix this by breaking out the pipeline
parameters and reusing a method from `Gitlab::DataBuilder::Push`.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66196
2019-08-17 06:23:26 -07:00
Michael Kozono 9eabc0d6fc Merge branch 'legacy-attachments-migrate-fix' into 'master'
Migrate legacy uploads rake tasks

See merge request gitlab-org/gitlab-ce!29409
2019-08-16 22:07:56 +00:00
Stan Hu f14647fdae Expire project caches once per push instead of once per ref
Previously `ProjectCacheWorker` would be scheduled once per ref, which
would generate unnecessary I/O and load on Sidekiq, especially if many
tags or branches were pushed at once. `ProjectCacheWorker` would expire
three items:

1. Repository size: This only needs to be updated once per push.
2. Commit count: This only needs to be updated if the default branch
   is updated.
3. Project method caches: This only needs to be updated if the default
   branch changes, but only if certain files change (e.g. README,
   CHANGELOG, etc.).

Because the third item requires looking at the actual changes in the
commit deltas, we schedule one `ProjectCacheWorker` to handle the first
two cases, and schedule a separate `ProjectCacheWorker` for the third
case if it is needed. As a result, this brings down the number of
`ProjectCacheWorker` jobs from N to 2.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52046
2019-08-16 19:53:56 +00:00
rossfuhrman 3fbc51d333 Remove Security Dashboard feature flag
This removes the group_overview_security_dashboard feature flag
2019-08-16 17:40:33 +00:00
Bob Van Landuyt 71691d935e Count comments on notes and merge requests
This extends our existing `Gitlab::UsageDataCounters::NoteCounter` to
also count notes on commits and merge requests
2019-08-16 18:54:42 +02:00
Kamil Trzciński 535c2d3c71 Merge branch 'mc/feature/pipeline-tracking-config-ce' into 'master'
Add `needs:` CI config option CE

Closes gitlab-ee#12334

See merge request gitlab-org/gitlab-ce!31346
2019-08-16 14:47:05 +00:00
Nick Thomas 94c7a93dca Merge branch 'fix/commits-api-empty-refname' into 'master'
fix handling of empty ref_name parameter string in commits api

Closes #64745

See merge request gitlab-org/gitlab-ce!31687
2019-08-16 14:46:22 +00:00
Nick Thomas 0eff75fa2b
Cache branch and tag names as Redis sets
This allows us to check inclusion for the *_exists? methods without
downloading the full list of branch names, which is over 100KiB in size
for gitlab-ce at the moment.
2019-08-16 15:41:29 +01:00
Jarka Košanová 19db315734 Add rake tasks for migrating leacy uploads
- move uploads created by AttachmentUploader
- handle also files created for legacy_diff_notes
2019-08-16 07:52:30 +02:00
Thong Kuah f4ce990b0e Merge branch '24705-multi-selection-for-delete-on-registry-page' into 'master'
Resolve "Multi selection for delete on registry page"

Closes #24705

See merge request gitlab-org/gitlab-ce!30837
2019-08-15 23:57:38 +00:00
Sarah Yasonik caa361b703 Support query parameters in metrics embeds
https://gitlab.com/gitlab-org/gitlab-ce/issues/62971

Adds support for embedding specific charts from the
metrics dashboard. Expected parameters are dashboard,
title, group, and y_label.
2019-08-15 21:38:29 +00:00
Hordur Freyr Yngvason d3c5ff7b72 Squash project templates on update
As per https://gitlab.com/gitlab-org/gitlab-ce/issues/46043, project
templates should be squashed before updating, so that repositories
created from these templates don't include the full history of the
backing repository.
2019-08-15 20:20:08 +00:00
Mayra Cabrera 157b047e9d Removes db/fixtures from database files
This will avoid Danger to suggest a database review for files inside
db/fixtures
2019-08-15 17:42:13 +00:00
Brett Walker 3489dc3d72 Allow disabling group/project email notifications
- Adds UI to configure in group and project settings
- Removes notification configuration for users when
disabled at group or project level
2019-08-15 17:37:36 +00:00
Douglas Barbosa Alexandre 8c8824d442 Merge branch 'sh-fix-discussions-api-perf' into 'master'
Eliminate many Gitaly calls in discussions API

Closes #65957

See merge request gitlab-org/gitlab-ce!31834
2019-08-15 16:10:14 +00:00
Stan Hu 8044440d7a Eliminate many Gitaly calls in discussions API
Previously, the API to retrieve discussions from merge requests often
generated hundreds of Gitaly calls to determine whether a system note
should be shown to the user. It did this by:

1. Rendering the Markdown
2. Extracting cross-references from the Markdown
3. For cross-references that were commits, a Gitaly FindCommit RPC
   would be issued to validate that the commit exists.

The last step is unnecessary because we don't need to display a commit
if the user doesn't have access to the project in the first place.

`RendersNotes#prepare_notes_for_rendering` is already used in
`MergeRequestsController`, which is why we don't see N+1 Gitaly calls
there. We use it here to optimize the note redaction process.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65957
2019-08-15 08:02:30 -07:00
Stan Hu 0495615502 Merge branch 'fix-broken-ee-master-prepend-todos-api' into 'master'
Adds EE prepend, which for some reason was missing

See merge request gitlab-org/gitlab-ce!31851
2019-08-15 14:41:17 +00:00
Alex Kalderimis 922f21e23d Adds EE prepend, which for some reason was missing 2019-08-15 14:16:29 +01:00
Kamil Trzciński 2c71a94744 Merge branch '65278-livesum-puma-phase' into 'master'
Remove :puma_phase metrics

See merge request gitlab-org/gitlab-ce!31773
2019-08-15 11:41:06 +00:00
George Koltsov 06eddc3edf Fix project import restricted visibility bypass
Add Gitlab::VisibilityLevelChecker that verifies
selected project visibility level (or overridden param)
is not restricted when creating or importing a project
2019-08-15 10:30:47 +01:00
Luke Duncalfe d314052711 Remove prepend_if_ee from CE codebase
This was added in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31789
2019-08-15 21:06:01 +12:00
Luke Duncalfe 88746f5311 CE-specific changes to allow design Todos
CE-specific changes for:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15129

Co-Authored-By:    Alex Kalderimis <akalderimis@gitlab.com>
Co-Authored-By:    Luke Duncalfe <lduncalfe@eml.cc>
2019-08-15 15:08:34 +12:00
Hordur Freyr Yngvason 37ffbeeab1 Make ruby 2.6 the officially supported version 2019-08-14 23:16:55 +00:00
João Cunha f8821f828e Make use of Gitlab::Kubernetes
- refactor Knative and Prometheus
2019-08-14 20:02:37 +00:00
Jeremy Jackson 5d9d5e6031 Migrates Snowplow backend from EE to CE
This introduces several changes, but these are all just ported from the
EE project.
2019-08-14 19:21:58 +00:00
Adam Hegyi c5cb5da4ac Track page views for cycle analytics show page
This change adds a new counter 'cycle_analytics_views' to the usage data
metrics to count the page views for cycle analytics show page.
2019-08-14 16:12:12 +00:00
Grzegorz Bizon 8fc2fbb6f2 Merge branch 'limit-amount-of-needs' into 'master'
Add `ci_dag_limit_needs`

See merge request gitlab-org/gitlab-ce!31803
2019-08-14 15:05:51 +00:00
Aleksei Lipniagov 6fc7033725 Remove :puma_phase metrics
We don't use phase restarts, as we use `preload_app`:
https://github.com/puma/puma/blob/master/README.md#clustered-mode
`:puma_phase` values will always be zero.
2019-08-14 17:46:40 +03:00
Nick Thomas 3cd40c4a80 Merge branch 'sh-optimize-commit-deltas-post-receive' into 'master'
Reduce Gitaly calls in PostReceive

Closes #65878

See merge request gitlab-org/gitlab-ce!31741
2019-08-14 14:38:28 +00:00
Kamil Trzciński fcc20fde83 Add `ci_dag_limit_needs` feature flag
This makes to limit `needs:` to 5 by default.
Allow to increase the limit to 50 with disable of FF.
2019-08-14 15:48:16 +02:00
Grzegorz Bizon d1e80af603 Merge branch 'require-needs-to-be-present' into 'master'
Require `needs:` to be present

Closes #65839

See merge request gitlab-org/gitlab-ce!31761
2019-08-14 08:37:16 +00:00
Igor 04598039a5 Add usage pings for source code pushes
Source Code Usage Ping for Create SMAU
2019-08-13 22:33:16 +00:00
Douglas Barbosa Alexandre 383a18403f Merge branch 'bump_helm_kubectl_gitlab' into 'master'
Bump Helm to 2.14.3 and kubectl to 1.11.10

See merge request gitlab-org/gitlab-ce!31716
2019-08-13 21:57:14 +00:00
Stan Hu e2361565ce Merge branch 'expand-variables-only-when-needed' into 'master'
Expand variables only when needed

See merge request gitlab-org/gitlab-ce!31772
2019-08-13 21:14:23 +00:00
Kamil Trzciński 6150c3ff0d Expand variables only when needed
This makes us to expand variables only when needed,
instead of requesting all variables each time.

This specifically helps in situation when explicit name
of `environment: production` is used.
2019-08-13 21:51:29 +02:00
Stan Hu e658f9603c Only expire tag cache once per push
Previously each tag in a push would invoke the Gitaly `FindAllTags` RPC
since the tag cache would be invalidated with every tag.

We can eliminate those extraneous calls by expiring the tag cache once
in `PostReceive` and taking advantage of the cached tags.

Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/65795
2019-08-13 09:04:30 -07:00
Bob Van Landuyt 3702ab7317 Merge branch '65803-invalidate-branches-cache-on-refresh' into 'master'
Only expire branch cache once per push

See merge request gitlab-org/gitlab-ce!31653
2019-08-13 15:41:25 +00:00
Kamil Trzciński 93e9518215 Require `needs:` to be present
This changes the `needs:` logic to require
that all jobs to be present. Instead of skipping
do fail the pipeline creation if `needs:` dependency
is not found.
2019-08-13 15:07:21 +02:00
Kamil Trzciński 583544d089 Require `stage:` to be set with `needs:`
Since we are unsure what would be the behavior of `stage:`
when we work on DAG. Let's make `stage:` to be required
today with `needs:`.
2019-08-13 11:47:30 +02:00
GitalyBot 3c5647bd57 Upgrade Gitaly to v1.59.0 2019-08-13 05:54:12 +00:00
Stan Hu 4e2bb4e5e7 Reduce Gitaly calls in PostReceive
This commit reduces I/O load and memory utilization during PostReceive
for the common case when no project hooks or services are set up.

We saw a Gitaly N+1 issue in `CommitDelta` when many tags or branches
are pushed. We can reduce this overhead in the common case because we
observe that most new projects do not have any Web hooks or services,
especially when they are first created. Previously, `BaseHooksService`
unconditionally iterated through the last 20 commits of each ref to
build the `push_data` structure. The `push_data` structured was used in
numerous places:

1. Building the push payload in `EventCreateService`
2. Creating a CI pipeline
3. Executing project Web or system hooks
4. Executing project services
5. As the return value of `BaseHooksService#execute`
6. `BranchHooksService#invalidated_file_types`

We only need to generate the full `push_data` for items 3, 4, and 6.

Item 1: `EventCreateService` only needs the last commit and doesn't
actually need the commit deltas.

Item 2: In addition, `Ci::CreatePipelineService` only needed a subset of
the parameters.

Item 5: The return value of `BaseHooksService#execute` also wasn't being
used anywhere.

Item 6: This is only used when pushing to the default branch, so if
many tags are pushed we can save significant I/O here.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65878

Fic
2019-08-12 22:28:49 -07:00
Heinrich Lee Yu 7a6ecbcb18 Improve quick action error messages
Standardize punctuation and format
2019-08-13 00:40:39 +00:00
Michael Kozono 4254f5dc0e Merge branch 'ce-12547-load-search-counts-async' into 'master'
Load search result counts asynchronously (CE)

See merge request gitlab-org/gitlab-ce!31663
2019-08-12 22:02:28 +00:00
Michael Kozono 4ce6d2b9db Merge branch 'sh-fix-import-export-suggestions' into 'master'
Properly save suggestions in project exports

Closes #65880

See merge request gitlab-org/gitlab-ce!31690
2019-08-12 22:00:49 +00:00
Markus Koller 49c83155cc
Load search result counts asynchronously
Querying all counts for the different search results in the same request
led to timeouts, so we now only calculate the count for the *current*
search results, and request the others in separate asynchronous calls.
2019-08-12 22:01:15 +02:00
Annabel Dunstone Gray 22f3142b83 Merge branch '65790-highlight' into 'master'
Adds highlight to collapsible line in job log

Closes #65790

See merge request gitlab-org/gitlab-ce!31665
2019-08-12 19:01:24 +00:00
Filipa Lacerda 3e2f2b8071 Adds highlight to collapsible line
In the job log adds a highlight when hovering
the collapsible line
2019-08-12 17:24:42 +01:00
Stan Hu 5971cd1508 Merge branch '65278-fix-puma-master-counter-wipe' into 'master'
Fix active metric files being wiped after the app starts

See merge request gitlab-org/gitlab-ce!31668
2019-08-12 16:20:31 +00:00
Jacob Vosmaer f3e0ec7b4a Update Gitaly server and gem to 1.58.0 2019-08-12 15:50:30 +00:00
Grzegorz Bizon 37496d5916 Merge branch 'georgekoltsov/63408-user-mapping' into 'master'
Add author lines to project import comments

See merge request gitlab-org/gitlab-ce!31579
2019-08-12 15:27:14 +00:00
George Koltsov 23dfc5d606 Add code review suggestions 2019-08-12 15:05:49 +01:00
Thong Kuah b577825e54 Bump Helm to 2.14.3 and kubectl to 1.11.10 2019-08-13 00:07:27 +12:00
Aleksei Lipniagov 35fb27db27 Remove worker label from puma terminations metric 2019-08-12 13:52:15 +03:00
George Koltsov 91353779bf Add changelog entry 2019-08-12 11:16:17 +01:00
George Koltsov 1c2554bfd3 Add BitBucketServerImport project filtering 2019-08-12 11:16:17 +01:00
Stan Hu 26107e9354 Properly save suggestions in project exports
Previously imports would fail if a merge request note included a
suggestion with an
`ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection`
exception.

This was happening because suggestions were listed as a descendant of
merge requests, but this doesn't work because suggestions are directly
associated with notes, not merge requests, and that association is lost.
Rails also disallows creating intializing a has_many association through
a different object.

We fix this by making `suggestions` a child of `notes` within a merge
request. This doesn't fix previously broken exported project exports,
but new exports will work.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65880
2019-08-10 18:50:42 -07:00
Armin Hohenegger 20ac5e6d4b fix handling of empty ref_name parameter string in commits api
when params[:ref_name] is set to "" by passing an empty query parameter
to the api it is evaluated as false by the || operator.
The use of active support core extensions presence method fixes the original
implemantation.

https://guides.rubyonrails.org/active_support_core_extensions.html#presence
2019-08-10 19:11:20 +02:00
Stan Hu afe867921c Rename branches_exist? -> includes_branches? 2019-08-09 15:41:07 -07:00
Igor b99011af62 Split MR widget into cached and non-cached serializers
Splits auto-refreshing of MR widget into 2 requests:

- the one which uses etag-caching and invalidates the fields on change
- the one without caching

The idea is to gradually move all the fields to etag-cached endpoint
2019-08-09 21:01:55 +00:00
Robert Speicher 4b10592b81 Merge branch 'issue_58494' into 'master'
Prevent rewritting plain links as embedded

Closes #58494

See merge request gitlab-org/gitlab-ce!31489
2019-08-09 20:41:12 +00:00
Tristan Read 5e6a58040b Remove gfm_embed_metrics flag from BE
Removes the feature flag that controls whether
metrics dashboard urls unfurl the metrics dashboard
charts.
2019-08-09 20:35:43 +00:00
Bob Van Landuyt e0e6e9e7db Merge branch 'revert-d61dab91' into 'master'
Revert "Merge branch '65152-selective-highlight' into 'master'"

See merge request gitlab-org/gitlab-ce!31643
2019-08-09 16:29:13 +00:00
Rémy Coutable 39f9f0bdbb Merge branch 'lib-differences' into 'master'
Resolve EE differences in the lib/ directory

See merge request gitlab-org/gitlab-ce!31582
2019-08-09 14:34:45 +00:00
Thong Kuah 9e19125f39 Merge branch 'sh-fix-sidekiq-scheduling-latency' into 'master'
Fix Sidekiq scheduling_latency_s

Closes #65748

See merge request gitlab-org/gitlab-ce!31650
2019-08-09 11:59:44 +00:00
Patrick Bajao d96c24d815 Invalidate branches cache on PostReceive
Whenever `PostReceive` is enqueued, `UpdateMergeRequestsWorker`
is enqueued and `MergeRequests::RefreshService` is called, it'll
check if the source branch of each MR asssociated to the push exists
or not via `MergeRequest#source_branch_exists?`. The said method will
call `Repository#branch_exists?` which is cached in `Rails.cache`.

When the cache contains outdated data and the source branch actually
exists, the `MergeRequests#RefreshService` job will close associated
MRs which is not correct.

The fix is to expire the branches cache of the project so we have
updated data during the post receive hook which will help in the
accuracy of the check if we need to close associated MRs or not.
2019-08-09 18:09:06 +08:00
Stan Hu a74396dcc5 Add Gitaly and Rugged call timing in Sidekiq logs
This will help identify Sidekiq jobs that invoke excessive number of
filesystem access.

The timing data is stored in `RequestStore`, but this is only active
within the middleware and is not directly accessible to the Sidekiq
logger. However, it is possible for the middleware to modify the job
hash to pass this data along to the logger.
2019-08-09 01:08:32 -07:00
James Lopez bbf639c43d Merge branch '39217-remove-kubernetes-service-integration' into 'master'
Remove KubernetesService integration

See merge request gitlab-org/gitlab-ce!31365
2019-08-09 07:10:26 +00:00
Rémy Coutable 44065b0138 Merge branch 'speed-up-labels-api' into 'master'
Remove label issue and MR counts from default API responses

See merge request gitlab-org/gitlab-ce!31543
2019-08-09 06:25:29 +00:00
Stan Hu 7ccbb562b1 Fix Sidekiq scheduling_latency_s
This number was reporting a negative number because `current_time` was
a monotonic counter, not an absolute time.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65748
2019-08-08 20:51:40 -07:00
Patrick Bajao 6d318af5f9 Revert "Merge branch '65152-selective-highlight' into 'master'"
This reverts merge request !31361
2019-08-09 00:13:09 +00:00
Cindy Pallares 🦉 2b30423935 Add a field for released_at to GH importer 2019-08-09 00:06:21 +00:00
Stan Hu 0324028a3f Rename githost.log -> git_json.log
The githost.log name was often confused with GitHost.io. Rename this to
git_json.log to make it clear it's coming from Git and that it's JSON
data.
2019-08-08 13:39:11 -07:00
Hordur Freyr Yngvason 5f82ff1469 Bring scoped environment variables to core
As decided in https://gitlab.com/gitlab-org/gitlab-ce/issues/53593
2019-08-08 18:51:52 +00:00
Sean McGivern e6dc5168b8 Remove label issue and MR counts from default API responses
These counts significantly increase the load time for these
requests. Users can now opt in to receiving the counts by setting
`with_counts=true` in requests. This is a breaking change, but hopefully
a fairly minor one.
2019-08-08 17:10:41 +01:00
Robert Speicher 79bff3ee7a Merge branch '12026-use-notes-finder-target-for-epics-ce' into 'master'
Use NotesFinder#target to find Epics

See merge request gitlab-org/gitlab-ce!31408
2019-08-08 15:39:13 +00:00
Felipe Artur 492a7e753d Fix DNS rebind vulnerability for JIRA integration
Uses Gitlab::HTTP for JIRA requests instead of Net::Http.
Gitlab::Http comes with some built in SSRF protections.
2019-08-08 10:24:43 -03:00
Mark Chao 4a6f959ab8 Record usage on snippet usage
Generalize wiki page counter for other page types to extend to.
2019-08-08 13:18:57 +00:00
George Koltsov ba429a6e20 Apply code review feedback 2019-08-08 13:16:33 +01:00
Yorick Peterse a4e13a5966
Backport EE changes to ProjectSearchResults
EE made some changes to the project_ids_relation method, but these were
not backported to CE.
2019-08-08 13:34:07 +02:00
Yorick Peterse 4c53b3945c
Backport EE changes to the project import API
EE added a single line to this file that can easily be backported to CE,
but it appears this was overlooked. The method called is a noop in CE,
so no additional changes are necessary.
2019-08-08 13:34:07 +02:00
Kushal Pandya 8505049e1f Merge branch '63181-collapsible-line' into 'master'
Makes section title clickable and collapsible

Closes #63181

See merge request gitlab-org/gitlab-ce!31571
2019-08-08 09:04:29 +00:00
Grzegorz Bizon 400da76d5e Merge branch 'patch-71' into 'master'
Remove duplicated line from Maven CI template

See merge request gitlab-org/gitlab-ce!31440
2019-08-08 08:42:03 +00:00
Stan Hu 3ad34c3a24 Merge branch '20137-starrers' into 'master'
Add possibilty to view starrers ("stargazers") of a repository & any user's starred repositories

Closes #20137

See merge request gitlab-org/gitlab-ce!24690
2019-08-08 04:40:55 +00:00
Tiger e3696bf20e Final removal of KubernetesService
Creating new records has been disabled, and all
existing records been migrated to clusters as of
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28534
2019-08-08 09:47:07 +10:00
Mayra Cabrera eec1ed522d Merge branch 'sh-add-missing-csp-report-uri' into 'master'
Add missing report-uri to CSP config

See merge request gitlab-org/gitlab-ce!31593
2019-08-07 21:07:06 +00:00
Philippe Lafoucrière e5a830bac1 Checksum clair executable 2019-08-07 19:05:56 +00:00
Camil Staps 99bb207ef1
Fix tests 2019-08-07 20:49:16 +02:00
Camil Staps e8bdcdf0f8
Expose time since starring on project/:id/starrers API endpoint; exclude private profiles here as well 2019-08-07 20:49:16 +02:00
Camil Staps 1ec8c0e837
Fix API endpoint for starred projects of a user; add info about starred projects on profile to documentation 2019-08-07 20:49:16 +02:00
Camil Staps e7c34c37c8
Add documentation and changelog for !24690 2019-08-07 20:49:15 +02:00
Camil Staps d03a4c9a07
Add users/:user_id/starred_projects API endpoint for projects starred by a user 2019-08-07 20:49:14 +02:00
Camil Staps 5b20df0a92
Add projects/:id/starrers API endpoint for users who starred a repository 2019-08-07 20:49:13 +02:00
Reuben Pereira af4a597d3f Save instance administration project id in DB
- This will make it easy to identify the project even if admins change
the name of the project or move it.
2019-08-07 18:40:36 +00:00
Felipe Artur 831ceea924 Prevent rewritting plain links as embedded
Prevents rewritting plain image/video links as embedded when moving
issues.
2019-08-07 15:39:48 -03:00
Stan Hu d265408c26 Add missing report-uri to CSP config
This is supported in Rails 5.2, although it may be
deprecated in the future by reports-to.
2019-08-07 11:21:08 -07:00
Sarah Yasonik bf918b68f6 Support dashboard params for metrics dashboard
https://gitlab.com/gitlab-org/gitlab-ce/issues/62971

Adds support to EnvironmentsController#metrics_dashboard
for the following params: group, title, y_label
These params are used to uniquely identify a panel on
the metrics dashboard.

Metrics are stored in several places, so this adds
utilities to find a specific panel from the database
or filesystem depending on the metric specified.

Also moves some shared utilities into separate classes,
notably default values and errors.
2019-08-07 16:17:35 +00:00
Filipa Lacerda 85e0eb472d Makes title section collapsible
In the job log, if the user clicks the section title
the job log section will be collapsed
2019-08-07 16:42:17 +01:00
Kerri Miller 336d3ccc65 Initial commit of WIP code for consideration
Squash this commit and reword before merging..
2019-08-07 15:13:13 +00:00
George Koltsov 5ba77a4999 Add author lines to project import comments 2019-08-07 14:01:40 +01:00
Zeger-Jan van de Weg 3ace5766e9
Use Git 2.22 for GitLab
Part of: https://gitlab.com/gitlab-org/gitaly/issues/1715
2019-08-07 14:25:58 +02:00