Commit Graph
639 Commits
Author SHA1 Message Date
Paco Guzman 90dc6f1211 Instrument Rinku usage 2016-07-04 12:20:57 +02:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Paco Guzman 521454831e Metrics for Rouge::Plugins::Redcarpet and Rouge::Formatters::HTMLGitlab 2016-07-01 12:34:28 +02:00
Eric K IdemaandRémy Coutable 12aa1f898d Import from Github using Personal Access Tokens.
This stands as an alternative to using OAuth to access a user's Github
repositories.  This is setup in such a way that it can be used without OAuth
configuration.

From a UI perspective, the how to import modal has been replaced by a full
page, which includes a form for posting a personal access token back to the
Import::GithubController.

If the user has logged in via GitHub, skip the Personal Access Token and go
directly to Github for an access token via OAuth.
2016-06-30 18:48:17 +02:00
Douwe Maan 8a245b80a5 Merge branch 'rack-request-trusted-proxies' into 'master'
Make Rack::Request use our trusted proxies when filtering IP addresses

## What does this MR do?

This allows us to control the trusted proxies while deployed in a private network.

## Are there points in the code the reviewer needs to double check?

If we want to limit what is impacted, we can do this specifically for the rack_attack request object.

## Why was this MR needed?

Normally Rack::Request will trust all private IPs as trusted proxies, which can cause problems if your users are connection on you network via private IP ranges.
    
Normally in a rails app this is handled by action_dispatch request, but rack_attack is specifically using the Rack::Request object instead.

## What are the relevant issue numbers?

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17550

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [ ] ~~API support added~~
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)


\cc @stanhu

See merge request !4958
2016-06-30 15:37:16 +00:00
DJ Mountney 860785f007 Make Rack::Request use our trusted proxies when filtering IP addresses
This allows us to control the trusted proxies while deployed in a private network. Normally Rack::Request will trust all private IPs as trusted proxies, which can caue problems if your users are connection on you network via private IP ranges.

Normally in a rails app this is handled by action_dispatch request, but rack_attack is specifically using the Rack::Request object instead.
2016-06-29 21:19:55 -07:00
Alejandro Rodríguez 20b9bb2029 Create (if necessary) and link the gitlab-shell secret file on the rake install task 2016-06-29 22:30:33 -04:00
Alejandro Rodríguez 86359ec854 Refactor repository paths handling to allow multiple git mount points 2016-06-29 22:30:31 -04:00
Grzegorz Bizon 28bafd5354 Enable Style/SpaceAfterComma Rubocop cop 2016-06-29 15:23:44 +02:00
Stan Hu 3fe7ee7a19 Merge branch 'add-smtp-setting' into 'master'
Add SMTP as default delivery method to match gitlab-org/omnibus-gitlab!826

Something happened after upgrading to 8.9RC5 that caused mail settings to be set to sendmail by default. gitlab-com/infrastructure#128 describes the issue in more detail. This MR mirrors the change in omnibus with gitlab-org/omnibus-gitlab!826.

Closes #19132

See merge request !4915
2016-06-24 19:01:17 +00:00
Stan Hu 21a1fc436f Add SMTP as default delivery method to match gitlab-org/omnibus-gitlab!826
Closes #19132

[ci skip]
2016-06-24 11:56:52 -07:00
Rémy Coutable 5d174ee546 Merge branch 'health-check-disable-email' into 'master'
Disable the email checking part of the standard Health Check

## What does this MR do?
    
In order to fix it we have overwritten the email_configured? method in the health check so that it does not check email status during the standard health check.

## Why was this MR needed?

The email check used in the Heath Check doesn't properly make use of enough of the SMTP config options to be able to properly test the STMP connection, and as a result could cause a failure.

## What are the relevant issue numbers?

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17742

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [x] ~~API support added~~
- Tests
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !4903
2016-06-24 16:31:23 +00:00
DJ Mountney 4cfb1af0b7 Set the health_check mailer full checks to be the same as the standard checks
There was nothing additional in the full checks that we want to run (email, custom)
2016-06-24 08:47:08 -07:00
DJ Mountney 59b5bb0334 Disable the email checking part of the standard Health Check
The email check used in the Heath Check doesn't properly make use of enough of the SMTP config options
to be able to properly test the STMP connection, and as a result could cause a failure.

In order to fix it we have overwritten the email_configured? method in the health check
so that it does not check email status during the standard health check.
2016-06-24 07:33:04 -07:00
Yorick Peterse d470f3d195 Support for rendering/redacting multiple documents
This commit changes the way certain documents are rendered (currently
only Notes) and how documents are redacted. Previously both rendering
and redacting would run on a per document basis. The result of this was
that for every document we'd have to run countless queries just to
figure out if we could display a set of links or not.

This commit changes things around so that redacting Markdown documents
is no longer tied into the html-pipeline Gem. This in turn allows it to
redact multiple documents in a single pass, thus reducing the number of
queries needed.

In turn rendering issue/merge request notes has been adjusted to take
advantage of this new setup. Instead of rendering Markdown somewhere
deep down in a view the Markdown is rendered and redacted in the
controller (taking the current user and all that into account). This has
been done in such a way that the "markdown()" helper method can still be
used on its own.

This particular commit also paves the way for caching rendered HTML on
object level. Right now there's an accessor method Note#note_html which
is used for setting/getting the rendered HTML. Once we cache HTML on row
level we can simply change this field to be a column and call a "save"
whenever needed and we're pretty much done.
2016-06-24 11:46:39 +02:00
Connor Shea 262f902d9a Restrict hamlit version, remove coffeescript filters. 2016-06-23 15:54:23 -06:00
connorshea 80f576bb8a Replace Haml with Hamlit.
Hamlit is a library that's faster than Haml while implementing most of its features: https://github.com/k0kubun/hamlit

Not sure if this breaks anything, but as far as I can tell most things work the same. No obvious regressions that I've been able to find.
2016-06-22 16:09:51 -06:00
James Lopez 8888dfaa8f add missing import source 2016-06-21 13:35:37 +02:00
Rémy Coutable 3cb1e96ef6 Avoid autoload issue such as 'Mail::Parsers::AddressStruct'
By eager-loading the Mail gem in the Sidekiq initializer.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-20 12:43:29 +02:00
Douwe Maan 9b7fd74805 Merge branch 'feature/project-export' into 'master'
Export project functionality

This is a MR for the export functionality of https://gitlab.com/gitlab-org/gitlab-ce/issues/3050, which adds the ability to export single projects.

- [x] members
- DB data
  - [x] issues
  - [x] issue comments
  - [x] merge requests
  - [x] merge request diff
  - [x] merge request comments
  - [x] labels
  - [x] milestones
  - [x] snippets
  - [x] releases
  - [x] events
  - [x] commit statuses
  - [x] CI builds
- File system data
  - [x] Git repository
  - [x] wiki
  - [x] uploads
  - [ ] ~~CI build traces~~
  - [ ] ~~CI build artifacts~~
  - [ ] ~~LFS objects~~
- DB configuration
  - [x] services
  - [x] web hooks
  - [x] protected branches
  - [x] deploy keys
  - [x] CI variables
  - [x] CI triggers

See merge request !3114
2016-06-17 15:35:27 +00:00
James Lopez b3a0a1c315 fixed merge conflicts on UI branch 2016-06-16 15:01:27 +02:00
Sean McGivern 5eb9cb68f7 Fix images in emails 2016-06-16 11:47:01 +01:00
Douwe Maan 8249fdcd47 Merge branch '18451-track-new-redis-connections' into 'master'
Resolve "Track the number of new Redis connections per transaction"

## What does this MR do?

Add a new metric counter, `new_redis_connections`, that contains the number of calls to `Redis::Client#connect` in the current transaction.

## Are there points in the code the reviewer needs to double check?

Not sure. I tested this in kind of a brute-force way:

1. Add a debugger in the monkey-patched `connect` method.
2. With metrics enabled, start the app and load a page.
3. The first Redis connection is created by `Rack::Attack` and isn't in a transaction, but still works fine.
4. The second Redis connection is within a transaction (the page load), and increments the counter.
5. If I reload the page, neither debugger is hit.
6. If I use a Redis client and do `CLIENT KILL` on my two existing clients, then reload the page, I get 3 and 4 again.
7. If I disable metrics collection, the debugger never gets hit.

## Why was this MR needed?

We may have a Redis connection leak somewhere, so adding metrics will let us track this.

## What are the relevant issue numbers?

Closes #18451.

## Screenshots (if relevant)

Hahaha nope, not relevant.

## Does this MR meet the acceptance criteria?

- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- [ ] Tests
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

cc @yorickpeterse 

See merge request !4649
2016-06-15 09:56:42 +00:00
James Lopez bacd2c4fa0 some refactoring - renaming things, etc.. 2016-06-15 09:03:54 +02:00
James Lopez 36ccaca35a project export archiver 2016-06-14 22:11:21 +02:00
Sean McGivern 3582c6aedc Track new Redis connections
Increment the counter `new_redis_connections` on each call to
`Redis::Client#connect`, if we're in a transaction.
2016-06-14 16:41:17 +01:00
Yorick Peterse f558bf0de4 Merge branch '18527-instrument-private-methods' into 'master'
Instrument private methods and instance private methods

See merge request !4639
2016-06-14 14:28:40 +00:00
Paco Guzman dadc531353 Instrument private/protected methods
By default instrumentation will instrument public,
protected and private methods, because usually
heavy work is done on private method or at least
that’s what facts is showing
2016-06-14 15:17:51 +02:00
Kamil Trzcinski 1b62b86fdd Merge remote-tracking branch 'origin/master' into artifacts-expire-date 2016-06-14 11:38:44 +02:00
Douwe Maan 1cbd5c6686 Merge branch 'gitlab-auth-method-names' into 'master'
Improve Gitlab::Auth method names

Auth.find was a very generic name for a very specific method.
Auth.find_in_gitlab_or_ldap was inaccurate in GitLab EE where it also
looks in Kerberos.


See merge request !4589
2016-06-13 18:05:53 +00:00
Kamil Trzcinski f6de5937e3 Merge remote-tracking branch 'origin/master' into artifacts-expire-date 2016-06-13 16:05:30 +02:00
Kamil TrzcinskiandPhil Hughes cf9c5b54c6 Added documentation to artifacts expire 2016-06-13 11:09:19 +01:00
Kamil TrzcinskiandPhil Hughes 4e9e4e22af Enable exceptions on ChronicDuration 2016-06-13 11:03:30 +01:00
Kamil TrzcinskiandPhil Hughes ffe8dbde9b Move keep to ArtifactsController 2016-06-13 11:03:30 +01:00
Yorick Peterse ffd316483c Instrument all Banzai::ReferenceParser classes
Now that this code is no longer part of Banzai::Filter it needs to be
instrumented explicitly.
2016-06-13 12:03:25 +02:00
Kamil TrzcinskiandPhil Hughes aea4041ce9 Allow to expire build artifacts 2016-06-13 11:01:19 +01:00
Jacob Vosmaer 0e896ffe4e Improve Gitlab::Auth method names
Auth.find was a very generic name for a very specific method.
Auth.find_in_gitlab_or_ldap was inaccurate in GitLab EE where it also
looks in Kerberos.
2016-06-10 14:51:16 +02:00
Jacob Vosmaer bebe110dff Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into git-http-controller
Conflicts:
	lib/gitlab/workhorse.rb
2016-06-08 10:31:33 +02:00
Alejandro Rodríguez d485ec9f1c Instrument RepositoryCheck::SingleRepositoryWorker manually
This worker is called manually by `RepositoryCheck::BatchWorker` meaning it's not tracked automatically by the Sidekiq middleware.
2016-06-07 12:10:55 -04:00
Z.J. van de Weg 9d491712cf Merge branch 'master' into awardables 2016-06-03 15:20:11 +02:00
Jacob Vosmaer fea591e5c5 Rename finder to find_in_gitlab_or_ldap 2016-06-02 13:42:18 +02:00
Jacob Vosmaer 8299fc277d Merge branch 'master' into git-http-controller
Conflicts:
	config/routes.rb
2016-06-02 13:31:11 +02:00
Robert Speicher 7d33fba7af Merge branch 'upgrade-devise-two-factor' into 'master'
Upgrade devise, devise-two-factor, and attr_encrypted

Devise 4 includes support for Rails 5, working towards #14286. devise-async doesn't support Devise 4.0 and in 4.1 the bug that was blocking using Devise's built-in ActiveJob integration was fixed. So devise-async is removed. devise-two-factor 3.0.0 is required for Devise 4 support.

attr_encrypted and encryptor are optional but recommended upgrades for devise-two-factor 3.0.0. The mode and algorithm will need to be changed in order to update to attr_encrypted 4.x in the future.

See merge request !4216
2016-06-02 00:44:41 +00:00
Rémy Coutable 46ac3107a4 Merge branch 'issue_15557' into 'master'
Fix error 500 when sorting issues by milestone due date and filtering by labels

fixes #15557 

See merge request !4327
2016-06-01 08:42:36 +00:00
Felipe Artur 56f3b243ce Add leading comment space cop 2016-05-31 19:33:46 -03:00
Connor Shea d47b2b92c9 Upgrade devise and devise-two-factor, remove devise-async
Devise (3.5.4 => 4.1.1) Changelog:
https://github.com/plataformatec/devise/blob/master/CHANGELOG.md

devise-two-factor (2.0.1 => 3.0.0) Changelog:
https://github.com/tinfoil/devise-two-factor/blob/master/CHANGELOG.md

These are reliant on each other, so they have to be upgraded together.

devise-async is no longer necessary as Devise 4.1 fixes a bug with the
ActiveJob integration.
2016-05-30 13:51:21 -06:00
Robert Speicher e7586cfbdc Merge branch 'rubocop/enable-negatedif-style-cop' into 'master'
Enable Style/NegatedIf Rubocop cop

Favor `unless` over `if` for negative conditions (or control flow ||).

```ruby
# bad
do_something if !some_condition
# bad
do_something if not some_condition

# good
do_something unless some_condition
# good
some_condition || do_something
```

See #17478

See merge request !4355
2016-05-30 17:59:10 +00:00
Robert Speicher 6eaf327a57 Merge branch 'rubocop/enable-redundant-parentheses-cop' into 'master'
Enable Style/RedundantParentheses rubocop cop

Checks for parentheses that seem not to serve any purpose.

See #17478 

See merge request !4361
2016-05-30 17:20:56 +00:00
ZJ van de Weg cbd7801b3d Merge branch 'master' into awardables 2016-05-30 18:54:08 +02:00
Grzegorz Bizon c370dce01c Enable Style/RedundantParentheses rubocop cop
See #17478
2016-05-30 15:07:18 +02:00