Commit Graph

1959 Commits

Author SHA1 Message Date
James Lopez d83ce65c1a fix changelog and merge 2016-05-23 09:11:21 +02:00
Grzegorz Bizon 7f9092da1e Extend comment for migrations helper MySQL fix 2016-05-22 23:31:33 +02:00
Grzegorz Bizon 2df8b48dbb Add MySQL compatibility fix in migration helpers 2016-05-22 22:44:59 +02:00
Lin Jen-Shin c64cd113cc Add ! for verify_record! because it could raise 2016-05-21 09:46:27 -07:00
Lin Jen-Shin 75415663f8 Rename handlers and introduce Handler.for 2016-05-21 09:40:08 -07:00
Lin Jen-Shin ee548b6ed0 Only set @raw for receiver, and handle the rest in execute 2016-05-20 19:03:39 -05:00
Lin Jen-Shin 32eae15f2f It's for Message-ID so it should be message_id 2016-05-20 18:23:04 -05:00
Lin Jen-Shin c2bc15a766 Use the authentication_token for finding the user 2016-05-20 17:38:08 -05:00
Douwe Maan ec86644545 Merge branch 'zj-gitignore-dropdown' 2016-05-20 17:14:22 -05:00
Douwe Maan fc1910ddc5 Merge branch 'adambutler/gitlab-ce-feature/support-diff-of-issue-title-rename'
# Conflicts:
#	app/services/system_note_service.rb
2016-05-20 16:23:04 -05:00
Zeger-Jan van de Weg 79620c501d Update API and fetching task 2016-05-20 15:58:36 -05:00
Zeger-Jan van de Weg e166a8022a Backend for a gitignores dropdown 2016-05-20 15:58:36 -05:00
Douwe Maan 18ef054bc7 Merge branch '17464-backport-email-syntax-highlighting' into 'master'
Syntax-highlight diffs in push emails

![image](/uploads/8ecbabc65382214b8de63aae24f66cea/image.png)

Based on:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/151



See merge request !4147
2016-05-19 21:12:53 +00:00
Yorick Peterse c22be75794
Removed outdated comment from migration helpers 2016-05-19 12:36:02 -05:00
Robert Speicher 883e2d2187 Merge branch 'migration-helpers' into 'master'
Added helper methods for database migrations

These helpers can ultimately be used to write migrations that don't
require downtime.

See #15464 for more information.

See merge request !3860
2016-05-19 16:49:14 +00:00
Yorick Peterse 59640866ce
Remove left-over use of strip_heredoc 2016-05-19 10:04:46 -05:00
Stan Hu e9ecbd3d4e Fix warning messages with SVG ALLOWED_ELEMENTS
Eliminates "warning: already initialized constant Gitlab::Sanitizers::SVG::ALLOWED_ELEMENTS"
2016-05-19 01:35:04 -05:00
Robert Speicher 4607323e13 Merge branch 'issue_17560' into 'master'
Mask credentials from URL when the import of project has failed.

REF: #17560 

See merge request !4185
2016-05-19 03:00:01 +00:00
Rubén Dávila 0c47b68d04 Mask credentials from URL when import of project has failed. 2016-05-18 21:16:36 -05:00
Lin Jen-Shin a7c823a573 Give ProjectNotFound when the project is not readable 2016-05-18 17:57:14 -05:00
Lin Jen-Shin c337e748d3 so we use separate classes to handle different tasks 2016-05-18 17:25:45 -05:00
Rémy Coutable 5341b16fc9
Reuse existing SCSS variables
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-05-18 13:20:46 -05:00
Fatih Acet a410c7afbf Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into awardables 2016-05-18 13:20:06 -05:00
Kamil Trzciński 08fddae744 Merge branch 'docker-registry-view' into 'master'
Add container registry support

Tasks:

- [x] Merge docker/distribution authentication service: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3787
- [x] Implement Docker Registry API
- [x] Show a list of docker images in GitLab
- [x] Remove registry repository on project deletion
- [x] Support project rename, move and namespace rename
- [x] Use token when connecting the registry
- [x] Allow to delete images from GitLab
- [x] Support pushing from GitLab CI (gitlab-ci-token / $CI_BUILD_TOKEN)
- [x] Support GitLab Runner pulling for public repositories
- [ ] Support GitLab Runner pulling for private repositories
- [x] Add tests for Docker Registry API
- [x] Add tests for a views
- [x] Make texts nicer
- [x] Implement a backup support

- [ ] Create administration documentation https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4141
- [ ] Create user documentation

See merge request !4040
2016-05-18 18:19:01 +00:00
Fatih Acet bb883387f9 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into awardables
# Conflicts:
#	app/controllers/projects/merge_requests_controller.rb
#	app/models/note.rb
#	db/schema.rb
#	spec/models/note_spec.rb
2016-05-18 13:05:53 -05:00
Adam Butler 8a8b5497c5 Create DiffFilter and change SystemNoteService#change_title to use Gitlab::Diff::InlineDiff 2016-05-18 11:15:10 -05:00
Rémy Coutable f4d2a2d97b Merge branch 'fix/import-data-issue' into 'master'
Create import data in service and fix timing issues when scheduling job

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

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

See merge request !4106
2016-05-18 15:28:11 +00:00
James Lopez 4e9ce5abe2 fix typo from bad refactoring 2016-05-17 15:19:59 +02:00
Sean McGivern a9977f2b7a Syntax-highlight diffs in push emails
Based on:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/151
2016-05-17 13:23:17 +01:00
Lin Jen-Shin 3f4a6412dc We should totally cache it 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 8156475ea5 Report better errors. TODO: Enable skipped test 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 30b3443779 Now we would be validating authentication token 2016-05-16 21:27:16 +00:00
Lin Jen-Shin a065c8d5d8 Create a new issue via: incoming+group/project+AUTH_TOKEN@... 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 634c9f403b process_reply -> process_create_note; handle_reply -> process_reply 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 869de96eea bang to indicate that this method could raise an exception 2016-05-16 21:27:16 +00:00
Lin Jen-Shin aac297adba Update style as create_note 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 68b5ded056 No need to check project because:
sent_notification.project would never be nil, and
we also have already checked message_project before
entering process_create_issue.
2016-05-16 21:27:16 +00:00
Lin Jen-Shin 87ff0107c1 Raise one by one instead of if checks 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 347ee6cc91 Alloy empty reply for new issues, but not response 2016-05-16 21:27:16 +00:00
Lin Jen-Shin a61bf17fce Try to give better names 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 0e4c2b6ec4 enable Style/MethodDefParentheses and fix parentheses 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 4f5027042a Add another TODO that we need to verify identity better 2016-05-16 21:27:16 +00:00
Lin Jen-Shin 6cfd028278 Implement #3243 New Issue by email
So we extend Gitlab::Email::Receiver for this new behaviour,
however we might want to split it into another class for better
testing it.

Another issue is that, currently it's using this to parse project
identifier:

    Gitlab::IncomingEmail.key_from_address

Which is using:

    Gitlab.config.incoming_email.address

for the receiver name. This is probably `reply` because it's used
for replying to a specific issue. We might want to introduce another
config for this, or just use `reply` instead of `incoming`.

I'll prefer to introduce a new config for this, or just change
`reply` to `incoming` because it would make sense for replying to
there, too.

The email template used in tests were copied and modified from:
`emails/valid_reply.eml` which I hope is ok.
2016-05-16 21:27:16 +00:00
Kamil Trzcinski eb42f95c18 Merge remote-tracking branch 'origin/master' into docker-registry-view 2016-05-16 16:15:40 -05:00
Rémy Coutable 4f66799738 Merge branch 'wiki-fix-reloaded' into 'master'
Use the relative url prefix for links in Wiki

Retry of gitlab-org/gitlab-ce!4026

@rymai !4050 solved all other problems how it looks like. I [tested](ff01eca7b5/builds) this with ruby22

Fixes #17071 



See merge request !4131
2016-05-16 20:30:42 +00:00
Douwe Maan 5dd013f145 Merge branch 'gh-pull-requests' 2016-05-16 12:12:20 -05:00
Phil Hughes 18b361cf80 Group the contributing calendar by day
This aligns the boxes correctly with the day on the left side of the calendar
2016-05-16 12:22:17 +01:00
Pablo Carranza b9306c2e82 Add cache count metrics to rails cache 2016-05-15 19:47:41 +01:00
Douglas Barbosa Alexandre 290aa75e6f Remove branches that does exist on GitHub after PRs were imported 2016-05-13 17:55:43 -05:00
Douglas Barbosa Alexandre ebaa19c162 Fix validation method for Gitlab::GithubImport::PullRequestFormatter 2016-05-13 17:55:43 -05:00
Douglas Barbosa Alexandre 795a7ca8f1 Extract GitHub branch formatter 2016-05-13 17:55:42 -05:00
Douglas Barbosa Alexandre e001bd5e3d Import PRs where branch names were reused across PRs 2016-05-13 17:55:42 -05:00
Douglas Barbosa Alexandre 7e1f14e215 Preserve commits/diff/comments for PRs that were merged on GitHub 2016-05-13 17:55:42 -05:00
Kamil Trzcinski f4f59d0f13 Merge branch 'docker-registry' into docker-registry-view 2016-05-13 17:15:01 -05:00
Douglas Barbosa Alexandre 3b50867550 Fix spec for Gitlab::GithubImport::PullRequestFormatter 2016-05-13 16:49:27 -05:00
Douglas Barbosa Alexandre 9b4dc552cb Import pull requests from GitHub where the target branch was removed 2016-05-13 16:49:27 -05:00
Douglas Barbosa Alexandre 8532dc0d77 Import pull requests from GitHub where the source branch was removed 2016-05-13 16:49:27 -05:00
Artem Sidorenko e5c9710147 Use the relative url prefix for links in Wiki 2016-05-13 22:42:07 +02:00
Gabriel Mazetto f5a0ac0fc1 Codestyle: make sure we have space around operators 2016-05-13 04:46:56 -03:00
Robert Speicher 4735a75340 Merge branch 'deprecated-class-methods-cop' into 'master'
Enable the Rubocop DeprecatedClassMethods cop

This reports uses of `File.exists?` and `Dir.exists?`, which were both
deprecated in Ruby and will eventually be removed in favor of `.exist?`.
Also fixes all existing uses of the deprecated methods.

See merge request !4087
2016-05-12 22:41:01 +00:00
Yorick Peterse 6a29117793
Removed stray strip_heredoc from migration helpers 2016-05-13 00:11:01 +02:00
James Lopez 6a70c060fa Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into fix/import-data-issue 2016-05-12 18:39:52 +02:00
Yorick Peterse 945c5b3fe6
Removed tracking of total method execution times
Because method call timings are inclusive (that is, they include the
time of any sub method calls) this would lead to the total method
execution time often being far greater than the total transaction time.
Because this is incredibly confusing it's best to simply _not_ track the
total method execution time, after all it's not that useful to begin
with.

Fixes gitlab-org/gitlab-ce#17239
2016-05-12 15:15:45 +02:00
Yorick Peterse 36083b4d0e
Fixed styling per Rubocop pedantics 2016-05-12 13:03:55 +02:00
Yorick Peterse e867099091
Added helper methods for database migrations
These helpers can be used to perform migrations without taking down the
entire application.

For example, the method "add_column_with_default" can be used to add a
new column with a default value without locking the entire table.
2016-05-12 12:59:40 +02:00
Zeger-Jan van de Weg 2f0d89ecff Merge branch 'master' into awardables 2016-05-11 22:34:25 +02:00
James Lopez 1074980abb Merge branches 'fix/import-data-issue' and 'master' of gitlab.com:gitlab-org/gitlab-ce into fix/import-data-issue 2016-05-11 17:54:25 +02:00
Robert Speicher d526cda502 Merge branch '17270-only-generate-email-on-push-once-for-all-recipients' into 'master'
Only generate repository push email once

The repository push email can be very expensive to generate, especially
with syntax-highlighted diffs. Instead of generating the email for each
recipient, generate one email object and reset the Message-Id and To
headers for each recipient. (Cloning would also be expensive in the case
of large emails, although probably not as bad as generating from
scratch.)

Closes #17270.

See merge request !4070
2016-05-11 12:45:39 +00:00
Rémy Coutable e77a9a342e Merge branch 'casecmp-cop' into 'master'
Enable Rubocop Casecmp Performance Cop.

Also fixes the errors caused by enabling the cop.

`casecmp` is more performant than `.downcase` and `==`.

See also: https://github.com/bbatsov/rubocop/blob/master/lib/rubocop/cop/performance/casecmp.rb

See merge request !3957
2016-05-11 08:59:44 +00:00
Rémy Coutable de5ae1bf06 Merge branch 'string-replacement-cop' into 'master'
Enable the StringReplacement cop.

Also fix one use of `gsub` that would be faster as `delete`.

Use `tr` instead of `gsub` when you are replacing the same number of characters. Use `delete` instead of `gsub` when you are deleting characters.

See merge request !3960
2016-05-11 08:58:59 +00:00
Sean McGivern 5f27e26bb4 Only generate repository push email once
The repository push email can be very expensive to generate, especially
with syntax-highlighted diffs. Instead of generating the email for each
recipient, generate one email object and reset the Message-Id and To
headers for each recipient. (Cloning would also be expensive in the case
of large emails, although probably not as bad as generating from
scratch.)
2016-05-11 09:16:01 +01:00
Zeger-Jan van de Weg 7e6dcf9cd0 Merge branch 'master' into awardables 2016-05-11 08:47:04 +02:00
Connor Shea 4995302df6
Enable the StringReplacement cop.
Also fix one use of `gsub` that would be faster as `delete`.

Use `tr` instead of `gsub` when you are replacing the same number of
characters. Use `delete` instead of `gsub` when you are deleting
characters.
2016-05-10 18:34:15 -06:00
Connor Shea 377583a361
Enable Rubocop Casecmp Performance Cop.
Also fixes the errors caused by enabling the cop. casecmp is more performant than `.downcase` and `==`.
2016-05-10 18:23:25 -06:00
James Lopez 1322c981a0 create import data in service 2016-05-10 11:10:51 +02:00
Rémy Coutable f52a15e022
Revert "Merge branch 'wiki-fix' into 'master' "
This reverts commit 4cc85a58e8, reversing
changes made to 90ae445ba9.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-05-10 10:57:48 +02:00
Kamil Trzcinski 565a5e36fc Merge branch 'docker-registry' into docker-registry-view 2016-05-09 22:12:34 +03:00
Artem Sidorenko 14b36f91d9 Use the proper GitLab URL for links in Wiki 2016-05-09 11:50:23 +02:00
Stan Hu 4be77d0b05 Improve multiple branch push performance by memoizing permission checking
If you attempt to push thousands of branches at once, the 60-second timeout
will occur because GitAccess checking does a lot of work to check if the
user has permission to push to a branch. This changes does two things:

1. Instead of making 1 DB query per branch push, use a memoized list of protected branches to check
2. Memoize what permissions the user has to perform on this project

On a test of 10,000 branch pushes, this prevents gitlab-shell from hitting the 60-second
timeout.

Closes #17225
2016-05-09 01:17:14 -07:00
Connor Shea 9cc0937b3a Enable the Rubocop DeprecatedClassMethods cop
This reports uses of `File.exists?` and `Dir.exists?`, which were both
deprecated in Ruby and will eventually be removed in favor of
`.exist?`. Also fixes all existing uses of the deprecated methods.
2016-05-08 15:33:34 -06:00
Kamil Trzcinski 5196f8e993 WIP 2016-05-08 22:50:30 +02:00
Stan Hu 21d89d0286 Update SVG sanitizer to conform to SVG 1.1
Use a custom Loofah scrubber since sanitize 2.x transformers are inadequate
to handle case-sensitive SVG attributes. sanitize parses documents as HTML
instead of XML, which causes all SVG attribute names (e.g. viewBox) to be downcased.

* SVG element list: https://www.w3.org/TR/SVG/eltindex.html
* SVG attribute list: https://www.w3.org/TR/SVG/attindex.html

Closes #14555
2016-05-06 23:20:24 -07:00
Zeger-Jan van de Weg 3bdc57f0a7 Create table for award emoji 2016-05-06 10:47:11 +02:00
Robert Speicher 4fce876542 Merge branch 'fix/import-url-issues' into 'master'
Fix importer bug when throwing exceptions

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

See merge request !3941
2016-05-05 22:27:40 +00:00
Yorick Peterse 003671207d
Fix passing nil to protected_tag?
Previously this method would directly receive the output of tag_name().
This method could either return a String or nil. In the previous setup
this would somehow magically work but because Rugged::TagCollection#[]
doesn't accept nil values it started to fail.

To work around this the elsif in change_access_check() assigns the
result of tag_name() to a local and then _only_ calls protected_tag?()
if the tag name is not nil. The extra parenthesis are put in place to
ensure that things are parsed correctly, without these the code would be
parsed as follows:

    elsif tag_ref = (tag_name(ref) && protected_tag(tag_ref))

During runtime this would basically resolve to:

    elsif tag_ref = (tag_name(ref) && protected_tag(nil))

This is because when you refer to the variable you're assigning _in_ the
assignment Ruby returns nil instead of raising an error.
2016-05-05 19:46:26 +02:00
Yorick Peterse 93ce229665
Use tag_exists? in GitAccess#protected_tag?
This removes the need for retrieving the entire list of tags just to
check if a specific one exists.
2016-05-05 19:46:26 +02:00
Douglas Barbosa Alexandre 6fbf6b2936 Fix the line code when importing PR review comments from GitHub
Pull Request Review Comments are comments on a portion of the unified
diff.
2016-05-05 10:45:14 -03:00
Rémy Coutable 1a9d505972 Merge branch 'use-rugged-to-create-tag' into 'master'
Use Rugged's TagCollection#create instead of gitlab-shell's Repository#add_tag for better performance

This was originally opened at !1757 by @pcarranza but I changed it to use Rugged instead of gitlab_git, following @DouweM's request.

Once this is merged, https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/26 will be mergeable too.

See merge request !3745
2016-05-04 16:07:13 +00:00
Douwe Maan 6a8359f3d3 Merge branch 'pacoguzman/gitlab-ce-15001-since-and-until-operators-api-commits'
# Conflicts:
#	Gemfile.lock
2016-05-04 17:27:47 +02:00
Rémy Coutable 44f89eafc0 Use Rugged's TagCollection#create instead of gitlab-shell's Repository#add_tag for better performance
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-05-04 17:19:13 +02:00
Kamil Trzcinski b0ddbaa07c Added docker registry view 2016-05-04 11:31:35 +02:00
Jacob Vosmaer 3dc276b367 Remove parallel assignment 2016-05-03 11:46:14 +02:00
Jacob Vosmaer 9ce0994299 Rubocop and whitespace 2016-05-02 13:21:59 +02:00
Jacob Vosmaer d1f5019511 Use correct auth finder 2016-05-02 13:19:39 +02:00
Jacob Vosmaer b1ffc9f0fe Make CI/Oauth/rate limiting reusable 2016-04-29 18:58:55 +02:00
Paco Guzman c4b9bd0413 API support for the 'since' and 'until' operators on commit requests
- Parameter validation as ISO8601 format
2016-04-29 09:26:52 +02:00
Zeger-Jan van de Weg ad99404d25 Properly handle bigger files 2016-04-28 21:28:39 +02:00
Rémy Coutable 5addff7e6c Merge branch 'use-remote-ip-for-akismet' into 'master'
Use ActionDispatch Remote IP for Akismet checking

Previously all remote IPs appeared at 127.0.0.1, which made Akismet
not very useful. Using the ActionDispatch Remote IP (http://api.rubyonrails.org/classes/ActionDispatch/RemoteIp.html)
should provide more reliable results.

Closes #16629

See merge request !3961
2016-04-28 13:09:44 +00:00
Stan Hu e99cf05875 Use ActionDispatch Remote IP for Akismet checking
Previously all remote IPs appeared at 127.0.0.1, which made Akismet
not very useful. Using the ActionDispatch Remote IP (http://api.rubyonrails.org/classes/ActionDispatch/RemoteIp.html)
should provide more reliable results.

Closes #16629
2016-04-27 22:12:55 -07:00
James Lopez ce9310d63f fix var error 2016-04-27 09:28:08 +02:00
Stan Hu eede032345 Backport GitHub Enterprise import support from EE
These changes were pulled from GitLab EE to support configuring
an alternative API URL than the default https://api.github.com.
In addition, the `verify_ssl` flag allows users to disable SSL cert
checking.

One modification: add a default `args` option if it does not exist
to avoid breaking existing configurations.
2016-04-26 21:00:55 -07:00
Alfredo Sumaran 3b39214f29 Merge remote-tracking branch 'origin/master' into issue_14904 2016-04-21 12:47:32 -05:00
Jacob Vosmaer 103c405339 Use SIGTERM during Sidekiq memory shutdown
This makes the memory killer behave more like 'sidekiqctl stop'.
2016-04-21 14:49:15 +02:00
Jacob Schatz b3f4e8b218 Revert "Merge branch 'sentry-js' into 'master' "
This reverts commit 0f309794e7, reversing
changes made to 1e596fef1c.
2016-04-21 07:27:27 -04:00
Alfredo Sumaran 5c10b29700 Merge remote-tracking branch 'origin/master' into issue_14904
# Conflicts:
#	app/views/shared/issuable/_sidebar.html.haml
2016-04-20 17:26:47 -05:00
Robert Speicher 7e6d59067e Merge branch 'fix-grape-internal-allowed-action' into 'master'
Fix setting of "action" for Grape transactions

After wondering why we're not getting all the data in Grafana that I
wanted I realized I wasn't setting the "action" field properly here.

See merge request !3842
2016-04-20 21:27:43 +00:00
Yorick Peterse a257d117a0
Fix setting of "action" for Grape transactions
Merely setting the "action" tag will only result in the transaction
itself containing a value for this tag. To ensure other metrics also
contain this tag we must set the action using Transaction#action=
instead.
2016-04-20 22:42:52 +02:00
Robert Speicher 0f309794e7 Merge branch 'sentry-js' into 'master'
Add Sentry logging for JavaScript errors

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

See merge request !3795
2016-04-20 19:52:27 +00:00
Alfredo Sumaran a45924348f Merge remote-tracking branch 'origin/master' into issue_14904 2016-04-20 12:24:42 -05:00
Sebastian Klier a88f0a1fd8 add wiki_page helper to url_builder 2016-04-20 08:25:41 +08:00
Arinde Eniola 3e7a8b0789 place the sentry config into a new file, and some changes 2016-04-19 22:04:52 +01:00
Yorick Peterse 229f3ce9ce
Configuring of points per UDP packet
This allows users to configure the number of points stored in a single
UDP packet. This in turn can be used to reduce the number of UDP packets
being sent at the cost of these packets being somewhat larger.

The default setting is 1 point per packet so nothing changes for
existing users.
2016-04-19 14:35:25 +02:00
Gabriel Mazetto 5330af3fa6 Using single builder for push and tag events 2016-04-19 11:00:30 +02:00
Gabriel Mazetto ee1090e2b2 Added System Hooks for push and tag_push
Code is based on Project Webhooks, removing deprecations and without
commits listing.
2016-04-19 11:00:30 +02:00
Douglas Barbosa Alexandre f2fe4af19d Set GitHub milestones to Issue/Merge Request that were imported 2016-04-18 20:07:05 -03:00
Douglas Barbosa Alexandre 06ec511164 Import milestones from GitHub 2016-04-18 20:07:04 -03:00
Douglas Barbosa Alexandre 7462a8f90a Apply GitHub labels to Issue/Merge Request that were imported 2016-04-18 17:14:59 -03:00
Douglas Barbosa Alexandre 05a4f444c3 Import labels from GitHub 2016-04-18 17:14:59 -03:00
Alfredo Sumaran b41ddf9c69 Add shortcut_path to GonHelper module 2016-04-18 15:04:57 -05:00
Jacob Schatz 5f98fdcdc9 Add sentry logger to GitLab 2016-04-18 12:26:32 -04:00
Douglas Barbosa Alexandre d13bba44f0 Use GitHub Issue/PR number as iid to keep references
With these changes we don’t lost the issue/pr references when importing
them to GitLab.
2016-04-18 12:15:50 -03:00
Yorick Peterse 7e6f0ac0e0
Count the number of SQL queries per transaction
Fixes gitlab-org/gitlab-ce#15335
2016-04-18 14:53:13 +02:00
Yorick Peterse 7b6785b3b1
Use Module#prepend for method instrumentation
By using Module#prepend we can define a Module containing all proxy
methods. This removes the need for setting up crazy method alias chains
and in turn prevents us from having to deal with all that madness (e.g.
methods calling each other recursively).

Fixes gitlab-org/gitlab-ce#15281
2016-04-18 11:16:31 +02:00
Robert Speicher 2e4d9c1de6 Merge branch 'fix/project-import_url' into 'master'
Fix for import_url fields on projects containing third-party credentials

Fixes https://dev.gitlab.org/gitlab/gitlabhq/issues/2658 

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

See merge request !3066
2016-04-15 21:52:00 +00:00
Robert Speicher 34b0561560 Merge branch 'pmq20/gitlab-ce-psvr/change-head' into 'master'
Use rugged to change HEAD

_Originally opened at !2850 by @pmq20._

Needless to invoke gitlab_shell here, which is slow.

See merge request !3705
2016-04-15 16:44:21 +00:00
Rémy Coutable 8b7bf2a0e0 Merge branch 'rugged-delete-tag' into 'master'
Delete tags via rugged

Improve the performance by directly using rugged instead of shelling out to a git operation.

See merge request !3748
2016-04-15 14:42:05 +00:00
Robert Schilling 3c704c33e0 Delete tags via rugged 2016-04-15 16:05:04 +02:00
Robert Schilling 106c443e76 Remove unused backend methods 2016-04-15 13:30:33 +02:00
Rémy Coutable f8e8a61c9c
Remove Gitlab::Shell#update_repository_head since it's not used anymore
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-04-15 11:38:59 +02:00
Jacob Vosmaer 2a9a9e147b Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into git-http-controller 2016-04-15 11:07:25 +02:00
James Lopez 05985b49a4 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into fix/project-import_url 2016-04-15 08:49:08 +02:00
Robert Speicher 95a867e0af Merge branch 'auto-fsck' into 'master'
Auto git fsck

Closes https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3232

See merge request !3232
2016-04-14 17:15:58 +00:00
James Lopez e5f7a54530 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into fix/project-import_url 2016-04-14 18:12:10 +02:00
Rémy Coutable dd9ced0af9 Merge branch 'connorshea/gitlab-ce-revoke-authorized-application' into 'master'
Fix revoking of authorized OAuth applications

Users were not able to revoke access to authorized OAuth applications. Clicking the "Revoke" button would result in a 404 page, and the application would still be authorized.

Added a spec and also found that the `gon` variables were not being set for this view.

Closes #14370

See merge request !3690
2016-04-14 15:26:09 +00:00
Stan Hu e450892f56 Include GonHelper separately and remove created_at in factory 2016-04-14 07:25:27 -07:00
Stan Hu c7e384aab2 Add spec for deletion of authorized OAuth2 application
Closes #14370

Move gon function into its own helper
2016-04-14 07:24:58 -07:00
Rémy Coutable c71cdb194f Merge branch 'simplify-gitlab-url_builder-15202' into 'master'
Refactor and expose only Gitlab::UrlBuilder.build(record)

```
$ git grep Gitlab::UrlBuilder

app/models/commit.rb:      url: Gitlab::UrlBuilder.build(self),
app/services/issues/base_service.rb:      issue_url = Gitlab::UrlBuilder.build(issue)
app/services/merge_requests/base_service.rb:      hook_data[:object_attributes][:url] = Gitlab::UrlBuilder.build(merge_request)
app/views/search/results/_note.html.haml:- note_url = Gitlab::UrlBuilder.build(note)
lib/gitlab/note_data_builder.rb:        base_data[:object_attributes][:url] = Gitlab::UrlBuilder.build(note)
spec/lib/gitlab/note_data_builder_spec.rb:    expect(data[:object_attributes][:url]).to eq(Gitlab::UrlBuilder.build(note))
spec/lib/gitlab/url_builder_spec.rb:describe Gitlab::UrlBuilder, lib: true do
```

Fixes #15202.

See merge request !3696
2016-04-14 10:27:49 +00:00
James Lopez efff7e9e54 updated migration based on testing findings 2016-04-14 12:03:45 +02:00
Valery Sizov c0678f2d28 Merge branch 'redis_config_consistency' into 'master'
Redis configuration consistency

Related cf669551f6

See merge request !3697
2016-04-13 18:34:11 +00:00
Valery Sizov 2244aaf98f Redis configuration consistency 2016-04-13 20:57:19 +03:00
Robert Speicher 2b28fa14b3 Merge branch 'redis_improvements' into 'master'
Clean up ExclusiveLease

See merge request !3695
2016-04-13 16:22:45 +00:00
Jacob Vosmaer f07316f27c Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into auto-fsck 2016-04-13 17:38:59 +02:00
Rémy Coutable 02cfbf0db5
Refactor and expose only Gitlab::UrlBuilder.build(record)
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-04-13 16:07:04 +02:00
Marin Jankovski c746046992 Merge branch 'external-omniauth-providers' into 'master'
Allow Omniauth providers to be marked as external

Related to #4009 

With this MR we will be able to allow the user to set which Omniauth Providers they would like to have as external. All users login in via these providers will be marked as external, even if they already had an account before. If the provider is removed form the list of external providers, the users will be marked as internal at their next login.

MR for Omnibus: gitlab-org/omnibus-gitlab!727

/cc @dblessing @DouweM 

See merge request !3657
2016-04-13 13:09:47 +00:00
Valery Sizov 33f786b5d3 clean up ExclusiveLease 2016-04-13 13:12:05 +03:00
Yorick Peterse 3240ecfbef
Added ability to add custom tags to transactions
One use case for this is manually setting the "action" tag for Grape API
calls. Due to Grape running blocks there are no human readable method
names that can be used for the "action" tag, thus we have to set these
manually on a case by case basis.
2016-04-13 11:22:37 +02:00
Jacob Vosmaer a1c8fdfbee Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into git-http-controller 2016-04-12 18:23:42 +02:00
Robert Speicher d75ec6cd46 Merge branch 'fix-missing-saml-error-handling' into 'master'
Add proper nil and error handling to SAML login process

While writing the feature that would allow certain Omniauth providers to be marked as external I noticed that there is a scenario where the `gl_user` method can return `nil` and if this is not properly checked, it will lead to exceptions that will cause 500 errors. It is quite easy to land in this scenario, so I added `nil` checks.

I also noticed that the `saml` method in the `omniauth_callbacks_controller.rb` file lacked a `rescue` for `Gitlab::OAuth::SignupDisabledError`, which can happen if the default configuration from `1_settings.rb` is applied. So I also added this check.

See merge request !3609
2016-04-12 15:46:39 +00:00
Jacob Vosmaer 7b1bb0f4db Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into auto-fsck 2016-04-12 17:44:02 +02:00
Jacob Vosmaer 97f4ffff1e Add a 'circuit breaker' for repo checks 2016-04-12 17:07:54 +02:00
Patricio Cano 61fc9aa87e Better control flow. 2016-04-11 18:01:51 -05:00
Patricio Cano 05a611a091 Better control flow and added guard clause. 2016-04-11 17:25:18 -05:00
Patricio Cano 12e6084667 Allow `external_providers` for Omniauth to be defined to mark these users as external 2016-04-11 10:16:15 -05:00
Yorick Peterse 7eed4608fe
Fixed stubbing for Gitlab::Metrics specs
If the measure method uses Transaction.current directly the SQL
subscriber (Subscribers::ActiveRecord) will add timings of queries
triggered by DB cleaner.
2016-04-11 14:29:38 +02:00
Yorick Peterse d9110a7eca
Track call counts in Gitlab::Metrics.measure_block 2016-04-11 13:27:52 +02:00
Yorick Peterse 16926a676b
Store block timings as transaction values
This makes it easier to query, simplifies the code, and makes it
possible to figure out what transaction the data belongs to (simply
because it's now stored _in_ the transaction).

This new setup keeps track of both the real/wall time _and_ CPU time
spent in a block, both measured using milliseconds (to keep all units
the same).
2016-04-11 13:09:36 +02:00
Robert Speicher 93571c4335 Merge branch 'redis-connection-pool' into 'master'
Redis connection pool

Split from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3232

Having an easily accessible Redis connection pool allows us to do more
cool stuff with Redis in GitLab (instead of having to go through e.g.
the Rails cache).

See merge request !3521
2016-04-08 22:26:53 +00:00
Yorick Peterse 833808d737 Merge branch 'instrument-rails-cache' into 'master'
Instrument Rails cache code

See merge request !3619
2016-04-08 20:52:21 +00:00
Yorick Peterse c56f702ec3
Instrument Rails cache code
This allows us to track how much time of a transaction is spent in
dealing with cached data.
2016-04-08 17:54:52 +02:00
Yorick Peterse aa7cddc4fc
Use more accurate timestamps for InfluxDB.
This changes the timestamp of metrics to be more accurate/unique by
using Time#to_f combined with a small random jitter value. This
combination hopefully reduces the amount of collisions, though there's
no way to fully prevent any from occurring.

Fixes gitlab-com/operations#175
2016-04-08 16:39:44 +02:00
Patricio Cano 1d2429af9b Add missing proper nil and error handling to SAML login process. 2016-04-07 16:45:33 -05:00
Jacob Vosmaer cf669551f6 Put CACHE_NAMESPACE in the Gitlab::Redis module 2016-04-07 15:42:07 +02:00
James Lopez a1a1d1f7de refactored create_or_update_import_data 2016-04-07 15:08:38 +02:00
James Lopez 15044e7d85 refactored a few things based on MR feedback 2016-04-07 15:00:20 +02:00
James Lopez e8b7e37c6d Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into fix/project-import_url 2016-04-07 14:15:48 +02:00
Rémy Coutable 8eae7b1088 Merge branch 'feature/expose-builds-badge' into 'master'
Expose badges

This MR exposes badge somewhere in visible place.

![expose_badges](/uploads/d2e290d3013d1ef2b1bdeebbbe2c5d8b/expose_badges.png)

Closes #13801

See merge request !3326
2016-04-07 08:40:15 +00:00
Robert Speicher 936be025cd Merge branch 'saml-external-groups' into 'master'
Allow SAML to identify external users and set them as such

Related to #4009

Fixes #14577

This allows SAML to retrieve group information form the `SAML Response`
and match that to a setting that will flag all matching users as external.

See merge request !3530
2016-04-07 00:35:08 +00:00
Patricio Cano 8110e75309 Implemented suggested fixes 2016-04-06 18:12:25 -05:00
Robert Speicher 5bdc18c5b3 Merge branch 'patch/fix-ldap-unblock-user-logic' into 'master'
Unblocks user when active_directory is disabled and it can be found

We implemented a specific block state to handle user blocking that originates from LDAP filtering rules / directory state in !2242. 

That introduced a regression in LDAP authentication when Active Directory support was disabled. You could have a scenario where the user would not be temporarily found (like a filtering rule), that would mark the user as `ldap_blocked`, but will never unblock it automatically when that state changed.

Fixes #14253, #13179, #13259, #13959

See merge request !3550
2016-04-06 21:50:40 +00:00
Patricio Cano eb0f1de36c Added CHANGELOG item 2016-04-06 16:21:58 -05:00
Patricio Cano 3a36fa8957 Fix error that was causing only one group to be returned and corrected specs to use the proper attribute type 2016-04-06 16:03:35 -05:00
Grzegorz Bizon b7fa7c4d59 Extend build status badge, add html/markdown methods 2016-04-06 19:56:34 +02:00
Jacob Vosmaer 91226c2001 Move workhorse protocol code into lib 2016-04-06 17:52:12 +02:00
Jacob Vosmaer 6cc6d9730a Delete dead code 2016-04-06 17:27:52 +02:00
Yorick Peterse 1af6cf28c0 Measure Ruby blocks using Gitlab::Metrics
This allows measuring of timings of arbitrary Ruby blocks, this allows
for more fine grained performance monitoring. Custom values and tags can
also be attached to a block.
2016-04-06 14:31:52 +02:00
Jacob Vosmaer 5cf56e5647 Rename almost all the things 2016-04-06 13:47:05 +02:00
James Lopez b97654393e fix some issues with credentials 2016-04-06 10:36:30 +02:00
Patricio Cano 518ec6b266 Changed config syntax and improved how chaanges in group memberships are handled when external groups is set up 2016-04-05 19:20:18 -05:00
Gabriel Mazetto 5ee6badade Unblocks user when active_directory is disabled and it can be found 2016-04-05 16:34:31 -03:00
James Lopez 5e51fce4dc some refactoring to symbolise keys across importers and left a TODO 2016-04-05 15:41:15 +02:00
Patricio Cano 1a168279fa Prepare SAML for group retrieval 2016-04-04 19:09:12 -05:00
James Lopez 7f7769172e Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into fix/project-import_url
# Conflicts:
#	db/schema.rb
2016-04-04 20:03:25 +02:00
Jacob Vosmaer bf9526739b Rebase repo check MR 2016-04-04 17:23:43 +02:00
Jacob Vosmaer 213ee62469 Be careful when setting class instance vars 2016-04-04 17:01:56 +02:00
Jacob Vosmaer 0163e27631 Add Gitlab::Redis connection pool 2016-04-04 17:00:09 +02:00
James Lopez ef85c510fa corrected a couple of based on MR review 2016-04-04 09:57:52 +02:00
Robert Speicher 5627542fd4 Merge branch 'routing' into 'master'
Added & use Gitlab::Routing for URL helpers

Extracted from !3389

See merge request !3486
2016-04-01 16:51:20 +00:00
Robert Speicher 64106865df Merge branch 'fix/fogbugz-import' into 'master'
spec and fix for fogbugz lonely user problem

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

I encountered this issue while manually testing all import types for
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3066

This is really due to a horrible API

```
{ 'people' => { 'person' => array_of_people_or_single_person_as_hash } }
```

See merge request !3457
2016-04-01 16:32:00 +00:00
James Lopez 43ee65e173 remove useless var 2016-04-01 17:50:50 +02:00
James Lopez 255cd31652 fixes after more import testing 2016-04-01 17:27:07 +02:00
James Lopez 6aeb753ba8 fix github import issues 2016-04-01 15:51:54 +02:00
James Lopez 6d12d79d29 fix fogbugz import 2016-04-01 12:04:41 +02:00
Yorick Peterse 84b0ab7766 Added & use Gitlab::Routing for URL helpers
Rails' "url_helpers" method creates an anonymous Module (which a bunch
of methods) on every call. By caching the output of this method in a
dedicated method we can shave off about 10 seconds of loading time for
an issue with around 200 comments.
2016-04-01 11:13:48 +02:00
Douwe Maan 2e3c2a355f Merge branch 'snippets-with-comments-cause-a-500-when-they-show-up-in-search-results-14764' into 'master'
Fix Error 500 when searching for a comment in a project snippet

Closes #14764. /cc @stanhu, and thank you for the spec! ;)

See merge request !3468
2016-04-01 08:38:16 +00:00
Douwe Maan 98df8aab7e Merge branch 'fix/issue-move-rewrite-uploads' into 'master'
Rewrite uploads when moving issue to another project

Closes #14531

See merge request !3382
2016-04-01 07:17:10 +00:00
connorshea 85cc172959 Remove "Congratulations!" tweet button on newly-created project.
I’ve removed everything related to the feature based on this commit:
ce08f919f34fd8849834365

Resolves #10857.
2016-03-31 17:09:36 -06:00
Grzegorz Bizon ed6f524c49 Merge branch 'master' into fix/issue-move-rewrite-uploads
* master: (27 commits)
  Fix commit comment alignment
  minor cleanup in system_hook_spec
  Pre-calculate Emoji digests
  Clear .todo listener
  Change window.location to use turbolinks
  Make entire todo row clickable
  Add 8.6.2 CHANGELOG items
  Ensure uploads dir exists when running backup specs
  Move CarrierWave test env config to separate file
  Remove console logs
  Off the event initially
  Collapsed sidebar opens over instead of pushing content.
  Sidebar collapse update issue
  User selection from collapsed sidebar
  Add json response for user avatar in merge request
  Make changed values visible in minimized sidebar.
  Fixed MergeRequestController spec
  We need `sha` reference from `diff_base_commit` to generate the diff
  Use `diff_base_commit` instead of `target_branch` to generate diffs
  Isolate CarrierWave uploads in test enviroment
  ...
2016-03-31 10:07:13 +02:00
Rémy Coutable e60f034126
Fix view of notes in search results when noteable is a snippet
Also, streamline the view.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-03-31 09:40:57 +02:00
Rémy Coutable 091b8a6ede
Rename Note#for_project_snippet? to #for_snippet?
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-03-31 09:20:27 +02:00
James Lopez 2d544d5445 spec and fix for fogbugz lonely user problem 2016-03-30 18:48:28 +02:00