Commit Graph
929 Commits
Author SHA1 Message Date
Douwe Maan bbbfdba0b9 Merge branch 'bugagazavr/gitlab-ce-extend-hooks' into 'master'
Add new data to project in push, issue, merge-request and note webhooks data

_Originally opened at !2738 by @bugagazavr._

- - -

**What does this MR do?**

Adds more data to hooks, makes repository data in all hook more dry ( use one hook_attrs method for repository data in all hooks )

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

1. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/project.rb#L738
2. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/concerns/issuable.rb#L132
3. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/push_data_builder.rb#L52
4. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/note_data_builder.rb#L56

**Why was this MR needed?**

More information about user for push events, and more data about repositiry ( project )

**What are the relevant issue numbers?**

No

**Screenshots (if relevant)**

No

See merge request !2788
2016-02-16 13:08:36 +00:00
Douwe Maan 2afd95a025 Merge branch 'streamline-email-validation' into 'master'
Validate email addresses using Devise.email_regexp

Also:
- Get rid of legacy `:strict_mode`
- Get rid of custom `:email` validator
- Add some shared examples to spec emails validation

This supersedes !2754 and fixes #3851.

See merge request !2771
2016-02-12 09:09:23 +00:00
Kirill ZaitsevandRémy Coutable b123171d3d Add new data to project in push, issue, merge-request and note webhooks data
- Add `avatar_url`, `description`, `git_ssh_url`, `git_http_url`,
  `path_with_namespace` and `default_branch` in `project` in push, issue,
  merge-request and note webhooks data
- Deprecate the `ssh_url` in favor of `git_ssh_url` and `http_url` in
  favor of `git_http_url` in `project` for push, issue, merge-request and
  note webhooks data
- Deprecate the `repository` key in push, issue, merge-request and
  note webhooks data, use `project` instead
2016-02-11 17:22:11 +01:00
Robert Speicher 42607a7f17 Merge branch 'brammeleman/3047-add-assignee-data-to-isuable-hook-data' into 'master'
Add assignee data to Issuables' hook_data

Originally opened at !1633 by @brammeleman.

Fixes #3047. Fixes #2475.

See merge request !2724
2016-02-10 21:26:01 +00:00
Robert Speicher 51998fddca Merge branch 'cwq1913/gitlab-ce-fix_skip_merge_commits' into 'master'
Actually use the `skip_merges` option in Repository#commits

Originally opened at !2067 by @cwq1913.

See merge request !2750
2016-02-10 19:01:44 +00:00
Bram DaamsandRémy Coutable d146d9fd83 Add assignee data to Issuables' hook_data 2016-02-10 09:40:00 +01:00
Douwe Maan 883bbd61ca Merge branch 'smarter-diverging-commit-cache-flushing' into 'master'
Smarter flushing of branch statistics caches

This basically ensures we only flush caches of branches whenever we really have to. See commit c514f8b850219cd3e5526e73e1d00e6729e2b466 for the details.

cc @joshfng @rspeicher 

See merge request !2769
2016-02-09 17:19:12 +00:00
Rémy Coutable b34963bc12 Validate email addresses using Devise.email_regexp
Also:
- Get rid of legacy :strict_mode
- Get rid of custom :email validator
- Add some shared examples to spec emails validation
2016-02-09 18:15:35 +01:00
Yorick Peterse 2ce0d06389 Smarter flushing of branch statistics caches
Instead of flushing the behind/ahead counts for all branches upon every
push we now only flush the cache of branches that actually need to have
these statistics recalculated. There are now basically 2 scenarios and
their effects:

1. A user pushes a commit to the default branch, this results in the
   cache being flushed for all branches.
2. A user pushes to a non default branch, this results in _only_ the
   cache for that branch being flushed.

The existing code (Repository#expire_cache) remains backwards compatible
with the previous behaviour, the new behaviour is only applied when a
branch name is passed as an argument. This ensures that when for example
a project is deleted the cache for all branches is flushed.
2016-02-09 17:17:56 +01:00
Douwe Maan f86ff1b833 Merge branch 'fix/max-attachment-size-setting-validation' 2016-02-09 16:52:20 +01:00
Douwe Maan 643c61867c Merge branch 'zj/gitlab-ce-unique-milestone-title-per-project' 2016-02-09 13:15:37 +01:00
Grzegorz Bizon 1cbc75b53c Validate maximum attachment size in application settings
`max_attachment_size` in `ApplicationSetting` should be present,
only integers greater than zero are valid.

Closes #13188
2016-02-09 12:11:16 +01:00
Yorick Peterse 9a99d8e49d Cache various Repository Git operations
This caches the output of the following methods:

* Repository#empty?
* Repository#has_visible_content?
* Repository#root_ref

The cache for Repository#has_visible_content? is flushed whenever a
commit is pushed to a new branch or an existing branch is removed.
The cache for Repository#root_ref is only flushed whenever a user
changes the default branch of a project. The cache for Repository#empty?
is never explicitly flushed as there's no need for it.
2016-02-08 15:40:19 +01:00
Zeger-Jan van de Weg 308c967d0d Validate uniqueness of milestone title per project
Fixes #3903
2016-02-08 12:45:32 +01:00
Tony ChuandRémy Coutable b62cdc3c47 Actually use the skip_merges option in Repository#commits 2016-02-08 12:15:42 +01:00
Douwe Maan b5befc734b Merge branch 'disable-remove-source-branch' into 'master'
Hide remove source branch button when new commit is added to branch

Fixes #3339

This MR hides the 'Remove source branch' button when a new commit is added to the source branch

/cc @DouweM

See merge request !2701
2016-02-04 11:56:58 +00:00
Zeger-Jan van de Weg c6e0228ca9 Hide remove source branch button when new commit is added to branch
Fixes #3339

This MR hides the 'Remove source branch' button when a new commit is added to the source branch
2016-02-04 11:56:23 +01:00
Douwe Maan a1fa973123 Merge branch 'wipMergeSpacing' into 'master'
No space required after WIP identifier

Fixes #2426 

Currently, the WIP: (or any other variation) prefix of a merge request title must include a trailing space for it to be recognized as a work in progress and prevent merging. 
To resolve this, I added an or pattern to the regexp to look for any one of the three possible delimiters ':', ']', or ' '. This way the trailing space isn't required but it still won't mark any titles beginning with wip as work in progress (e.g. "Wipwap").

See merge request !1876
2016-02-04 09:49:54 +00:00
Douglas Barbosa Alexandre 718b1dddfe Refactor Admin::SpamLogsController to block user before destroying 2016-02-02 11:25:44 -02:00
Douglas Barbosa Alexandre e38a1fc83e Fix typo on User model 2016-02-02 11:25:44 -02:00
Douglas Barbosa Alexandre 80d0a2a6d8 Add model spec for SpamLog 2016-02-02 11:25:44 -02:00
Robert Speicher f8052310ad Merge branch 'merge-request-closes-issues-performance' into 'master'
Optimize fetching issues closed by a merge request

Related issue: #12419

See merge request !2625
2016-02-01 15:32:58 -05:00
Yorick Peterse 99492d6b8d Optimize fetching issues closed by a merge request
Instead of running ClosingIssueExtractor for every commit in a merge
request we can gather all the commit messages (and the merge request
description), concatenate all this together and then run
ClosingIssueExtractor only once.

The result of this is that MergeRequest#closes_issues is now between
3.5x and 4x faster than the old setup. Using a merge request with 10
commits (each referencing a number of issues to close) this reduced the
call duration from around 200 milliseconds to around 50 milliseconds.

As a result of these changes the Jira related tests for
MergeRequest#closes_issues have been removed. These tests stubbed
Commit#closes_issues meaning that the only code that was really tested
was the call to Array#uniq to filter out duplicate issues. As this code
is no longer used (nor present) the corresponding tests were removed.

Related: gitlab-org/gitlab-ce#12419
2016-02-01 11:04:05 +01:00
Dmitriy Zaporozhets f862b4ae0f Merge remote-tracking branch 'origin/background-delete-process' 2016-01-30 12:14:48 +01:00
Douglas Barbosa Alexandre aa30088f6e Fix old version warning when viewing wiki latest version via version_id 2016-01-29 14:17:00 -02:00
Josh Frye 91b9cbff8d First pass at deleting projects in the background. 2016-01-29 09:14:16 -05:00
Marin Jankovski 9d0065f054 Merge branch 'hotfix/ruby-21-broken-update' into 'master'
fix syntax error on 2.1 and rubocop on 2.2

Background:

Hashes `{:'key': 'value'}` are not valid in 2.1 but are recommended by Rubocop on 2.2. We only use those when we have a key such as `weird-key`, `weird.key`, etc... 

We could disable Rubocop but it wouldn't warn us about the recommended syntax since `Ruby 1.9`: `{key: 'value'}`, which is valid for `Ruby 1.9+`.

Workaround 1 could be disabling `Style/HashSyntax:` in `rubocop.yml`. 

Workaround 2 (tried in this MR) is to trick Rubocop using `.to_sym` which is effectively the same as adding the `:`. This would allow to keep the warning in place.

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

See merge request !2637
2016-01-29 08:12:18 +00:00
Douwe Maan b7ec476205 Merge branch 'master' into mr-merge-base 2016-01-28 15:12:24 +01:00
Douwe Maan 30b0d06e9f Fix specs 2016-01-28 15:10:48 +01:00
James Lopez 902baa2e1c trick rubocop and temporarily add ruby 2.1 images for any branch 2016-01-28 11:41:58 +01:00
Douwe Maan f025f80d5c Merge branch 'update-ruby-2.2.4' into 'master'
Update Ruby version to 2.2.4 (latest previous stable) and update docs

Tests and issues added to https://github.com/gitlabhq/gitlabhq/issues/8696 were all fine after the upgrade. 

Main issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/3340

See merge request !2534
2016-01-27 21:39:08 +00:00
Robert Speicher bba7e786a6 Merge branch 'events-performance' into 'master'
Improve performance of retrieving last update times for events

See 75195eefcca4cb3961986c90c8e837da02f30134 and
https://gitlab.com/gitlab-org/gitlab-ce/issues/12415#note_3387317
for the juicy details.

Related issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/12415

See merge request !2613
2016-01-27 21:20:16 +00:00
James Lopez 683770f35d Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into update-ruby-2.2.4 2016-01-27 15:42:35 +01:00
Yorick Peterse de7c9c7ab1 Use Atom update times of the first event
By simply loading the first event from the already sorted set we save
ourselves extra (slow) queries just to get the latest update timestamp.
This removes the need for Event.latest_update_time and significantly
reduces the time needed to build an Atom feed.

Fixes gitlab-org/gitlab-ce#12415
2016-01-27 10:33:33 +01:00
Blake Hitchcock 4be65c3231 Update ExternalIssue regex for JIRA integration
The pattern in the `::reference_pattern` class method in the
ExternalIssue model does not match all valid forms of JIRA project
names. I have updated the regex to match JIRA project names with numbers
and underscores. More information on valid JIRA project names can be
found here:
https://confluence.atlassian.com/jira/changing-the-project-key-format-192534.html

* The first character must be a letter,
* All letters used in the project key must be from the Modern Roman Alphabet and upper case, and
* Only letters, numbers or the underscore character can be used.
2016-01-26 15:55:40 -05:00
Douglas Barbosa Alexandre 1aa82dc459 Prioritize previewable over plain README files 2016-01-25 11:27:07 -02:00
James Lopez ee209cc936 fix rubocop new 2.2 syntax issues 2016-01-25 11:44:25 +01:00
Douwe Maan 0f2a906211 Merge branch 'update-gitlab-git' into 'master'
Update gitlab_git & use new method for counting branches

Corresponding gitlab_git merge request detailing some of the rationale behind this: https://gitlab.com/gitlab-org/gitlab_git/merge_requests/62

Fixes #12418 

See merge request !2535
2016-01-25 09:35:54 +00:00
Robert Speicher 3f5e6c6cf6 Merge branch 'ci/recursive-artifacts-entries' into 'master'
Add method to calculate total size of artifacts in subpath

See merge request !2500
2016-01-21 23:23:02 +00:00
Yorick Peterse 0689663487 Use branch_count in Repository#has_visible_content?
Gitlab::Git::Repository#branch_count is a tad faster than the previous
setup. See gitlab-org/gitlab_git!62 for more information.
2016-01-21 18:19:18 +01:00
Kamil Trzcinski 9b0f57781e Add method that calculates total size for artifacts subfolder 2016-01-20 21:55:13 +01:00
Jeroen Nijhof 85e0fce9ee Add sentry integration 2016-01-18 17:15:10 +01:00
Robert Speicher d633755350 Use a more sensible message for the AbuseReport uniqueness validation
Previously it was "user has already been taken", when really we were
saying the user has already been reported.
2016-01-16 16:50:43 -05:00
Kamil Trzcinski ac652d82f1 Let the CI runner know about builds that this build depends on
This allows us to implement artifacts passing: runner will download artifacts from all prior builds
2016-01-14 19:45:55 +01:00
Douglas Barbosa Alexandre a6a5990ee5 Add Banzai::Filter::GollumTagsFilter for parsing Gollum's tags in HTML 2016-01-14 12:09:31 -02:00
Grzegorz Bizon f80d7a868e Update build model specs 2016-01-14 12:48:16 +01:00
Grzegorz Bizon cfffc9eff2 Update build specs for artifacts browser support 2016-01-14 12:48:15 +01:00
Grzegorz Bizon 5ff7ec42dc Add method that checks if artifacts browser is supported
This is needed because of backward compatibility. Previously artifacts
archive had `.tar.gz` format, but artifacts browser requires ZIP format
now.
2016-01-14 12:48:14 +01:00
Grzegorz Bizon 8eeed761a9 Update specs for CI Build, add artifacts? method
`artifacts?` method checks if artifacts archive is available.
2016-01-14 12:48:14 +01:00
Grzegorz Bizon 9e0e9342a4 Rename method that returns url to CI build artifacts download 2016-01-14 12:48:14 +01:00