Commit Graph

5576 Commits

Author SHA1 Message Date
Stan Hu 2265ce34af Fix no avatar not showing in user selection box
After upgrading to Ruby 2.5.3, we switched `URI.join` in favor of
`Gitlab::Utils.append_path`. However,
ActionController::Base.helpers.image_path can return a full URL if a CDN
host is present.

Rails provides a way to generate the full URL using the asset path, but
that doesn't appear to work because `request` is nil`.

Revert to the previous behavior to handle CDNs and relative URLs.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56268
2019-01-13 08:02:02 -08:00
Toon Claes 082cc12225 Fix failing spec with orphaned namespace 2019-01-11 15:36:57 +01:00
Stan Hu 618875c58c Fix duplicate disk path in Backfill ProjectRepos
On GitLab.com, we saw numerous duplicate disk entry inserts because
the migration was not taking the routes table into account. We now
implement this in the migration to be consistent.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56061
2019-01-11 15:36:51 +01:00
Nick Thomas 067dc6540c
Validate bundle files before unpacking them 2019-01-10 21:33:36 +00:00
Toon Claes b87dcc238a Remove backfill migration for legacy projects
We've found some problems with the backgroung migration:
BackfillLegacyProjectRepositories

See https://gitlab.com/gitlab-org/gitlab-ce/issues/56061

The migration was disabled to run on production:
https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/5906

So to overcome it's not being run anywhere, just remove it.

Whenever all problems in BackfillLegacyProjectRepositories are fixed
we'll create a new migration (with a different timestamp) to have it
run.
2019-01-10 16:45:14 +01:00
Matija Čupić ebdf9fada7
Add specs for both parallel and regular job deps 2019-01-09 16:57:11 +01:00
Robert Speicher 0986039896 Merge branch 'sh-switch-rack-request-to-actionpack' into 'master'
Switch use of Rack::Request to ActionDispatch::Request

See merge request gitlab-org/gitlab-ce!24199
2019-01-09 02:01:39 +00:00
Stan Hu e884795e6c Revert "Merge branch '3062-improve-project-cache' into 'master'"
This reverts commit e65e184269, reversing
changes made to 646ba2418b.
2019-01-08 13:14:06 -08:00
Douglas Barbosa Alexandre 22ab2d040d Merge branch 'osw-fix-bottom-expansion-diff-comment' into 'master'
Adjusts duplicated line when commenting on unfolded diff lines (in the bottom)

Closes #56051

See merge request gitlab-org/gitlab-ce!24201
2019-01-08 15:48:08 +00:00
Oswaldo Ferreira 8303eb8a9e Adjusts duplicated line when commenting on unfolded diff lines 2019-01-08 12:45:19 -02:00
Mark Chao 3ab5af14a2 Check if specific type of background migration are done
Useful for checking progress.
2019-01-08 15:19:45 +08:00
Douglas Barbosa Alexandre 31f2c7b00e Merge branch '53966-hashed-storage-read-only' into 'master'
Hashed Storage: Only set as `read_only` when starting the per-project migration

See merge request gitlab-org/gitlab-ce!24128
2019-01-08 00:07:02 +00:00
Gabriel Mazetto ee4af0c64c Only set as `read_only` when starting the per-project migration
In the previous code, we locked the project during the migration
scheduling step, which works fine for small setups, but can be
problematic in really big installations.

We now moved the logic to inside the worker, so we minimize the time a
project will be read-only. We also make sure we only do that if
reference counter is `0` (no current operation is in progress).
2019-01-07 23:53:06 +01:00
Reuben Pereira f40b5860d7 Add table and model for error tracking settings 2019-01-07 17:55:21 +00:00
Grzegorz Bizon 604073ffc3 Merge branch 'include-project' into 'master'
Allow to include another project files

Closes #53903

See merge request gitlab-org/gitlab-ce!24101
2019-01-07 09:19:36 +00:00
Kamil Trzciński c4d615c9dc Allow to include files from another projects
This adds `project:, file:, ref:` specification support.
2019-01-07 09:38:05 +01:00
Stan Hu aff2b6e4eb Switch use of Rack::Request to ActionDispatch::Request
As mentioned in
https://gitlab.com/gitlab-org/gitlab-ee/issues/9035#note_129093444,
Rails 5 switched ActionDispatch::Request so that it no longer inherits
Rack::Request directly. A middleware that uses Rack::Request to
read the environment may see stale request parameters if
another middleware modifies the environment via ActionDispatch::Request.
To be safe, we should be using ActionDispatch::Request everywhere.
2019-01-07 00:35:53 -08:00
Grzegorz Bizon 1aa2ac13b9 Merge branch 'kamil-refactor-ci-builds-v5' into 'master'
Use BuildMetadata to store build configuration in JSONB form

See merge request gitlab-org/gitlab-ce!21499
2019-01-06 09:47:29 +00:00
Stan Hu 7d28e39f58 Fix multipart attachments not uploading
Mixing and matching the use of Rack::Request and ActionDispatch::Request
in Rails 5 is bad, particularly if you have middleware that
manipulates or accesses environment variables.

`Gitlab::Middleware::Multipart` attempts to rewrite request parameters
to the proper values (e.g. replacing `data_file` with
`UploadedFile`). It does this by calling `Rack::Request#update_params`,
which essentially updates `env['rack.request.form_hash']`.

By changing to `ActionDispatch::Request`, the Go middleware was causing
the request parameters to be stored inside
`env['action_dispatch.request.request_parameters']`. Later calls to
`Rack::Request#update_params` would not have any effect because it would
attempt to update `env['rack.request.form_has']` instead of
`env['action_dispatch.request.request_parameters']`. As a result, the
controller still saw the old parameters.

Since the Go middleware appears to be using `ActionDispatch::Request`
for authorization methods, we can switch the multipart middleware to
use it too.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/9035
2019-01-05 01:56:47 -08:00
Kamil Trzciński b97b85c37e Merge branch 'include-templates' into 'master'
Include templates

Closes #53445

See merge request gitlab-org/gitlab-ce!23495
2019-01-04 15:42:53 +00:00
Kamil Trzciński 0103d5be96 Add config_options|variables to BuildMetadata
These are data columns that store runtime configuration
of build needed to execute it on runner and within pipeline.

The definition of this data is that once used, and when no longer
needed (due to retry capability) they can be freely removed.

They use `jsonb` on PostgreSQL, and `text` on MySQL (due to lacking
support for json datatype on old enough version).
2019-01-04 16:38:17 +01:00
Kamil Trzciński a8c5096026 Allow to include templates
This rewrites a syntax to allow include of templates.
This also normalises the syntax used by include: feature
2019-01-04 15:22:41 +01:00
Shinya Maeda 8a75453ea0 Update safe model attributes for import/export 2019-01-04 22:17:02 +09:00
Shinya Maeda 66755c9ed5 Support CURD operation for release asset links
- Add Releases::Links model
- Expose it in release API
- Add integration tests
2019-01-04 22:17:02 +09:00
Sean McGivern 8600043bc7 Merge branch '29951-issue-creation-by-email-without-subaddressing' into 'master'
Support new issue creation by email without subaddressing

Closes #29951

See merge request gitlab-org/gitlab-ce!23523
2019-01-04 08:58:55 +00:00
Sean McGivern 626f3d0367 Merge branch 'dm-git-access-any-ce' into 'master'
[CE] Don't run checks for changed refs when specific changes are unknown

See merge request gitlab-org/gitlab-ce!23990
2019-01-04 08:42:20 +00:00
Brett Walker a4f2de7964 Refactoring and review comments
including verifying the project_slug
2019-01-03 14:37:35 -06:00
Brett Walker 2e51431403 Use new issue email address format
We now use `-issue` in order to support catch all email addresses
2019-01-03 14:37:35 -06:00
Brett Walker 34dd6196e3 Use new merge request email address format
We now use `-merge-request` instead of `+merge-request+`
in order to support catch all email addresses
2019-01-03 14:37:35 -06:00
Brett Walker 23d5f4c991 Use new unsubscribe link
We now use `-unsubscribe` instead of `+unsubscribe`
in order to support catch all email addresses
2019-01-03 14:37:35 -06:00
mortyccp 0e061adfcb Fix lint errors 2019-01-03 20:28:02 +08:00
mortyccp 3a62f15657 Remove authentication via warden and PRIVATE_TOKEN header 2019-01-03 20:28:02 +08:00
mortyccp b7e0a09de2 Fix rspec error in rails 4 2019-01-03 20:28:02 +08:00
mortyccp d1fea99deb Allow basic authentication on go get middleware 2019-01-03 20:28:02 +08:00
Douwe Maan 3a0ae96c0e
Don't run single change checks when changes are unknown
When the `changes` passed to `GitAccess` are the literal string `_any`,
which indicates that this is a pre-authorization check, we now check
whether the user can push to any branch in the project in question,
instead of running the per-change check with `oldrev` `_any`, `newrev`
`nil`, and `ref` `nil`.
2019-01-02 15:31:32 +01:00
Douwe Maan bc7a1affe3
Extract any-branch-allows-collaboration logic into dedicated method 2019-01-02 15:31:32 +01:00
Douwe Maan 55723c223f
Move magic '_any' string to constant 2019-01-02 15:31:31 +01:00
John Jarvis 191f461b88 Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2019-01-02 12:00:52 +01:00
Kamil Trzciński f93f09e735 Merge branch 's3-directories-get' into 'master'
Use directories.new when getting S3 directory

Closes gitlab-com/gl-infra/infrastructure#5807

See merge request gitlab-org/gitlab-ce!23981
2019-01-02 10:08:31 +00:00
John Jarvis a74700178d Merge branch 'security-master-secret-ci-variables-exposed' into 'master'
[master] Secret CI variables can exposed by creating a tag with the same name as an existing protected branch

See merge request gitlab/gitlabhq!2596
2019-01-02 09:33:23 +00:00
Takuya Noguchi 1b87f8d763 Remove gem install bundler from Docker-based Ruby environments
bundler gem has been included in the Docker official Ruby image since 2.1.

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2019-01-01 19:27:19 +09:00
Shinya Maeda 8f1e96c89b Add spec for Release API
Add spec for all release API - GET, POST, PUT, DELETE.
Also, fixes some minior bugs.
2018-12-31 14:35:57 +09:00
Francisco Javier López e9b5b10a45 Skip per-commit validations which have already passed on another change/branch 2018-12-28 10:44:25 +00:00
Kamil Trzciński cf200b64d8 Merge branch '51970-correct-ordering-of-metrics' into 'master'
Correct the ordering of metrics on performance dashboard

Closes #51970

See merge request gitlab-org/gitlab-ce!23630
2018-12-28 10:42:54 +00:00
Francisco Javier López 5a3e6fdff9
Fixing image lfs bug and also displaying text lfs
This commit, introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23812,
fixes a problem creating a displaying image diff notes when the image
is stored in LFS. The main problem was that `Gitlab::Diff::File` was
returning an invalid valid in `text?` for this kind of files.

It also fixes a rendering problem with other LFS files, like text
ones. They LFS pointer shouldn't be shown when LFS is enabled
for the project, but they were.
2018-12-27 16:51:07 +01:00
Douwe Maan 5fabc1fd3b Merge branch 'osw-cache-discussions-diff-highlighting' into 'master'
Considerably improve the loading time on merge request's discussion page

Closes #52950

See merge request gitlab-org/gitlab-ce!23857
2018-12-27 10:18:21 +00:00
Jan Provaznik 2bfc317492 Use directories.new when getting S3 directory
Calling `Fog::Storage::AWS::Directories#get` requires the
ListAllMyBuckets permission, but we can avoid that extra query and
permission by initializing the directory with a specific bucket:
https://stackoverflow.com/a/12288581/1992201
2018-12-27 11:06:06 +01:00
Lin Jen-Shin 82bf55c8db Merge remote-tracking branch 'upstream/master' into 54953-error-500-viewing-merge-request-due-to-nil-commit_email_hostname
* upstream/master: (115 commits)
  [CE] Speed up login page usage
  Add new line and comments
  Fix the seeder 24_forks.rb cannot find public project
  Milestones on community contribution issues
  Removed Gitlab Upgrader found in /lib/gitlab/upgrader.rb
  Fix and move specs into admin_disables_git_access_protocol_spec.rb
  Fix HTTP/SSH clone panel for mobile
  Add spec for HTTP/SSH clone panel
  Fix missing Git clone button when protocol restriction setting enabled
  Fix deprecation: Using positional arguments in integration tests
  Extend override check to also check arity
  Update tm cli version
  Bump Gitaly version to v1.12.0
  Add @dbalexandre to CODEOWNERS
  Update verbiage for clarity
  Change group-cluster beta to regular note
  Change alpha states to use note instead of warning
  Update registry section. Update serverless.yaml formatting
  Clarify obtaining application URL
  Add @godfat to CODEOWNERS
  ...
2018-12-26 18:03:21 +08:00
Lin Jen-Shin 145079b354 Merge branch '42125-extend-override-check-to-also-check-arity' into 'master'
Resolve "Extend `override` check to also check arity"

Closes #42125

See merge request gitlab-org/gitlab-ce!23498
2018-12-26 09:58:08 +00:00
Jacob Wolen bd3c2f3aba Removed Gitlab Upgrader found in /lib/gitlab/upgrader.rb 2018-12-24 14:48:31 +00:00
Jacopo d2851f41ba Extend override check to also check arity
Override now cares about parents method arity: if parents arity
doesn't match raises an error.
2018-12-22 14:10:43 +01:00
Lin Jen-Shin 02878551b5 Merge branch 'support-gitaly-tls' into 'master'
Support tls communication in gitaly

See merge request gitlab-org/gitlab-ce!22602
2018-12-21 19:01:58 +00:00
Oswaldo Ferreira 7cf4947792 Cache diff highlight in discussions
This commit handles note diffs caching, which considerably improves
the performance on merge requests with lots of comments.
Important to note that the caching approach taken here is different
from `Gitlab::Diff::HighlightCache`. We do not reset the whole cache
when a new push is sent or anything else. That's because discussions
diffs are persisted and do not change.
2018-12-21 16:59:21 -02:00
Ahmad Hassan 907f0ce8a2 More tls gitaly docs 2018-12-21 18:06:46 +02:00
rpereira2 2cd7b78391 Correct ordering of metrics
Correct the ordering of metrics on performance dashboard. Before common
metrics were moved into the DB, metric groups were ordered by the
priority defined in the common_metrics.yml file.
This commit adds a priority to each metric group in the PrometheusMetric
model.
It also combines title, priority and required_metrics into one frozen
GROUP_DETAILS hash so that the code is clearer.
This can be done since there is a fixed set of groups which are not
configurable.
2018-12-21 16:41:58 +05:30
John Jarvis fbd4319a82 Merge branch 'security-import-symlink' into 'master'
[master] Persistent Symlink in Project Import

See merge request gitlab/gitlabhq!2673
2018-12-21 08:09:22 +00:00
Ahmad Hassan d975074e1f Log certificate loading errors into sentry 2018-12-20 18:24:53 +02:00
Dmitriy Zaporozhets 24c9e1e2a8 Merge branch 'ce-8333-add-related-epics-support' into 'master'
CE port: Rename GroupHierarchy into ObjectHierarchy

See merge request gitlab-org/gitlab-ce!23923
2018-12-20 12:49:25 +00:00
Mike Greiling 9f0983a4b1 Resolve "Hide cluster features that don't work yet with Group Clusters" 2018-12-20 09:39:09 +00:00
Douglas Barbosa Alexandre 156788bae9
Port Gitlab::JsonCache to CE 2018-12-19 15:15:05 -02:00
Jarka Košanová b1c3955385 Rename GroupHierarchy into ObjectHierarchy
- we now use the hierarchy class also for epics
- also rename supports_nested_groups? into supports_nested_objects?
  - move it to a concern
2018-12-19 15:24:29 +01:00
Ahmad Hassan 32c4f70aa5 Followups on review 2018-12-19 15:19:43 +02:00
Rémy Coutable cc06bb2c6e
Simplify spec/lib/gitlab/current_settings_spec.rb a bit
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-12-19 11:24:55 +01:00
Lin Jen-Shin 0ff27ce059
Method `create_from_defaults` will never give nil 2018-12-19 11:24:54 +01:00
Rémy Coutable 71672dfa6a
Return an ApplicationSetting in CurrentSettings
This replaces the use of fake_application_settings with
`::ApplicationSetting.build`_from_defaults. The reason is that
`fake_application_settings` doesn't have the custom accessors that
`ApplicationSetting` has, e.g. `#commit_email_hostname`, thus this
can lead to unexpected `nil` values which comes from the database
column instead of `.default_commit_email_hostname` returned by
`ApplicationSetting#commit_email_hostname`.

Using `::ApplicationSetting.build_from_defaults` should be safe as it
doesn't try to `INSERT` a DB record, in contrary to
`::ApplicationSetting.create_from_defaults` which we used to use, and
which created issues that the introduction of
`fake_application_settings` tried to resolve (575dced5).

Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-12-19 11:24:53 +01:00
Douglas Barbosa Alexandre 4a132952db
Extract a shared example for legacy and hashed storage migrations tests 2018-12-18 21:35:14 -02:00
Douglas Barbosa Alexandre 754f66113e
Backfill project_repositories for legacy storage projects
Adds a background migration that will ensure all projects that
are on legacy storage have a row in `project_repositories`.
2018-12-18 21:13:38 -02:00
Douwe Maan aa7c927e1e Merge branch 'zj-upgrade-gitaly-version' into 'master'
Upgrade Gitaly to 1.9.0

See merge request gitlab-org/gitlab-ce!23865
2018-12-18 13:50:24 +00:00
Rémy Coutable aa343d546c Merge branch 'blackst0ne-improve-encoding-helper-spec' into 'master'
Update specs to exclude possible false positive pass

Closes #55403

See merge request gitlab-org/gitlab-ce!23893
2018-12-18 08:59:21 +00:00
blackst0ne 236876f278 Update specs to exclude possible false positive pass 2018-12-18 10:21:30 +11:00
Douglas Barbosa Alexandre 279be8aaa2
Change SafeRequestStore#write to accept an options hash
This change the write to accept an options hash to make
it compatible with ActiveSupport::Cache::Store#write method.

The options hash are not passed to the underlying cache
implementation because RequestStore#write accepts only
a key, and value params.
2018-12-17 19:57:03 -02:00
James Lopez 43cc0d5a4a
Fix persistent symlink in project import
- Fix permissions after untar is done
- Refactor command line util
2018-12-17 16:14:35 +01:00
Douwe Maan 0ab50681da Merge branch '55230-remove-project-cleanup-feature-flag' into 'master'
Remove the project_cleanup feature flag

Closes #55230

See merge request gitlab-org/gitlab-ce!23814
2018-12-17 13:25:09 +00:00
Rémy Coutable 368198d8cc Merge branch 'deprecated-actiondispatch-paramsparser' into 'master'
Remove deprecated ActionDispatch::ParamsParser

See merge request gitlab-org/gitlab-ce!23848
2018-12-17 12:33:52 +00:00
Yorick Peterse e8374cb6f4 Merge branch '55433-un-revert-https-gitlab-com-gitlab-org-gitlab-ce-commit-00acef434031b5dc0bf39576a9e83802c7806842-revert' into 'master'
Resolve "Un-revert 00acef4340 revert"

Closes #55433

See merge request gitlab-org/gitlab-ce!23861
2018-12-17 12:29:20 +00:00
Ahmad Hassan d6886506a0 Merge remote-tracking branch 'origin/master' into support-gitaly-tls 2018-12-17 13:18:50 +02:00
Zeger-Jan van de Weg 50ce459118
Upgrade Gitaly to 1.9.0
This upgrade moves logic from gitlab-rails to Gitaly, which allowed code
removal too.
2018-12-17 09:26:09 +01:00
Ash McKenzie 8ce86bf9a0
Revert "Revert "LfsToken uses JSONWebToken::HMACToken by default""
This reverts commit 00acef4340.
2018-12-17 17:17:39 +11:00
Jasper Maes 56296f1eda Remove rails4 specific code 2018-12-16 10:48:41 +01:00
Jasper Maes 807139b6b9 Remove deprecated ActionDispatch::ParamsParser 2018-12-16 10:47:24 +01:00
Nick Thomas 0b74b86367
Fix repository cleanup with object storage on
When the BFG object map file is in object storage (i.e., uploads in
general are placed into object storage), we get an instance of the
Gitlab::HttpIO class. This doesn't behave as expected when you try to
read past EOF, so we need to explicitly check for this condition to
avoid ending up in a tight loop around io.read
2018-12-15 13:50:59 +00:00
Nick Thomas 8d2e1b724b Merge branch '54786-mr-empty-file-display' into 'master'
Display empty files properly on MR diffs

Closes #54786

See merge request gitlab-org/gitlab-ce!23671
2018-12-15 12:21:54 +00:00
Jasper Maes 44fef4fe4c Remove rails 4 support in CI, Gemfiles, bin/ and config/ 2018-12-14 19:36:22 +01:00
Robert Speicher 0a69dbd23d Merge branch 'fix-warnings' into 'master'
Fix warnings in tests

See merge request gitlab-org/gitlab-ce!23788
2018-12-14 16:06:10 +00:00
Kamil Trzciński 213891fa43 Merge branch 'ac-releases-name-sha-author' into 'master'
Add name, author and sha to releases

See merge request gitlab-org/gitlab-ce!23763
2018-12-14 11:53:13 +00:00
Oswaldo Ferreira ed3034bbb7 Allow suggesting single line changes in diffs 2018-12-13 19:17:19 +00:00
Alessio Caiazza b782ba1113
Add name, author and sha to releases
This commit adds a name to each release, defaulting it to tag name,
keeps track of the SHA when a new release is created and tracks the
current user as release author.
2018-12-13 12:15:21 +01:00
Kamil Trzciński 0165cfaa07 Re-define default only except policy 2018-12-13 10:39:55 +00:00
Sean Nichols ece6df18f8 Fix redundant returns in spec file 2018-12-13 02:24:31 -05:00
Semyon Pupkov 3c2a6be04d Fix warning: already initialized constant STATUSES
spec/lib/gitlab/background_migration/migrate_stage_status_spec.rb:9: warning: already initialized constant STATUSES
spec/lib/gitlab/background_migration/migrate_build_stage_spec.rb:9: warning: previous definition of STATUSES was here
2018-12-13 12:01:47 +05:00
Sean Nichols 4d2448e03a Add tests and move empty file message into own component 2018-12-13 01:49:32 -05:00
Nick Thomas 0ce7c29fb7
Update GitLab Workhorse to v8.0.0 2018-12-11 16:23:23 +00:00
Ahmad Hassan dfc54352c0 Merge remote-tracking branch 'origin/master' into support-gitaly-tls 2018-12-11 16:48:26 +02:00
Gilbert Roulot e6226e8cb3 Generalise test compare service
It adds a base class for CompareTestReportsService
containing common code with CompareLicenseManagementReportsService
which is present in GitLab Enterprise Edition.
2018-12-11 11:39:22 +01:00
Rémy Coutable f233c3bce0
Fix a frozen string error in lib/gitlab/utils.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-12-10 16:08:58 +01:00
Rémy Coutable 5c5a5992c0 Merge branch 'sh-ignore-arrays-url-sanitizer' into 'master'
Only allow strings in URL::Sanitizer.valid?

Closes #55079

See merge request gitlab-org/gitlab-ce!23675
2018-12-10 12:03:01 +00:00
Douwe Maan 5a727a4d36 Merge branch 'osw-update-mr-metrics-with-events-data' into 'master'
Populate MR metrics with events table information (migration)

Closes #41587

See merge request gitlab-org/gitlab-ce!23564
2018-12-10 09:39:07 +00:00
Stan Hu 401be1d17f Only allow strings in URL::Sanitizer.valid?
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55079
2018-12-09 07:59:54 -08:00
Matija Čupić a1be580979
Implement Command#ambiguous_ref? 2018-12-08 19:28:56 +01:00
Matija Čupić 38348aa121
Remove Gitlab::Git::Ref#full_ref 2018-12-08 19:28:55 +01:00
Matija Čupić b6c8d3ac9f
Reintroduce Command#protected_ref? 2018-12-08 19:28:54 +01:00
Matija Čupić 855e7c32b9
Use Gitlab::Git::Ref in Project#resolve_ref
Reworks Project#resolve_ref to return Gitlab::Git::Branch,
Gitlab::Git::Tag or raise an AmbiguousRef error.
2018-12-08 19:28:34 +01:00
Matija Čupić ce14c20a82
Avoid using magic variable in spec 2018-12-08 19:28:34 +01:00
Matija Čupić 2edc02143b
Prevent creating pipelines with ambiguous refs 2018-12-08 19:28:33 +01:00
Clement Ho a89b526950 Merge branch 'ce-jej/group-saml-sso-button-link-description' into 'master'
[CE] Backport SAML unlink changes: UrlBlocker#ascii_only

See merge request gitlab-org/gitlab-ce!23627
2018-12-08 03:02:18 +00:00
Stan Hu 9655a602ac Merge branch 'tc-backfill-hashed-project_repositories' into 'master'
Fill project_repositories for hashed storage projects

Closes #48527

See merge request gitlab-org/gitlab-ce!23482
2018-12-07 23:16:44 +00:00
Zeger-Jan van de Weg 896c0bdbfb
Allow public forks to be deduplicated
When a project is forked, the new repository used to be a deep copy of everything
stored on disk by leveraging `git clone`. This works well, and makes isolation
between repository easy. However, the clone is at the start 100% the same as the
origin repository. And in the case of the objects in the object directory, this
is almost always going to be a lot of duplication.

Object Pools are a way to create a third repository that essentially only exists
for its 'objects' subdirectory. This third repository's object directory will be
set as alternate location for objects. This means that in the case an object is
missing in the local repository, git will look in another location. This other
location is the object pool repository.

When Git performs garbage collection, it's smart enough to check the
alternate location. When objects are duplicated, it will allow git to
throw one copy away. This copy is on the local repository, where to pool
remains as is.

These pools have an origin location, which for now will always be a
repository that itself is not a fork. When the root of a fork network is
forked by a user, the fork still clones the full repository. Async, the
pool repository will be created.

Either one of these processes can be done earlier than the other. To
handle this race condition, the Join ObjectPool operation is
idempotent. Given its idempotent, we can schedule it twice, with the
same effect.

To accommodate the holding of state two migrations have been added.
1. Added a state column to the pool_repositories column. This column is
managed by the state machine, allowing for hooks on transitions.
2. pool_repositories now has a source_project_id. This column in
convenient to have for multiple reasons: it has a unique index allowing
the database to handle race conditions when creating a new record. Also,
it's nice to know who the host is. As that's a short link to the fork
networks root.

Object pools are only available for public project, which use hashed
storage and when forking from the root of the fork network. (That is,
the project being forked from itself isn't a fork)

In this commit message I use both ObjectPool and Pool repositories,
which are alike, but different from each other. ObjectPool refers to
whatever is on the disk stored and managed by Gitaly. PoolRepository is
the record in the database.
2018-12-07 19:18:37 +01:00
Stan Hu e17ccef5ca Merge branch 'store-correlation-logs' into 'master'
Log and pass correlation-id between Unicorn, Sidekiq and Gitaly

See merge request gitlab-org/gitlab-ce!22844
2018-12-07 15:29:00 +00:00
Douwe Maan cda291f0c3 Merge branch '48889-populate-merge_commit_sha' into 'master'
Update merge request's merge_commit after branch update

Closes #48889

See merge request gitlab-org/gitlab-ce!22794
2018-12-07 15:27:17 +00:00
Mark Chao c6c53d1c74 Fix commit with two parents is set with wrong direct_ancestor
If a commit has two parents, one is direct ancestor, and one is not,
and the order of `commits` is in such fashion that the non-ancestor
side is visited first, the commit would be determined as non-ancestor,
when in fact it can be.

Therefore we should first determine all direct ancestors
prior to analyzing.
2018-12-07 21:00:47 +08:00
Mark Chao 1f7647f446 Update merge request's merge_commit for branch update
Analyze new commits graph to determine each commit's merge commit.

Fix "merged with [commit]" info for merge requests being merged
automatically by other actions.

Allow analyzing upto the relevant commit
2018-12-07 19:24:34 +08:00
Douglas Barbosa Alexandre 8c9e692095
Fill project_repositories for hashed storage 2018-12-06 22:57:56 -02:00
Oswaldo Ferreira 4f6999fa26 Populate MR metrics with events table information (migration) 2018-12-06 22:08:38 -02:00
Toon Claes 5237a55d62
Fill project_repositories for hashed storage
This adds a background migration that will ensure all projects that
are on hashed storage have a row in `project_repositories`.

Related issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/48527
2018-12-06 21:04:41 -02:00
Jan Provaznik 239fdc78b1 Use FastDestroy for deleting uploads
It gathers list of file paths to delete before destroying
the parent object. Then after the parent_object is destroyed
these paths are scheduled for deletion asynchronously.

Carrierwave needed associated model for deleting upload file.
To avoid this requirement, simple Fog/File layer is used directly
for file deletion, this allows us to use just a simple list of paths.
2018-12-06 22:00:19 +01:00
Kamil Trzciński ebb5d9f4db Revert "Prefer to use correlation-id in logs"
This reverts commit 3560b11922.
2018-12-06 21:46:31 +01:00
Douglas Barbosa Alexandre c3bbad762d Merge branch '19376-post-bfg-cleanup' into 'master'
Allow internal references to be removed

Closes #19376

See merge request gitlab-org/gitlab-ce!23189
2018-12-06 20:43:58 +00:00
Kamil Trzciński 3560b11922 Prefer to use correlation-id in logs
This changes `correlation_id` to be `correlation-id` when passed via jobs
2018-12-06 20:49:31 +01:00
Kamil Trzciński 39c1731a53 Log and pass correlation-id between Unicorn, Sidekiq and Gitaly
The Correlation ID is taken or generated from received X-Request-ID.
Then it is being passed to all executed services (sidekiq workers
or gitaly calls).

The Correlation ID is logged in all structured logs as `correlation_id`.
2018-12-06 20:46:14 +01:00
Nick Thomas 9395d198f9
Use BFG object maps to clean projects 2018-12-06 18:58:00 +00:00
Cindy Pallares a50c777d95 Merge branch '54857-fix-templates-path-traversal' into 'master'
[master]: Prevent a path traversal attack on global file templates

Closes #2745

See merge request gitlab/gitlabhq!2677
2018-12-06 18:38:43 +00:00
Rémy Coutable 69b2a78826 Merge branch 'blob-count2' into 'master'
Support unlimited file search in web UI and API

See merge request gitlab-org/gitlab-ce!23553
2018-12-06 16:59:45 +00:00
Jan Provaznik 3720d02b8b Use approximate counts for big tables 2018-12-06 16:07:14 +00:00
James Edwards-Jones 72c0059407 Allow URLs to be validated as ascii_only
Restricts unicode characters and IDNA deviations
which could be used in a phishing attack
2018-12-06 15:18:18 +00:00
Jan Provaznik 58bfd73331 Optimized file search to work without limits
* removed 100 limit on file search results because we
  load all results anyway
* expensive processing (parsing match content, utf encoding)
  is done only for selected page in paginated output
2018-12-06 09:25:09 +01:00
Stan Hu 184240e86a Gracefully handle unknown/invalid GPG keys
An unknown public GPG key will result in a GPGME::Error thrown from gpg,
which would cause an Error 500 on the signatures endpoint.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54729
2018-12-05 10:55:30 -08:00
Kamil Trzciński 65f106d565 Merge branch '54886-usage-data-group-clusters' into 'master'
Add UsageData for group/project clusters

Closes #54886

See merge request gitlab-org/gitlab-ce!23590
2018-12-05 15:48:12 +00:00
Kamil Trzciński 13b1508c3e Merge branch '34758-deployment-cluster' into 'master'
Use group clusters when deploying (DeploymentPlatform)

See merge request gitlab-org/gitlab-ce!22308
2018-12-05 15:46:41 +00:00
Francisco Javier López a6778fc647 Rename project's pipelines relation 2018-12-05 14:39:15 +00:00
Nick Thomas 69645389e9
Prevent a path traversal attack on global file templates
The API permits path traversal characters like '../' to be passed down
to the template finder. Detect these requests and cause them to fail
with a 500 response code.
2018-12-05 14:12:35 +00:00
Dylan Griffith 821b4fdec7 Add UsageData for group/project clusters 2018-12-05 14:50:30 +01:00
Nick Thomas 61bc233ef0 Merge branch 'osw-fix-grouping-by-file-path' into 'master'
Avoid 500's when serializing legacy diff notes

Closes #54793

See merge request gitlab-org/gitlab-ce!23544
2018-12-05 13:40:24 +00:00
Kamil Trzciński fb048d2cf5 Merge branch 'mr-pipelines-2' into 'master'
Merge request pipelines

See merge request gitlab-org/gitlab-ce!23217
2018-12-05 10:32:39 +00:00
Kamil Trzciński 9a563b1b42 Merge branch 'retryable_create_or_update_kubernetes_namespace' into 'master'
Update K8s project namespace and ServiceAccount if exist

See merge request gitlab-org/gitlab-ce!23525
2018-12-05 09:28:28 +00:00
Dmitriy Zaporozhets a4ff91f794 Merge branch 'set-kubeconfig-nil-when-token-nil' into 'master'
Make KUBECONFIG nil if KUBE_TOKEN is nil

See merge request gitlab-org/gitlab-ce!23414
2018-12-05 09:13:12 +00:00
🤖 GitLab Bot 🤖 00acef4340 Revert "LfsToken uses JSONWebToken::HMACToken by default"
This reverts commit 22954f2202
2018-12-05 07:03:28 +00:00
Shinya Maeda e62bfc7817 Merge request pipelines 2018-12-05 15:57:52 +09:00
Ash McKenzie 1beb7ffc54
Add missing spec coverage for LfsToken
Added specs for #deploy_key_pushable?() and #type()
2018-12-05 15:22:43 +11:00
Ash McKenzie 22954f2202
LfsToken uses JSONWebToken::HMACToken by default
LfsToken::HMACToken#token_valid?() will be examined and if false, look
in redis via LfsToken::LegacyRedisDeviseToken#token_valid?().
2018-12-05 15:22:37 +11:00
Thong Kuah f85440e63c Various improvements to hierarchy sorting
- Rename ordered_group_clusters_for_project ->
ancestor_clusters_for_clusterable
- Improve name of order option. It makes much more sense to have `hierarchy_order: :asc`
and `hierarchy_order: :desc`
- Allow ancestor_clusters_for_clusterable for group
- Re-use code already present in Project
2018-12-05 10:16:44 +13:00
Thong Kuah 703233e1e9 Add association project -> kubernetes_namespaces
kubernetes_namespaces is not needed for project import/export as it
tracks internal state of kubernetes integration
2018-12-05 10:16:44 +13:00
Thong Kuah 5bb2814ae6 Deploy to clusters for a project's groups
Look for matching clusters starting from the closest ancestor, then go
up the ancestor tree.

Then use Ruby to get clusters for each group in order. Not that
efficient, considering we will doing up to `NUMBER_OF_ANCESTORS_ALLOWED`
number of queries, but it's a finite number

Explicitly order query by depth

This allows us to control ordering explicitly and also to reverse the
order which is useful to allow us to be consistent with
Clusters::Cluster.on_environment (EE) which does reverse ordering.

Puts querying group clusters behind Feature Flag. Just in case we have
issues with performance, we can easily disable this
2018-12-05 10:16:44 +13:00
Thong Kuah d3866fb48c Modify service so that it can be re-run
If the service fails mid-point, then we should be able to re-run this
service. So, detect presence of any previously created Kubernetes
resource and update or create accordingly.

Fix specs accordingly. In the case of finalize_creation_service_spec.rb,
I decided to stub out the async worker rather than maintaining
individual stubs for various kubeclient calls for that worker.
2018-12-05 10:16:44 +13:00
Kamil Trzciński 12a1da9402 Merge branch 'define-default-value-for-only-except-keys' into 'master'
Define the default value for only/except policies

See merge request gitlab-org/gitlab-ce!23531
2018-12-04 18:55:42 +00:00
Nick Thomas 80163b972a Merge branch 'fix/gb/encrypt-runners-tokens' into 'master'
Encrypt runners tokens

Closes #51232 and #52931

See merge request gitlab-org/gitlab-ce!23412
2018-12-04 16:48:30 +00:00
Oswaldo Ferreira 89a676019c Avoid 500's when serializing legacy diff notes 2018-12-04 13:13:22 -02:00
Shinya Maeda ad957a3f42 Define the default value for only/except policies
Currently, if a job does not have only/except policies, the policy is considered as an unspecified state, and therefore the job is executed regardless of how it's executed and which branch/tags are targetted.
Ideally, this should be specified as only: ['branches', 'tags'], as it indicates that unspecified policy jobs are meant to run on any git references.
2018-12-05 00:11:48 +09:00
Francisco Javier López 6ed50b62e7 CE port Refactor Gitlab::Checks::ChangeAccess class 2018-12-04 11:55:49 +00:00
Grzegorz Bizon 6b4926f2aa Merge commit '83f0798e7dc588f0e4cb6816daadeef7dbfc8b81' into fix/gb/encrypt-runners-tokens
* commit '83f0798e7dc588f0e4cb6816daadeef7dbfc8b81': (101 commits)
2018-12-04 09:11:33 +01:00
Thong Kuah dc18272091 Modify service so that it can be re-run
If the service fails mid-point, then we should be able to re-run this
service. So, detect presence of any previously created Kubernetes
resource and update or create accordingly.

Fix specs accordingly. In the case of finalize_creation_service_spec.rb,
I decided to stub out the async worker rather than maintaining
individual stubs for various kubeclient calls for that worker.

Also add test cases for group clusters
2018-12-04 15:46:46 +13:00
Andreas Brandl 474fd9138c
Move strategies in their own files
This improves readability quite a bit.
2018-12-03 21:26:53 +01:00
Andreas Brandl 332fe82e45
Limit some specs to PostgreSQL only. 2018-12-03 21:26:52 +01:00
Andreas Brandl 9bb7c690c4
Fix rubocop offenses. 2018-12-03 21:26:51 +01:00
Andreas Brandl 3266642739
Add feature flag for tablesample counting. 2018-12-03 21:26:51 +01:00
Andreas Brandl 3a7d9b4b02
Implement TablesampleCountStrategy.
A tablesample count executes in two phases:
* Estimate table sizes based on reltuples.
* Based on the estimate:
  * If the table is considered 'small', execute an exact relation count.
  * Otherwise, count on a sample of the table using TABLESAMPLE.

The size of the sample is chosen in a way that we always roughly scan
the same amount of rows (see TABLESAMPLE_ROW_TARGET).
2018-12-03 21:26:50 +01:00
Andreas Brandl dce4a92bb0
Finish refactoring specs.
The goal is to reflect separation of concern also in specs.
2018-12-03 21:26:50 +01:00
Andreas Brandl e5e4c6b7ed
Move things to their right scope in specs. 2018-12-03 21:26:50 +01:00
Andreas Brandl 72347448db
More specs for fallback testing. 2018-12-03 21:26:49 +01:00
Andreas Brandl 01c7cb90da
Refactor specs to separate concerns. 2018-12-03 21:26:49 +01:00
Andreas Brandl c5fb468255
Flexible approximate counts with fallback strategies. 2018-12-03 21:26:48 +01:00
Andreas Brandl b6a530c9b1
Simplify to use models instead of tables. 2018-12-03 21:26:48 +01:00
Andreas Brandl f2ec9d2d34
Add ExactCountStrategy. 2018-12-03 21:26:48 +01:00
Andreas Brandl f3a9315177
Extract ReltuplesCountStrategy. 2018-12-03 21:26:47 +01:00
Grzegorz Bizon 239a4f7264 Use plaintext token when migration is not complete 2018-12-03 14:29:51 +01:00
Shinya Maeda 4bd00e5378 Squashed commit of the following:
commit 04b06a2293fa12660a9c213a9db27fe90b83248b
Merge: d580841d4ed a445aa0a92
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Mon Dec 3 10:51:55 2018 +0900

    Merge branch 'master-ce' into fix-mr-widget-unrelated-deployment-status

commit d580841d4ed944f01e6417fa77842826843b6a04
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Nov 30 18:11:04 2018 +0900

    Add environment to all_models.yml

commit 689fbe2699a3adf10804312e680fa336e4560eaf
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Nov 30 17:00:35 2018 +0900

    Proper way to get uniq relationship

commit c0733c6ecd535a6a1b6243080a2226836890f479
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Nov 30 16:20:40 2018 +0900

    Revert build change

commit 19dc55a8fe6e0fa575858d51144516b7fb0120de
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Nov 30 16:19:18 2018 +0900

    Add uniq option

commit 0a6995f311c09b453fd0aecff2f6052de38efc27
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Fri Nov 30 16:14:30 2018 +0900

    Drop persisted_environment

commit 3f68fc783b0ee0d66e03de6d979616c4c4892118
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Nov 28 13:59:04 2018 +0900

    Return empty array if pipeline is nil

commit 73801c5c3d06339e38dce7461a71285bcdbb8f45
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Nov 27 16:34:47 2018 +0900

    Add changelog

commit d461699abf2835cc51949a5138e829628209dd6d
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Tue Nov 27 16:32:20 2018 +0900

    Squashed commit of the following:

    commit 77ab5259605e217a39b04d2cea6204277e42d2b5
    Merge: 7ac1ed50612 2ee8c40fc1
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Tue Nov 27 16:31:07 2018 +0900

        Merge branch 'master-ce' into fix-mr-widget-unrelated-deployment-status

    commit 7ac1ed50612620df6408220b0a7cfcb626a04c48
    Merge: 49ba5c5aeff b55aeca25e
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Mon Nov 26 20:01:43 2018 +0900

        Merge branch 'master-ce' into fix-mr-widget-unrelated-deployment-status

    commit 49ba5c5aeff3efee7b7498d443372021c3f4f8b5
    Merge: aa3fd0ff9e8 fbbe5ccd1b
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Mon Nov 26 15:27:36 2018 +0900

        Merge branch 'master-ce' into fix-mr-widget-unrelated-deployment-status

    commit aa3fd0ff9e8a418a233ebaa60b38c081cab50099
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Tue Nov 20 18:28:53 2018 +0900

        Fix static analysis

    commit 7afe5f37003869a73dbb297229f8533f78b82684
    Merge: e65b9580ff4 8a581d531b
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Tue Nov 20 18:27:33 2018 +0900

        Merge branch 'master-ce' into fix-mr-widget-unrelated-deployment-status

    commit e65b9580ff422359113e1a4e37c212f7b13aba4d
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Mon Nov 19 17:59:48 2018 +0900

        Ignore deployments from project import/export

    commit 9eb4ddab8415c1ef61a3c646bdc4602bcf4ebe24
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Mon Nov 19 16:26:00 2018 +0900

        Add memoization

    commit 57f0bea3aaaa07b75d18e52068c532277350cda0
    Author: Shinya Maeda <shinya@gitlab.com>
    Date:   Mon Nov 19 16:21:39 2018 +0900

        Fix unrelated deployment status in MR widget
2018-12-03 15:47:09 +09:00
Grzegorz Bizon bd45beaf20 Merge branch 'generalize-ci-config' into 'master'
ci/config: generalize Config validation into Gitlab::Config:: module

See merge request gitlab-org/gitlab-ce!23443
2018-11-30 11:25:58 +00:00
Dylan Griffith e7f2be49d8 Make KUBECONFIG nil if KUBE_TOKEN is nil
Having an invalid KUBECONFIG without a token in it is not helpful. This
only became possible recently now that we are creating a separate
namespace and service account (and hence token) to send to the runners.
This led to somewhat surprising results when troubleshooting
https://gitlab.com/gitlab-org/gitlab-ce/issues/53879 as I found that the
KUBECONFIG was still being passed but KUBE_TOKEN was not. These things
really should have been linked.

Furthermore now that we are also using the [presence of KUBECONFIG to
decide whether or not to run build steps in Auto
DevOps](294d15be3e/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml (L164))
I think it makes even more sense to ensure that KUBECONFIG is a complete
config if passed to a job.
2018-11-30 11:03:42 +01:00
Toon Claes 198fdc5478 Store hashed storage paths in the database 2018-11-29 16:08:14 +00:00
Kamil Trzciński 64b1044e7a ci/config: generalize Config validation into Gitlab::Config:: module
This decouples Ci::Config to provide a common interface for handling
user configuration files.
2018-11-29 16:09:18 +01:00
Grzegorz Bizon a7fec1779f Merge commit '6852680584a1b22788f451457a6042eabf862a73' into fix/gb/encrypt-runners-tokens
* commit '6852680584a1b22788f451457a6042eabf862a73': (57 commits)
2018-11-29 10:52:01 +01:00
Imre Farkas bd3a484032
Add config to disable impersonation
Adds gitlab.impersonation_enabled config option defaulting to true to
keep the current default behaviour.

Only the act of impersonation is modified, impersonation token
management is not affected.
2018-11-29 09:37:16 +01:00
Steve Azzopardi a9f5b22394
Merge branch 'security-11-5-fix-webhook-ssrf-ipv6' into 'security-11-5'
[11.5] Fix SSRF in project integrations

See merge request gitlab/gitlabhq!2611
2018-11-28 19:14:36 -05:00
Cindy Pallares fe5f75930e
Merge branch 'security-fix-pat-web-access' into 'master'
[master] Resolve "Personal access token with only `read_user` scope can be used to authenticate any web request"

See merge request gitlab/gitlabhq!2583
2018-11-28 19:13:59 -05:00
Cindy Pallares 4bc6f2e3ac
Merge branch 'security-stored-xss-for-environments' into 'master'
[master] Stored XSS for Environments

Closes #2727

See merge request gitlab/gitlabhq!2594
2018-11-28 19:07:29 -05:00
Grzegorz Bizon 0b8a2779e7 Merge branch 'master' into fix/gb/encrypt-runners-tokens
* master: (243 commits)

Conflicts:
	db/schema.rb
	lib/gitlab/import_export/import_export.yml
2018-11-28 13:14:04 +01:00
Douwe Maan 5e3076f2d7 Merge branch '50341-cleanup-useless-project-import-attributes' into 'master'
Removes all the irrelevant code and columns that were migrated from the Project…

See merge request gitlab-org/gitlab-ce!21497
2018-11-28 11:19:55 +00:00
Grzegorz Bizon 4c7665f2f9 Pad encryption keys with UTF-8 0 instead of \0 char 2018-11-28 12:00:17 +01:00
Toon Claes f35ff1ea48 Ensure all Routables have a parent
Or otherwise do not try to write repo config.
2018-11-27 22:48:55 +01:00
Toon Claes 4711100164 Always run CleanUp before writing the git config 2018-11-27 22:48:55 +01:00
Toon Claes 220208c051 Retry the failing projects 2018-11-27 22:48:55 +01:00
Stan Hu 6c83c2d8b9 Merge branch 'lock-trace-writes' into 'master'
Lock writes to trace stream

Closes #51502

See merge request gitlab-org/gitlab-ce!23332
2018-11-27 20:56:40 +00:00
Stan Hu 1524a19302 Merge branch '53763-fix-encrypt-columns-data-loss' into 'master'
Correctly handle data-loss scenarios when encrypting columns

Closes #53763

See merge request gitlab-org/gitlab-ce!23306
2018-11-27 19:08:53 +00:00
Nick Thomas 6ddefe7cad
Correctly handle data-loss scenarios when encrypting columns
If the EncryptColumns background migration runs in a sidekiq with a
stale view of the database schema, or when the purported destination
columns don't actually exist, data loss can result. Attempt to work
around these issues by reloading schema information before running
the migration, and raising errors if the model reports that any of its
source or destination columns are missing.
2018-11-27 18:24:18 +00:00
Filipa Lacerda a99f342b42 Merge branch 'issuable-suggestions' into 'master'
Suggest issues when typing title

Closes #22071

See merge request gitlab-org/gitlab-ce!22866
2018-11-27 17:58:27 +00:00
Kamil Trzciński 31a1ce2132 Lock writes to trace stream 2018-11-27 17:55:20 +01:00
Phil Hughes 50e21a89a0
Suggests issues when typing title
This suggests possibly related issues when the user types a title.

This uses GraphQL to allow the frontend to request the exact
data that is requires. We also get free caching through the Vue Apollo
plugin.

With this we can include the ability to import .graphql files in JS
and Vue files.
Also we now have the Vue test utils library to make testing
Vue components easier.

Closes #22071
2018-11-27 15:10:40 +00:00
Grzegorz Bizon 37add27a00 Improve token authenticable tests and exceptions 2018-11-27 14:34:05 +01:00
Dmitriy Zaporozhets fcca3f6452 Merge branch '51792-dont-delete-failed-install-pods' into 'master'
Don't remove failed install pods

Closes #51792

See merge request gitlab-org/gitlab-ce!23350
2018-11-27 13:14:51 +00:00
Tiago Botelho 4bd8a427d4
Removes all the irrelevant import related code and columns
Clears the import related columns and code from the Project
model over to the ProjectImportState model
2018-11-27 12:58:13 +00:00
Dylan Griffith 6a66e4a1f1 Don't remove failed install pods
We want to keep failed install pods around so that it is easier to debug
why a failure occured. With this change we also need to ensure that we
remove a previous pod with the same name before installing so that
re-install does not fail.

Another change here is that we no longer need to catch errors from
delete_pod! in CheckInstallationProgressService as we now catch the
ResourceNotFoundError in Helm::Api. The catch statement in
CheckInstallationProgressService was also probably too broad before and
should have been narrowed down simply to ResourceNotFoundError.
2018-11-27 12:54:32 +01:00
Douwe Maan d3f033d69c Merge branch 'bvl-use-shell-writeref' into 'master'
Don't use rugged write-ref anymore

See merge request gitlab-org/gitlab-ce!23286
2018-11-27 08:56:26 +00:00
Douwe Maan 124a0cab33 Merge branch 'sh-handle-string-null-bytes' into 'master'
Gracefully handle references with null bytes

Closes #54466

See merge request gitlab-org/gitlab-ce!23365
2018-11-27 08:54:59 +00:00
Stan Hu a0548a2277 Merge branch '8584-move-ee-specific-code-from-gitbab-database-ee-gitlab-database' into 'master'
CE port of 'Move EE specific code from Gitbab::Database into ee'

See merge request gitlab-org/gitlab-ce!23361
2018-11-26 23:25:27 +00:00
Stan Hu e36c347ff9 Gracefully handle references with null bytes
`Rugged::Reference.valid_name?` used in
`Gitlab::GitRefValidator.validate` fails on strings containing null
bytes because it uses `StringValueCStr()`. Per
https://silverhammermba.github.io/emberb/c/:

Ruby’s String kinda corresponds to C’s char*. The simplest macro is
StringValueCStr() which returns a null-terminated char* for a
String. The problem here is that a Ruby String might contain nulls - in
which case StringValueCStr() will raise an ArgumentError!

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54466
2018-11-26 14:14:16 -08:00
Stan Hu deaf3af7e5 Merge branch 'fix-deadlock-chunked-io' into 'master'
Fix deadlock on ChunkedIO

See merge request gitlab-org/gitlab-ce!23329
2018-11-26 21:16:40 +00:00
Douglas Barbosa Alexandre 5f8423dd85
CE port of 'Move EE specific code from Gitbab::Database into ee' 2018-11-26 17:14:05 -02:00
Stan Hu 95ebdf3053 Merge branch '54327-profiler-doesn-t-work-with-auth-now' into 'master'
Allow profiler to authenticate by stubbing users directly

Closes #54327

See merge request gitlab-org/gitlab-ce!23320
2018-11-26 18:46:32 +00:00
Bob Van Landuyt 67f2faa72d Don't specify `shell` for Gitaly write-ref
Use shelling out to git to write refs instead of rugged, hoping to
avoid creating invalid refs.

To update HEAD we switched to using `git symbolic-ref`.
2018-11-26 16:44:26 +01:00
Stan Hu 1c1b7a820d Merge branch 'dm-batch-loader-key' into 'master'
Batch load only data from same repository when lazy object is accessed

See merge request gitlab-org/gitlab-ce!23309
2018-11-26 13:20:49 +00:00
Kamil Trzciński c150772edb Fix deadlock on ChunkedIO 2018-11-26 13:15:46 +01:00
Grzegorz Bizon f9c6134b60 Merge branch '40260-reduce-gitaly-calls-project-pipeline-status' into 'master'
Cache project HEAD to prevent unnecessary Gitaly calls

See merge request gitlab-org/gitlab-ce!23307
2018-11-26 12:14:35 +00:00
Grzegorz Bizon bf99a58852 Merge branch 'fix-null-variables' into 'master'
Allow to store null variables

Closes #54379

See merge request gitlab-org/gitlab-ce!23299
2018-11-26 11:53:01 +00:00
Sean McGivern f1a7e7fea1 Allow profiler to authenticate by stubbing users directly
Previously, we used a personal access token. This had a couple of
problems:

1. If the user didn't have a PAT, we couldn't impersonate them.
2. It depended on reading the raw PAT from the database.

Instead, we can monkey-patch the authentication methods on
ApplicationController (overriding the Devise ones), and remove them once
we're done. This does mean that profiles will not profile auth
correctly, so for that, use a PAT directly.
2018-11-26 11:18:03 +00:00
Douwe Maan 5f0e4040ce
Batch load only data from same repository when lazy object is accessed
By specifying `key`, we get a different lazy batch loader for each
repository, which means that accessing a lazy object from one repository
will only result in that repository's objects being fetched, not those
of other repositories, saving us some unnecessary Gitaly lookups.
2018-11-26 11:15:18 +01:00
Heinrich Lee Yu 6bb1a2ab23
Update tests 2018-11-26 17:41:41 +08:00
Peter Leitzen b47a3a4085
Extract query variables into own module 2018-11-23 22:35:38 +01:00
Kamil Trzciński 9c98e2a922 Merge branch 'certmanager-temp' into 'master'
Deploy cert-manager to managed cluster for SSL certificates

See merge request gitlab-org/gitlab-ce!23036
2018-11-23 15:24:32 +00:00
Kamil Trzciński 56a01151d5 Allow to store null variables 2018-11-23 15:20:07 +01:00
Grzegorz Bizon 1143411ae8 Reduce Sidekiq signature of scheduled tokens migration 2018-11-23 13:28:29 +01:00
Grzegorz Bizon 627b4833c5 Add test case for scheduling runners tokens migration 2018-11-23 13:05:41 +01:00
Grzegorz Bizon 9ab50c86a9 Add specs for runners tokens encryption migration 2018-11-23 11:55:38 +01:00
Grzegorz Bizon d1311119fa Fix static analysis in utf8 helper methods 2018-11-23 10:03:43 +01:00
Grzegorz Bizon 777b6713bb Ensure that db encryption keys have proper bytesize 2018-11-22 15:35:49 +01:00
Sean McGivern 2bc4a17dec Merge branch 'revert-fd6e3781' into 'master'
Revert "Merge branch 'revert-e2aa2177' into 'master'"

Closes #54267

See merge request gitlab-org/gitlab-ce!23237
2018-11-22 09:50:34 +00:00
Takuya Noguchi e902f462c2 Eliminate duplicated words
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2018-11-22 01:01:23 +09:00
Grzegorz Bizon 13cfd53dd9 Add missing specs for crypto helper class 2018-11-21 14:02:17 +01:00
Robert Speicher 9fe85710f6 Merge branch '49565-ssh-push-mirroring' into 'master'
SSH public-key authentication for push mirroring

Closes #49565

See merge request gitlab-org/gitlab-ce!22982
2018-11-20 13:43:24 +00:00
Zeger-Jan van de Weg 5c131dac5e
Fix bug where ID is not set
On HEAD~ we remove the ID from the class, which created a bug. Given we
don't need the ID anymore, it has been removed and simplified.
2018-11-20 13:40:45 +01:00
Zeger-Jan van de Weg 16346eb5b9 Revert "Merge branch 'revert-e2aa2177' into 'master'"
This reverts merge request !23229
2018-11-20 12:29:56 +00:00
Amit Rathi c3bad68d1c Merge branch 'master' into certmanager-temp 2018-11-20 17:58:10 +05:30
Sean McGivern fd6e3781ba Merge branch 'revert-e2aa2177' into 'master'
Revert "Merge branch 'zj-improve-gitaly-pb' into 'master'"

See merge request gitlab-org/gitlab-ce!23229
2018-11-20 11:53:18 +00:00
Amit Rathi 2945ab47d6 Fix usage data and install command spec 2018-11-20 16:48:23 +05:30
Douwe Maan 6f0ff56ef8 Merge branch 'fix/allow-saml2-for-2fa-bypass' into 'master'
saml/auth_hash: Allow 2FA bypass for SAML 2.0 responses

See merge request gitlab-org/gitlab-ce!22568
2018-11-20 11:07:59 +00:00
Douwe Maan e65e184269 Merge branch '3062-improve-project-cache' into 'master'
Change project cache key to depend on ID instead of full path

Closes #42191

See merge request gitlab-org/gitlab-ce!23135
2018-11-20 11:03:17 +00:00
Sean McGivern 2742b871fe Revert "Merge branch 'zj-improve-gitaly-pb' into 'master'"
This reverts merge request !23140
2018-11-20 10:36:52 +00:00
Steve Azzopardi 282a5b4c84
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2018-11-20 10:11:42 +01:00
Amit Rathi 5e59c40baa Fixing more tests 2018-11-20 12:33:45 +05:30
Sean McGivern e2aa2177a7 Merge branch 'zj-improve-gitaly-pb' into 'master'
Show what RPC is called in the performance bar

See merge request gitlab-org/gitlab-ce!23140
2018-11-20 06:42:49 +00:00
Stan Hu 2e3674f7a8 Prevent templated services from being imported
Templated services should only be created by admins and does not
apply to project import/export.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54189
2018-11-19 15:41:41 -08:00
Fatih Acet b1321dedaa Merge branch 'gt-fix-typo-in-notebook-props' into 'master'
Fix typo in js (props, specs)

See merge request gitlab-org/gitlab-ce!23103
2018-11-19 21:12:07 +00:00
Amit Rathi 6196bb6a60 Fixing tests 2018-11-20 02:15:33 +05:30
Douwe Maan af1ed0e2bb Merge branch '54046-fix-by-any-email-for-private-commit-emails' into 'master'
Match users better by their private commit email

Closes #54046

See merge request gitlab-org/gitlab-ce!23080
2018-11-19 16:53:14 +00:00
Sean McGivern 69f74582aa Merge branch 'improve-variables-support' into 'master'
Improve variables support

See merge request gitlab-org/gitlab-ce!23077
2018-11-19 15:57:53 +00:00
Zeger-Jan van de Weg 4ca5eadddb
Remove duplicate tests for Gitaly
The disabling of Gitaly was basically stubbing `Feature.enabled?` call,
which was never triggered.
2018-11-19 14:40:53 +01:00
Kamil Trzciński c3bd3bfc6e Improve variables support
This ensures that variables accept only string,
alongside also improves kubernetes_namespace,
improving validation and default value being set.
2018-11-19 14:09:39 +01:00
Nick Thomas 59c4fb4ecb
Match users better by their private commit email
Private commit emails were introduced in !22560, but some parts of
GitLab were not updated to take account of them. This commit adds
support in places that were missed.
2018-11-19 12:45:07 +00:00
Nick Thomas f1bc7b6eb5
SSH public-key authentication for push mirroring 2018-11-19 11:46:39 +00:00
Gabriel Mazetto 2123b7896c Change specs to accept new cache keys for projects 2018-11-16 16:22:53 +01:00
Kamil Trzciński 5b75fcf6f2 Merge branch '49726-upgrade-helm-to-2-11' into 'master'
Resolve "Upgrade Helm Tiller Version Used By GitLab Managed Apps"

Closes #49726

See merge request gitlab-org/gitlab-ce!22693
2018-11-16 12:09:26 +00:00
Steve Azzopardi 6ac06e95e1 Merge branch '54011-all-files-named-index-have-their-content-rendered-as-if-they-were-text-files' into 'master'
Resolve "All files named `index.*` have their content rendered as if they were text files"

Closes #54011

See merge request gitlab-org/gitlab-ce!23063
2018-11-16 11:52:59 +00:00
Dylan Griffith 1244533b77 Remove unnecessary --tiller-namespace 2018-11-16 10:57:48 +00:00
Dylan Griffith 9b1a99b03d Use helm version loop instead of sleep in ClientCommand 2018-11-16 10:57:27 +00:00
Grzegorz Bizon 875bae16d0 Merge branch 'allow-to-use-glob-for-ci-changes-detection' into 'master'
Add glob for CI changes detection

See merge request gitlab-org/gitlab-ce!23128
2018-11-16 10:35:18 +00:00
Sean McGivern 85ec04eaaa Merge branch 'gt-fix-typos-in-lib' into 'master'
Fix typos in lib

See merge request gitlab-org/gitlab-ce!23106
2018-11-16 10:32:31 +00:00
Dylan Griffith fe1469e12f Upgrade helm to 2.11.0 and upgrade on every install 2018-11-16 10:22:40 +00:00
Kirill Zaitsev 9bea3c0fbb Add glob for CI changes detection 2018-11-15 22:04:47 +02:00
James Lopez 71f4ec45c0
Fix spec failure 2018-11-15 15:20:58 +01:00
Ahmad Hassan 73b3da73d6 Merge remote-tracking branch 'origin/master' into support-gitaly-tls 2018-11-15 16:19:09 +02:00
James Lopez 39451c9554 Fix trailing whitespace 2018-11-15 13:06:00 +00:00
James Lopez 5e6663a21a Update spec to use PLAIN_FILENAMES constant 2018-11-15 13:00:12 +00:00