Commit Graph

3020 Commits

Author SHA1 Message Date
Shinya Maeda 3875983205 Impprove spec by godfat suggestions 2017-09-03 23:49:10 +09:00
Shinya Maeda 1925bfd2a5 Fix spec 2017-09-03 23:49:10 +09:00
Shinya Maeda bbe967abeb Add the rest of specs 2017-09-03 23:49:10 +09:00
Robert Speicher 223849fa17 Merge branch '17849-allow-admin-to-restrict-min-key-length-and-techno' into 'master'
Add settings for minimum key strength and allowed key type

Closes #17849

See merge request !13712
2017-09-01 19:23:08 +00:00
Douwe Maan dceb2112d2 Merge branch 'bvl-validate-po-files' into 'master'
Validate PO files in static analysis

See merge request !13000
2017-09-01 14:30:43 +00:00
Douwe Maan 7d3e888d06 Merge branch '37202-revert-changes-to-signing-enabled' into 'master'
Rollback changes made to signing_enabled.

Closes #37202

See merge request !13956
2017-09-01 11:49:22 +00:00
Bob Van Landuyt 4761235f69 Validate unescaped `%` chars in PO files 2017-09-01 13:44:10 +02:00
Grzegorz Bizon fc4fb6e4d2 Change CI/CD kubernetes policy keyword to `active` 2017-09-01 13:04:08 +02:00
Tiago Botelho 37383d9a9d Rollsback changes made to signing_enabled. 2017-09-01 10:51:40 +01:00
Jacob Vosmaer (GitLab) 35acc4cbbe Make Gitaly PostUploadPack mandatory 2017-09-01 08:45:19 +00:00
Marin Jankovski 28060caa0a
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2017-09-01 09:21:18 +02:00
Dmitriy Zaporozhets 6f96ccaa7d Merge branch 'gitaly-shell-redis' into 'master'
Implement /internal/post_receive unified endpoint for PostReceive tasks

See merge request !13916
2017-09-01 06:49:28 +00:00
Zeger-Jan van de Weg 770bcf71bb
Form for setting project auto devops settings 2017-08-31 22:25:26 +02:00
Bob Van Landuyt 538104bdd1 Fetch all translation keys using a regex 2017-08-31 21:13:02 +02:00
Bob Van Landuyt abe198723d Take `nplurals` into account when validating translations. 2017-08-31 21:13:02 +02:00
Bob Van Landuyt 2c4f9b7a73 Check for newlines in different methods on TranslationEntry 2017-08-31 21:13:02 +02:00
Bob Van Landuyt f35a5d0d99 Split translation & metadata entries into classes 2017-08-31 21:13:01 +02:00
Bob Van Landuyt c6d969949e Validate the number of plurals in an entry 2017-08-31 21:13:01 +02:00
Bob Van Landuyt cdaf1072da Move detailed information of an entry into a separate class 2017-08-31 21:13:01 +02:00
Bob Van Landuyt 0fa0ed7d85 Move `PoLinter` into `Gitlab::I18n` 2017-08-31 21:13:00 +02:00
Bob Van Landuyt 49b3819477 Only perform `join_message` in `validate_variable_usage` 2017-08-31 21:13:00 +02:00
Bob Van Landuyt 1da594d39b Check newlines in translations 2017-08-31 21:13:00 +02:00
Bob Van Landuyt 973c697960 Add spec for languages without plurals 2017-08-31 21:13:00 +02:00
Douwe Maan 52ac5cf27c Merge branch '37266-nomethoderror-undefined-method-current_application_settings-build-failed-30837482' into 'master'
`current_application_settings` belongs on `Gitlab::CurrentSettings`

Closes #37266

See merge request !13955
2017-08-31 14:55:54 +00:00
Alejandro Rodríguez eaf60bb544 Implement /internal/post_receive unified endpoint for PostReceive tasks 2017-08-31 11:31:45 -03:00
Zeger-Jan van de Weg ed8f7ed671
Sort templates when fetching them
Used to rely on the underlying filesystem to sort the entries, now its
forced to be sorted on the name of the template.
2017-08-31 15:45:48 +02:00
Grzegorz Bizon ef030709eb Change kubernetes job policy allowed values
It is now possible to use `kubernetes: configured`.
2017-08-31 14:56:25 +02:00
Sean McGivern 5883ce95ef `current_application_settings` belongs on `Gitlab::CurrentSettings`
The initializers including this were doing so at the top level, so every object
loaded after them had a `current_application_settings` method. However, if
someone had rack-attack enabled (which was loaded before these initializers), it
would try to load the API, and fail, because `Gitlab::CurrentSettings` didn't
have that method.

To fix this:

1. Don't include `Gitlab::CurrentSettings` at the top level. We do not need
   `Object.new.current_application_settings` to work.
2. Make `Gitlab::CurrentSettings` explicitly `extend self`, as we already use it
   like that in several places.
3. Change the initializers to use that new form.
2017-08-31 13:38:33 +01:00
Bob Van Landuyt bde39322f1 Add a linter for PO files 2017-08-31 14:10:04 +02:00
Bob Van Landuyt b6646e778d Track the locale in Sentry so we know which ones are failing 2017-08-31 14:10:04 +02:00
Grzegorz Bizon 92673c2c63 Merge branch 'master' into feature/gb/kubernetes-only-pipeline-jobs
* master: (275 commits)
  Decrease Metrics/PerceivedComplexity threshold to 17
  Upgrade mail and nokogiri gems due to security issues
  Link out to stackoverflow answer on setting swappiness
  Document swappiness recomendations in the requirements doc
  Fix invalid attribute used for time-ago-tooltip component
  Update latest artifacts doc
  Add changelog entry for flipping verify_certificates
  Default LDAP config verify_certificates to true
  Update share project with groups docs
  remove accidental console.log from karma tests
  update specs to match reorganized monitoring components
  Remove tooltips from new sidebar
  Use `git update-ref --stdin -z` to delete refs
  Don't use public_send in destroy_conditionally! helper
  Remove unused expressions policy from ci/cd config
  Simplify code for appending strategies in CI/CD config
  Raise exception when simplifiable ci entry incomplete
  Add changelog entry
  Fix MySQL failure for emoji autocomplete
  max-width for lazy-loaded images (this was removed in the original MR through merge resolution most probably)
  ...

Conflicts:
	lib/gitlab/ci/config/entry/policy.rb
2017-08-31 14:02:52 +02:00
Sean McGivern 91a55ed6a1 Merge branch 'gitaly-440-shell-fetch-remote' into 'master'
Migrate Repository.FetchRemote to Gitaly

See merge request !13625
2017-08-31 11:08:45 +00:00
Marin Jankovski 7d38df306c
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2017-08-31 10:45:28 +02:00
Kamil Trzciński a0b5684634 Merge branch 'feature/gb/add-complex-jobs-only-except-config-policy' into 'master'
New syntax for CI/CD job triggering policy that supports variables expressions

See merge request !13769
2017-08-31 07:24:57 +00:00
Douwe Maan eacda4cc98 Merge branch '36743-existing-repo-master' into 'master'
[master] Prevent project creation (blank, import or fork) when repository already exists on disk

See merge request gitlab/gitlabhq!2169
2017-08-31 07:03:12 +00:00
Hiroyuki Sato 6edeff3d9c Fix MySQL spec errors 2017-08-31 13:43:56 +09:00
Nick Thomas b84ca08e35 Address review comments 2017-08-30 20:50:44 +01:00
Nick Thomas 6847060266 Rework the permissions model for SSH key restrictions
`allowed_key_types` is removed and the `minimum_<type>_bits` fields are
renamed to `<tech>_key_restriction`. A special sentinel value (`-1`) signifies
that the key type is disabled.

This also feeds through to the UI - checkboxes per key type are out, inline
selection of "forbidden" and "allowed" (i.e., no restrictions) are in.

As with the previous model, unknown key types are disallowed, even if the
underlying ssh daemon happens to support them. The defaults have also been
changed from the lowest known bit size to "no restriction". So if someone
does happen to have a 768-bit RSA key, it will continue to work on upgrade, at
least until the administrator restricts them.
2017-08-30 20:50:44 +01:00
Nick Thomas b0f982fbdf Add settings for minimum key strength and allowed key type
This is an amalgamation of:

* Cory Hinshaw: Initial implementation !5552
* Rémy Coutable: Updates !9350
* Nick Thomas: Resolve conflicts and add ED25519 support !13712
2017-08-30 20:50:44 +01:00
Kim "BKC" Carlbäcker b77176d11a Migrate Repository.FetchRemote to Gitaly
- `Gitlab::Shell.fetch_remote` now takes a `Gitlab::Git::Repository` instead
2017-08-30 20:51:56 +02:00
Hiroyuki Sato 59e5393827 Fuzzy search issuable title or description 2017-08-31 03:14:58 +09:00
Douwe Maan d6e956d3a8 Merge branch '36807-gc-unwanted-refs-after-import' into 'master'
Remove unwanted refs after importing a project

Closes #36807

See merge request !13766
2017-08-30 18:08:37 +00:00
Douwe Maan e68a1fc1be Merge branch 'check-trigger-permissions-mysql' into 'master'
Improve migrations using triggers

Closes #36633

See merge request !13666
2017-08-30 17:55:15 +00:00
Lin Jen-Shin c5553ce772 Use `git update-ref --stdin -z` to delete refs 2017-08-30 22:01:23 +08:00
Grzegorz Bizon 1bf87d2524 Remove unused expressions policy from ci/cd config 2017-08-30 14:47:54 +02:00
Grzegorz Bizon 808fb2549b Raise exception when simplifiable ci entry incomplete 2017-08-30 13:26:11 +02:00
Yorick Peterse 8274e0fe3c Merge branch 'improve-autocomplete-user-performance' into 'master'
Improve AutocompleteController#users.json performance

Closes #36879

See merge request !13754
2017-08-30 11:17:10 +00:00
Yorick Peterse 5eab624d3c
Improve migrations using triggers
This adds a bunch of checks to migrations that may create or drop
triggers. Dropping triggers/functions is done using "IF EXISTS" so we
don't throw an error if the object in question has already been dropped.
We now also raise a custom error (message) when the user does not have
TRIGGER privileges. This should prevent the schema from entering an
inconsistent state while also providing the user with enough information
on how to solve the problem.

The recommendation of using SUPERUSER permissions is a bit extreme but
we require this anyway (Omnibus also configures users with this
permission).

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36633
2017-08-29 13:02:44 +02:00
Hiroyuki Sato 12633b46b6 Refactor 2017-08-29 18:00:03 +09:00
Hiroyuki Sato 87b51c5981 Move the logic to a concern 2017-08-29 07:14:41 +09:00
James Lopez 49495fe63d fix spec 2017-08-28 15:24:24 +02:00
Hiroyuki Sato 866aab7f2a Fix escape characters was not sanitized 2017-08-26 22:32:55 +09:00
Grzegorz Bizon 5ce9e03f6c Use new complex only/except policy internal scheme 2017-08-26 11:11:28 +02:00
Grzegorz Bizon 15ace6a910 Merge commit '2be34630623711fc20ef8c101b5cef688f207cc1' into backstage/gb/rename-ci-cd-processing-sidekiq-queues
* commit '2be34630623711fc20ef8c101b5cef688f207cc1':
  Common Docker Documentation Location in `gitlab-ce`
  fix deprecation warning present during webpack compiles
  Enable 5 lines of Sidekiq backtrace lines to aid in debugging
  Add support for copying permalink to notes via more actions dropdown
  Handle creating a nested group on MySQL correctly
  Decrease statuses batch size even more in a migration
  Fix repo editor scrollbar
  Replace 'source/search_code.feature' spinach test with an rspec analog
  Authorizations regarding OAuth - style confirmation
  Update README.md
  Refactor complicated API group finding rules into GroupsFinder
  Fix group and project search for anonymous users
  Document version Group Milestones API introduced
  Allow v4 API GET requests for groups to be unauthenticated
  Adjust a range and a size in stages statuses migration
  Update README.md
  Point to /developers on docs/administration/authentiq.md
  Indexes GFM markdown guide
  use inline links instead of referenced
  Add index on ci_runners.contacted_at
2017-08-26 10:55:20 +02:00
Gabriel Mazetto 8f178c4222 Prevent new / renamed project from using a repository path that already exists on disk
There are some redundancies in the validation steps, and that is to
preserve current error messages behavior

Also few specs have to be changed in order to fix madness in validation
logic.
2017-08-25 20:06:06 +02:00
Grzegorz Bizon 0410861171 Add specs for attributable aspect of ci config entry 2017-08-25 18:26:55 +02:00
Grzegorz Bizon 4509594e20 Fix Rubocop offense in CI/CD only/except policy class 2017-08-25 17:54:14 +02:00
Sean McGivern f92a80b42a Merge branch 'bvl-fix-mysql-bare-repository-importer' into 'master'
Handle creating a nested group on MySQL correctly

See merge request !13829
2017-08-25 15:00:35 +00:00
Grzegorz Bizon 7e6bc4dde2 Improve reporting of a CI/CD entry config location 2017-08-25 15:16:09 +02:00
Kamil Trzciński a653c8ead4 Merge branch 'master' into 'backstage/gb/rename-ci-cd-processing-sidekiq-queues'
# Conflicts:
#   db/schema.rb
2017-08-25 12:10:53 +00:00
Bob Van Landuyt 529a07bd1e Handle creating a nested group on MySQL correctly
Since we don't support nested groups on MySQL, raise an error
explaining that on import instead of trying anyway.
2017-08-25 12:35:47 +02:00
Sean McGivern 4a2cc38197 Merge branch '36939-fix-find-blobs-by-path' into 'master'
Fix searching for files by path

Closes #36939

See merge request !13798
2017-08-25 10:26:12 +00:00
Grzegorz Bizon 946e8d3a93 Use only/except policy that returns an array 2017-08-25 12:01:59 +02:00
Grzegorz Bizon a061a2461a Fix CI/CD trigger policy default value 2017-08-25 11:42:40 +02:00
Hiroyuki Sato 9e203582b3 Improve AutocompleteController#user.json performance 2017-08-25 18:41:43 +09:00
Nick Thomas fa2915ec2d Fix searching for files by path 2017-08-25 10:36:32 +01:00
Grzegorz Bizon 873460783a Add specs for a simplifiable CI/CD entry aspect 2017-08-25 11:25:37 +02:00
Grzegorz Bizon fcb4d1f809 Implement complex only/except policy CI/CD config 2017-08-25 10:27:00 +02:00
Grzegorz Bizon 8c409fc40b Make it possible to define CI/CD config strategies 2017-08-25 09:49:18 +02:00
Robert Speicher 51ceacb1fc Add missing third argument to `Git::Repository#initialize` in spec 2017-08-24 17:34:05 -04:00
Sean McGivern e46a3d2fda Merge branch 'git-operation-user' into 'master'
Move GitHooksService into Gitlab::Git

See merge request !13739
2017-08-24 14:32:17 +00:00
Grzegorz Bizon 0d7d7c1057 Use aspect-oriented design in CI/CD config entries 2017-08-24 14:54:27 +02:00
Douwe Maan 610155e063 Merge branch 'fix-old-mr-diffs' into 'master'
Fix old MR diffs

Closes #36516

See merge request !13744
2017-08-24 10:56:57 +00:00
Grzegorz Bizon 5ced2d8d7d Rename CI/CD job triggering policy class to Policy 2017-08-24 12:22:01 +02:00
Sean McGivern e8525e107d Show un-highlighted diffs when blobs are the same
For some old merge requests, we don't have enough information to figure out the
old blob and the new blob for the file. This means that we can't highlight the
diff correctly, but we can still display it without highlighting.
2017-08-24 11:11:18 +01:00
Andrew Newdigate fb49c94e49 Delegate Repository::branch_exists? and ref_exists? to Gitlab::Git 2017-08-24 09:20:04 +00:00
Douwe Maan 93ad83443a Merge branch 'sh-fix-branch-count' into 'master'
Fix inconsistent number of branches when remote branches are present

Closes #36934

See merge request !13784
2017-08-24 07:42:30 +00:00
Stan Hu 37904108b9 Fix inconsistent number of branches when remote branches are present
Users of project mirrors would see that the number of branches did not
match the number in the branch dropdown because remote branches were
counted when Rugged was in use. With Gitaly, only local branches
are counted.

Closes #36934
2017-08-23 22:07:32 -07:00
Douwe Maan c1cf5f4101 Support simple string LDAP attribute specifications, and search for name rather than username attributes 2017-08-23 22:06:22 +02:00
Jacob Vosmaer 961da7d0a7 Add tests for Committer#== 2017-08-23 17:23:28 +02:00
Sean McGivern 9ec60b5030 Merge branch 'bvl-improve-bare-project-import' into 'master'
Make the import take subgroups into account

Closes #36664 and #30546

See merge request !13670
2017-08-23 14:04:22 +00:00
Bob Van Landuyt 22ef4ba3a4 Migrate creation of nested groups into a service 2017-08-23 13:36:38 +02:00
Bob Van Landuyt d8d2b73b9f Improve bare repository import
- Allow imports into nested groups
- Make sure it sets the correct visibility level when creating new
  groups

While doing this, I moved the import into a testable class, that made
it easier to improve.
2017-08-23 13:36:37 +02:00
Sean McGivern d546f7d36e Merge branch 'gitaly-commit-patch' into 'master'
Incorporate DiffService.CommitPatch Gitaly RPC

Closes gitaly#463

See merge request !13441
2017-08-23 10:39:01 +00:00
Jacob Vosmaer bc97931e2d Fix Hook.new call sites in tests 2017-08-23 10:45:20 +02:00
Jacob Vosmaer c47b947a73 Move GitHooksService tests 2017-08-23 10:45:20 +02:00
Jacob Vosmaer dc7c6bede2 Move GitHooksService to Gitlab::Git 2017-08-23 10:45:20 +02:00
Jacob Vosmaer 65f83941c3 Make gl_repository a G::G::Repository attribute 2017-08-23 10:45:20 +02:00
Alejandro Rodríguez 258d5a50e6 Incorporate DiffService.CommitPatch Gitaly RPC 2017-08-22 16:31:59 -03:00
Robert Speicher a6fbd8648e Stub `ForkedStorageCheck.storage_available?` by default in all specs
Add `:broken_storage` metadata to examples to disable this behavior only
when necessary.
2017-08-22 13:06:25 -04:00
Sean McGivern b0f09406f5 Always return a simple diff viewer
We didn't have a fallback case before, because we believed the conditions were
exhaustive. They weren't, so we can always fallback to not previewing.
2017-08-22 14:04:54 +01:00
Grzegorz Bizon 2e91f18143 Merge branch 'master' into backstage/gb/rename-ci-cd-processing-sidekiq-queues
* master: (115 commits)
  Use event-based waiting in Gitlab::JobWaiter
  Make sure repository's removal work for legacy and hashed storages
  Use `@hashed` prefix for hashed paths on disk, to avoid collision with existing ones
  Refactor project and storage types
  Prevent using gitlab import task when hashed storage is enabled
  Some codestyle changes and fixes for GitLab pages
  Removed some useless code, codestyle changes and removed an index
  Fix repository reloading in some specs
  Changelog
  Moving away from the "extend" based factory to a more traditional one.
  Enable automatic hashed storage for new projects by application settings
  New storage is now "Hashed" instead of "UUID"
  Add UUID Storage to Project
  Move create_repository back to project model as we can use disk_path and share it
  Codestyle: move hooks to the same place and move dependent methods to private
  Use non-i18n values for setting new group-level issue/MR button text
  indexes external issue tracker
  copyedit
  indexes user/search/ from /user/index
  Correctly encode string params for Gitaly's TreeEntries RPC
  ...
2017-08-22 14:58:10 +02:00
Grzegorz Bizon 3366e38cc1 Fix indentation in migration helpers 2017-08-22 14:57:54 +02:00
Sean McGivern ce89c425fe Merge branch 'fix/import-fork-mr' into 'master'
Fix Import/Export issue to do with fork merge requests

Closes #36666

See merge request !13717
2017-08-22 11:57:06 +00:00
Douwe Maan 78a0d27e98 Merge branch '34533-inline-single-authorized-projects' into 'master'
Use an event-based system when waiting for AuthorizedProjectsWorker to complete

See merge request !13564
2017-08-22 11:05:14 +00:00
Grzegorz Bizon 193b199672 Add Sidekiq migration helpers for migrating queues 2017-08-22 12:47:20 +02:00
Nick Thomas 6e8d0b78eb Use event-based waiting in Gitlab::JobWaiter 2017-08-22 09:54:46 +01:00
James Lopez e163c83b48 fix static analysis 2017-08-22 09:42:24 +02:00
James Lopez ac53067b64 fix specs 2017-08-22 08:59:01 +02:00
Robert Speicher 539ed0a637 Merge branch 'gitaly-tree-entries-encoding' into 'master'
Correctly encode string params for Gitaly's TreeEntries RPC

Closes #36720

See merge request !13724
2017-08-21 22:22:37 +00:00
Robin Bobbitt 62ef67acc3 Hide read_registry scope when registry is disabled on instance 2017-08-21 18:13:32 -04:00
Robert Speicher 367d3d9704 Merge branch 'only-limit-fetch-when-requested' into 'master'
Only require sidekiq-limit_fetch when enabled in settings

Closes #36253

See merge request !13715
2017-08-21 19:26:12 +00:00
Alejandro Rodríguez b7ebb447d7 Correctly encode string params for Gitaly's TreeEntries RPC 2017-08-21 15:13:40 -03:00
James Lopez fb9bd552c9 Fix fork MRs importing issue 2017-08-21 16:39:28 +02:00
Sean McGivern 0db5f576fe Only require sidekiq-limit_fetch when enabled in settings
This gem allows Sidekiq jobs to be throttled. Unfortunately, it has a
side-effect: when we haven't enabled job throttling, it will still hit Redis a
lot (and miss, because nothing is configured).

As this setting already required a restart, ensure that the library is only
required when it's enabled.
2017-08-21 12:56:22 +01:00
Kamil Trzciński e00e62c2c8 Merge branch 'backstage/gb/migrate-stages-statuses' into 'master'
Migrate CI/CD stages statuses

Closes #33453

See merge request !12584
2017-08-21 11:47:44 +00:00
Douwe Maan d6547ce0e7 Merge branch 'gitaly-annotations-update' into 'master'
Gitlab::Git deletions and simplifications

See merge request !13640
2017-08-21 11:45:35 +00:00
Robert Speicher 5b37f21bf2 Reduce duplication in GitAccess spec around error messages
- Adds a new `ProjectMovedError` class to encapsulate that error
  condition. Inherits from `NotFoundError` so existing rescues should
  continue to work.
- Separating that condition out of `NotFoundError` allowed us to
  simplify the `raise_not_found` helper and avoid repeating the literal
  string.
- Spec makes use of `ERROR_MESSAGES` hash to avoid repeating literal
  error message strings.
2017-08-18 15:16:54 -04:00
Robert Speicher bb40f4ab6e Greatly reduce test duration for git_access_spec
- Combine multiple `it` blocks into one where it made sense
- Use `set` for the top-level User record
- Refactor permission matrix tests
2017-08-18 15:16:54 -04:00
Jacob Vosmaer faaed0aa1f Delete unused Gitlab::Git methods 2017-08-18 14:12:17 +02:00
Sean McGivern 34a859ee2a Fix MR diffs background migration when file modes are missing
Guess the modes based on the following:

1. If the file didn't exist, it's zero.
2. If the diff contains 'Subproject commit', it might be a submodule, so 0600.
3. Otherwise, it's 0644.

This isn't perfect, but it doesn't have to be - it won't change file modes in
the repository.
2017-08-18 13:02:30 +01:00
Sean McGivern 133c72ae42 Merge branch 'gitaly_ref_exists' into 'master'
Client Implementation: RefService::RefExists

Closes gitaly#452

See merge request !13528
2017-08-18 10:20:50 +00:00
Douwe Maan cc543b6c85 Merge branch '36041-notification-title' into 'master'
Don't escape html entities in InlineDiffMarkdownMarker

Closes #36041

See merge request !13553
2017-08-18 08:50:59 +00:00
Andrew Newdigate aaa887feba Client Implementation: RefService::RefExists 2017-08-18 09:43:58 +01:00
Jarka Kadlecova c271fdc80f Don't escape html entities when rich == raw line 2017-08-17 19:55:07 +02:00
Alejandro Rodríguez c463a83405 Incorporate RepositoryService.ApplyGitattributes Gitaly RPC 2017-08-17 14:44:30 -03:00
Alejandro Rodríguez 0296700207 Add GitalyClient::RepositoryService specs 2017-08-17 14:40:43 -03:00
Sean McGivern c3e0f31dfb Merge branch 'backstage/gb/migrations-tests-schema-version' into 'master'
Improve migrations / background migrations testing strategy

Closes #36303

See merge request !13589
2017-08-17 11:54:54 +00:00
Grzegorz Bizon 3a1103fd91 Add specs for stage status background migration class 2017-08-17 12:56:09 +02:00
Felipe Artur 91035871d3 Fix project import to group when there are project milestones 2017-08-17 10:40:19 +00:00
Grzegorz Bizon d1cfa79dfc Merge branch 'backstage/gb/migrations-tests-schema-version' into backstage/gb/migrate-stages-statuses
* backstage/gb/migrations-tests-schema-version:
  Migrate down before each migration unit test
  Disable db_cleaner tables caching in migrations tests
  Extend migrations testing documentation
  Make it possible to provide schema version in tests
  Migrate db schema for context in :migration specs
2017-08-17 11:59:00 +02:00
Robert Speicher ec34b2d051 Merge branch 'dm-gpg-signature-performance' into 'master'
Only create commit GPG signature when necessary

See merge request !13561
2017-08-16 18:34:55 +00:00
Douwe Maan ba7251fefd Only create commit GPG signature when necessary 2017-08-16 18:57:50 +02:00
Rémy Coutable 4e0ee10a72 Merge branch 'bvl-circuitbreaker-settings-to-avoid-failures' into 'master'
Circuitbreaker settings to avoid spec-failures

Closes #36324

See merge request !13519
2017-08-16 13:38:00 +00:00
Bob Van Landuyt ee603a0089 Allow a `failure_wait_time` of 0 for storage access
This allows testing every storage attempt after a failure. Which could
be useful for tests
2017-08-16 14:15:50 +02:00
Grzegorz Bizon 1066d8ba77 Use usual method to retrieve CI/CD stage statuses 2017-08-16 13:30:49 +02:00
Grzegorz Bizon 32d0983a4e Merge branch 'master' into backstage/gb/migrate-stages-statuses
* master: (1000 commits)
  Fix username autocomplete group name with no avatar alignment
  Fix 'Projected tags' typo in protected_tags_spec.rb
  Many Repo Fixes
  Repo Editor Fixes
  Docs: New index for permissions
  link article from CI index
  link tech articles from the landing page
  new articles come first
  fix relative link
  fix date format
  Fixed changed files dropdown not being shown
  Update publication date
  Remove deprecated field from workhorse API responses
  Fix API responses when dealing with txt files
  Make sure MySQL would not use CURRENT_TIMESTAMP
  Add two more project templates
  Allow usage of any_projects? with an Array
  Copyedit Artifactory and GitLab article
  Rename Artifactory and GitLab article file
  Display GPG status loading spinner only when Ajax request is made
  ...
2017-08-16 13:18:03 +02:00
Grzegorz Bizon c76f8f3e8f Make it possible to provide schema version in tests 2017-08-16 13:05:18 +02:00
Rémy Coutable 7b68bdce15 Merge branch 'rs-trailingwhitespace-cop' into 'master'
Enable Layout/TrailingWhitespace cop and auto-correct offenses

See merge request !13573
2017-08-16 10:27:46 +00:00
Rémy Coutable 1b46a8360e Merge branch '34643-fix-project-path-slugify' into 'master'
Fix CI_PROJECT_PATH_SLUG slugify

Closes #34643

See merge request !13350
2017-08-16 10:10:24 +00:00
Douwe Maan 765b183168 Merge branch 'rs-redis-config-paths' into 'master'
Don't depend on `Rails` for Redis configuration file paths

Closes #36514

See merge request !13575
2017-08-16 09:54:06 +00:00
Douwe Maan e254014d3d Merge branch '34533-speed-up-project-creation' into 'master'
Speed up project creation by inlining repository creation

Closes #34533

See merge request !13529
2017-08-16 09:45:25 +00:00
Robert Speicher f5cb3ac14d Don't depend on `Rails` for Redis configuration file paths
The `Rails` object was not always available in all tasks that require
Redis access, such as `mail_room`, so the constant pointing to the
configuration path was never defined, but we still attempted to access
it in `config_file_name`, resulting in a `NameError` exception.

Further, there was no benefit to defining these paths in a constant to
begin with -- they're only accessed in one place, and it was within the
class where they were being defined. We can just provide them at
run-time instead.

Further _still_, we were calling `File.expand_path` on the absolute path
returned by `Rails.root.join`, which was rather pointless.
2017-08-15 15:08:56 -04:00
Robert Speicher 4edfad9678 Enable Layout/TrailingWhitespace cop and auto-correct offenses 2017-08-15 13:44:37 -04:00
Nick Thomas 5fc871381a Speed up project creation by inlining repository creation 2017-08-15 18:33:07 +01:00
Douwe Maan 97b768508c Merge branch 'workhorse-deprecate-gitaly-address' into 'master'
Remove deprecated field from workhorse API responses

See merge request !13567
2017-08-15 15:56:02 +00:00
Jacob Vosmaer 4405c8e393 Remove deprecated field from workhorse API responses 2017-08-15 16:39:31 +02:00
Z.J. van de Weg 6391406774
Add two more project templates
Related to !13108. Mostly this is just running the rake task and
changing the task a bit to catch cases like the project already existing
or so. The rake task moves archives to the vendor/project_template
directory, which are checked in too.
2017-08-15 12:55:54 +02:00
Douwe Maan 0da644072f Merge branch 'malformed-submodule' into 'master'
Handle missing .gitmodules when getting submodule urls

See merge request !13509
2017-08-15 09:00:44 +00:00
vanadium23 e99444bb2d Fix CI_PROJECT_PATH_SLUG slugify 2017-08-15 08:22:56 +03:00
Douwe Maan a64760d6d0 Merge branch 'gitaly-404-commit-list-files' into 'master'
Migrate `Git::Repository.ls_files` to Gitaly

Closes gitaly#404

See merge request !13302
2017-08-14 15:44:36 +00:00
Dmitriy Zaporozhets 725b383718 Merge branch 'fix/thread-safe-gpgme-tmp-directory' into 'master'
Fix: Thread safe GPGME tmp directory

Closes #35986

See merge request !13481
2017-08-14 13:38:43 +00:00
Alexis Reigel edcc488b75 use mutex for keychain interaction
setting of the gpg home directory is not thread safe, as the directoy
gets stored on the class.

if multiple threads change the directory at the same time, one of the
threads will be working in the wrong directory.
2017-08-14 12:57:56 +02:00
Jacob Vosmaer d9b6fd4fba Handle missing .gitmodules when getting submodule urls 2017-08-14 10:53:02 +02:00
Douwe Maan 9419d10e86 Merge branch 'bvl-rollback-renamed-system-namespace' into 'master'
Don't rename system when migrating from 9.x -> 9.4

Closes #35525 and #36148

See merge request !13228
2017-08-14 07:39:52 +00:00
Robert Speicher f8fa7a050e Merge branch 'feature/migrate-force-push-check-to-gitaly' into 'master'
Migrate force push check to Gitaly

See merge request !13406
2017-08-11 20:43:25 +00:00
Ahmad Sherif daa0137b41 Migrate force push check to Gitaly 2017-08-11 19:42:17 +02:00
Robert Speicher 5896d1b1e6 Merge branch '32004-use-timecop-safe-mode' into 'master'
Enable Timecop safe mode

Closes #32004

See merge request !13498
2017-08-11 16:59:37 +00:00
Bob Van Landuyt 2ea8442ff3 Move the personal snippet uploads from `system` to `-/system`
Update the markdown unconditionally since the move might have been
done before, but the markdown not updated.
2017-08-11 18:17:45 +02:00
Sean McGivern 2a4304aea7 Merge branch 'rc/32308-rspec-retry-hack' into 'master'
Detect and keep track of flaky specs

See merge request !13021
2017-08-11 14:59:17 +00:00
Sean McGivern e80a893ff0 Merge branch 'split-events-into-push-events' into 'master'
Use a separate table for storing push events

See merge request !12463
2017-08-11 14:40:03 +00:00
Rémy Coutable 8f8fd34231 Use a new RspecFlakyListener to detect flaky specs
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-11 14:55:10 +02:00
Rémy Coutable 1b413bd62f Enable Timecop safe mode
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-11 14:53:17 +02:00
Yorick Peterse c62ae6cfd7 Merge branch '36328-deserializemergerequestdiffsandcommits-fails-due-to-null-too_large-column-9-5-rc1' into 'master'
Fix merge request diff deserialisation when too_large was absent

Closes #36328

See merge request !13500
2017-08-11 12:23:15 +00:00
Sean McGivern d2315054e6 Fix merge request diff deserialisation when too_large was absent
Not all diffs in st_diffs had the too_large attribute set at all, but the column
is non-nullable. Explicitly cast to boolean to avoid that problem.
2017-08-11 11:58:36 +01:00
Alexis Reigel 6cd9888f6f store gpg return directory locally 2017-08-11 08:38:42 +02:00
Robert Speicher c8b802471b Enable the RSpec/HookArgument cop and auto-correct offenses 2017-08-10 19:29:42 -04:00
Stan Hu ad3c1573a5 Merge branch 'jej/security-release-2017-08-10' into 'master'
Security release 2017-08-10 patch

See merge request !13477
2017-08-10 22:47:38 +00:00
James Edwards-Jones b296921681 Merge branch 'rs-alphanumeric-ssh-params' into 'security-9-4'
Ensure user and hostnames begin with an alnum character in UrlBlocker

See merge request !2138
2017-08-10 20:47:28 +01:00
James Edwards-Jones 334915d508 Merge branch 'import-symlinks-9-3' into 'security-9-3'
Fix file disclosure via hidden symlinks using the project import (9.3)

See merge request !2164
2017-08-10 20:42:01 +01:00
Yorick Peterse aac1de46c9
Use a specialized class for querying events
This changes various controllers to use the new EventCollection class
for retrieving events. This class uses a JOIN LATERAL query on
PostgreSQL to retrieve queries in a more efficient way, while falling
back to a simpler / less efficient query for MySQL.

The EventCollection class also includes a limit on the number of events
to display to prevent malicious users from cycling through all events,
as doing so could put a lot of pressure on the database.

JOIN LATERAL is only supported on PostgreSQL starting with version 9.3.0
and as such this optimisation is only used when using PostgreSQL 9.3 or
newer.
2017-08-10 17:45:49 +02:00
Yorick Peterse 0395c47193
Migrate events into a new format
This commit migrates events data in such a way that push events are
stored much more efficiently. This is done by creating a shadow table
called "events_for_migration", and a table called "push_event_payloads"
which is used for storing push data of push events. The background
migration in this commit will copy events from the "events" table into
the "events_for_migration" table, push events in will also have a row
created in "push_event_payloads".

This approach allows us to reclaim space in the next release by simply
swapping the "events" and "events_for_migration" tables, then dropping
the old events (now "events_for_migration") table.

The new table structure is also optimised for storage space, and does
not include the unused "title" column nor the "data" column (since this
data is moved to "push_event_payloads").

== Newly Created Events

Newly created events are inserted into both "events" and
"events_for_migration", both using the exact same primary key value. The
table "push_event_payloads" in turn has a foreign key to the _shadow_
table. This removes the need for recreating and validating the foreign
key after swapping the tables. Since the shadow table also has a foreign
key to "projects.id" we also don't have to worry about orphaned rows.

This approach however does require some additional storage as we're
duplicating a portion of the events data for at least 1 release. The
exact amount is hard to estimate, but for GitLab.com this is expected to
be between 10 and 20 GB at most. The background migration in this commit
deliberately does _not_ update the "events" table as doing so would put
a lot of pressure on PostgreSQL's auto vacuuming system.

== Supporting Both Old And New Events

Application code has also been adjusted to support push events using
both the old and new data formats. This is done by creating a PushEvent
class which extends the regular Event class. Using Rails' Single Table
Inheritance system we can ensure the right class is used for the right
data, which in this case is based on the value of `events.action`. To
support displaying old and new data at the same time the PushEvent class
re-defines a few methods of the Event class, falling back to their
original implementations for push events in the old format.

Once all existing events have been migrated the various push event
related methods can be removed from the Event model, and the calls to
`super` can be removed from the methods in the PushEvent model.

The UI and event atom feed have also been slightly changed to better
handle this new setup, fortunately only a few changes were necessary to
make this work.

== API Changes

The API only displays push data of events in the new format. Supporting
both formats in the API is a bit more difficult compared to the UI.
Since the old push data was not really well documented (apart from one
example that used an incorrect "action" nmae) I decided that supporting
both was not worth the effort, especially since events will be migrated
in a few days _and_ new events are created in the correct format.
2017-08-10 17:45:44 +02:00
Kim "BKC" Carlbäcker 7b10885046 Migrate Git::Repository.ls_files to Gitaly 2017-08-10 16:10:47 +02:00
Rémy Coutable 449a0587f6 Improve the Project factory to make `creator` defaults to namespace.owner
Also improves the `create_templates` transient attribute and use
`project.project_feature.update_columns` instead of
`project.project_feature.update_attributes!` since it's faster.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-10 09:28:58 +02:00
Jacob Vosmaer 11eda5c255 Rename RPC 'Exists' to 'RepositoryExists' 2017-08-09 18:12:29 +02:00
Rémy Coutable c946ee1282
Enable the Layout/SpaceBeforeBlockBraces cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-09 11:52:22 +02:00
Dmitriy Zaporozhets 1439115183 Merge branch 'gitaly-find-commit' into 'master'
Incorporate Gitaly's CommitService.FindCommit RPC

Closes gitaly#402

See merge request !13094
2017-08-08 14:27:22 +00:00
Lin Jen-Shin 75096f958c Make sure that we have author and committer
In case we don't have it setup in ~/.gitconfig
2017-08-08 20:35:38 +08:00
Lin Jen-Shin d831e8e1d0 Add a test to show that threshold 40 would corrupt
If we set `ENCODING_CONFIDENCE_THRESHOLD` to 40,
this test case would not pass. If we raise to 50,
this would pass.

Note that if in the future rugged didn't return
corrupt data, this would be less relevant. But still
icu recommend the threshold to be 50, we should just
stick with 50.
2017-08-08 19:10:46 +08:00
Alejandro Rodríguez 3ce6f03f14 Incorporate Gitaly's CommitService.FindCommit RPC 2017-08-07 23:33:43 -04:00
Alejandro Rodríguez e363fbf71a Move `deltas` and `diff_from_parents` logic to Gitlab::Git::Commit
This helps keep the abstraction layers simpler, and also keep the
interface of those methods consistent, in case of implementation
changes.
2017-08-07 23:33:40 -04:00
Alejandro Rodríguez c21ae07e33 Refactor Gitlab::Git::Commit to include a repository 2017-08-07 22:34:34 -04:00
Stan Hu fd40bce9cc Merge branch '31207-clean-locked-merge-requests' into 'master'
Resolve "Store MergeWorker JID on merge request, and clean up stuck merges"

Closes #31207

See merge request !13207
2017-08-08 01:47:48 +00:00
Sean McGivern f9c6ff7508 Merge branch 'backport-ee-2251' into 'master'
Backport changes in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551 to CE

Closes #21391

See merge request !13275
2017-08-07 20:04:21 +00:00
Douwe Maan 942bd5b411 Merge branch 'blob-batch-methods' into 'master'
Add Gitlab::Git::Blob.batch method

See merge request !13225
2017-08-07 19:57:25 +00:00
Robert Speicher dd3d422193 Merge branch 'github' into 'master'
Improve GitHub importer

Closes #27429

See merge request !12886
2017-08-07 19:27:42 +00:00
Sean McGivern 4c8b666893 Merge branch 'zj-project-templates' into 'master'
Allow projects to be started from a template

Closes #32420

See merge request !13108
2017-08-07 19:24:14 +00:00
Oswaldo Ferreira 0640b3d1d8 Store MergeWorker JID on merge request, and clean up stuck merges 2017-08-07 15:23:37 -03:00
Nick Thomas da5262f4e6 Backport changes in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551 to CE 2017-08-07 19:17:11 +01:00
Paweł Chojnacki 746f0ec367 Add sidekiq metrics endpoint and add http server to sidekiq 2017-08-07 17:13:02 +00:00
Douglas Barbosa Alexandre 29d380b03c Set the new GitHub import as import source 2017-08-07 13:06:13 -03:00
Rémy Coutable 66e7b4cd07 Merge branch 'add-star-for-action-scope' into 'master'
add star for action scope, in order to delete image from registry

Closes #26465

See merge request !13248
2017-08-07 15:39:19 +00:00
Jacob Vosmaer 29a1c5a126 Rename 'limit' to 'blob_size_limit' 2017-08-07 16:26:50 +02:00
Z.J. van de Weg 2e6aa4f25e
After merge cleanup 2017-08-07 15:09:14 +02:00
Bob Van Landuyt 7de6f742dc Use `broken_storage` in the fs_shards_spec. 2017-08-07 13:30:11 +02:00
Filipa Lacerda 3b9012871d Merge branch 'master' into zj-project-templates
* master: (623 commits)
  Fix issues with pdf-js dependencies
  fix missing changelog entries for security release on 2017-01-23
  Update top bar issues icon
  Fix pipeline icon in contextual nav for projects
  Since mysql is not a priority anymore, test it less
  Fix order of CI lint ace editor loading
  Add container registry and spam logs icons
  Fix different Markdown styles
  Backport to CE for:
  Make new dropdown dividers full width
  Fix spec
  Fix spec
  Fix spec
  Bump GITLAB_SHELL_VERSION and GITALY_VERSION to support unhiding refs
  Add changelog
  Install yarn via apt in update guides
  Use long curl options
  fix
  Add a spec for concurrent process
  Remove monkey-patched Array.prototype.first() and last() methods
  ...
2017-08-07 11:09:50 +01:00
Douwe Maan 727b6d16e5 Merge branch 'master' into 'bvl-nfs-circuitbreaker'
# Conflicts:
#   app/models/repository.rb
#   spec/models/repository_spec.rb
2017-08-07 09:13:10 +00:00
Sean McGivern 9b21668663 Merge branch 'gitaly-renames-annotations' into 'master'
Gitaly deletions and annotations

See merge request !13280
2017-08-07 08:40:53 +00:00
Lin Jen-Shin b9a8147333 Merge remote-tracking branch 'upstream/master' into add-star-for-action-scope
* upstream/master: (184 commits)
  Fix issues with pdf-js dependencies
  fix missing changelog entries for security release on 2017-01-23
  Update top bar issues icon
  Fix pipeline icon in contextual nav for projects
  Since mysql is not a priority anymore, test it less
  Fix order of CI lint ace editor loading
  Add container registry and spam logs icons
  Fix different Markdown styles
  Backport to CE for:
  Make new dropdown dividers full width
  Fix spec
  Fix spec
  Fix spec
  Bump GITLAB_SHELL_VERSION and GITALY_VERSION to support unhiding refs
  Add changelog
  Install yarn via apt in update guides
  Use long curl options
  fix
  Add a spec for concurrent process
  Remove monkey-patched Array.prototype.first() and last() methods
  ...
2017-08-07 16:19:28 +08:00
Tim Zallmann 9b93508028 Merge branch '27616-fix-contributions-graph-utc-offset-mysql' into 'master'
Fix Timezone Inconsistencies in User Contribution Calendar

Closes #27616 and #1943

See merge request !13208
2017-08-06 05:57:49 +00:00
Bob Van Landuyt 4b34720c0c Use ruby's `File.stat` to check storage availability 2017-08-04 15:38:50 +02:00
Bob Van Landuyt 0dd4c306ca Only track accessibility once 2017-08-04 15:38:50 +02:00
Bob Van Landuyt 022c38e63e Use `keys` instead of `scan_each` 2017-08-04 15:38:49 +02:00
Bob Van Landuyt 3899d07f9e Move hostname to Gitlab::Environment 2017-08-04 15:38:49 +02:00
Bob Van Landuyt 0fa94a0ddd Make sure the check works for paths with spaces. 2017-08-04 15:38:49 +02:00
Bob Van Landuyt 3598e60bf2 Add a Circuitbreaker for storage paths 2017-08-04 15:38:48 +02:00
Ahmad Sherif 03440eed20 Migrate blame loading to Gitaly
Closes gitaly#421
2017-08-03 19:20:46 +02:00
Robert Speicher 8f9b658e3a Merge branch 'feature/migrate-count-commits-to-gitaly' into 'master'
Migrate Gitlab::Git::Repository#count_commits to Gitaly

Closes gitaly#415

See merge request !13121
2017-08-03 15:25:03 +00:00
Rémy Coutable 2a73be5161 Merge branch 'merge-request-commits-background-migration' into 'master'
Merge request commits background migration

See merge request !12685
2017-08-03 14:41:58 +00:00
Jacob Vosmaer 3a8f4a3460 Remove unnecessary 'raw' alias 2017-08-03 15:52:14 +02:00