Commit Graph

3067 Commits

Author SHA1 Message Date
Kamil Trzciński 35212deb06 Merge branch 'zj-issue-search-slash-command' into 'master'
Add issue search slash command

See merge request !7752
2016-11-29 11:04:17 +00:00
Douwe Maan 3bf34face4 Merge branch 'jej-use-issuable-finder-instead-of-access-check' into 'security'
Replace issue access checks with use of IssuableFinder

Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867

## Which fixes are in this MR?

⚠️ - Potentially untested  
💣 - No test coverage  
🚥 - Test coverage of some sort exists (a test failed when error raised)  
🚦 - Test coverage of return value (a test failed when nil used)  
 - Permissions check tested

### Issue lookup with access check

Using `visible_to_user` likely makes these security issues too. See [Code smells](#code-smells).

- [x] 🚦 app/finders/notes_finder.rb:15 [`visible_to_user`]
- [x] 🚥 app/views/layouts/nav/_project.html.haml:73 [`visible_to_user`] [`.count`]
- [x]  app/services/merge_requests/build_service.rb:84 [`issue.try(:confidential?)`]
- [x]  lib/api/issues.rb:112 [`visible_to_user`]
  - CHANGELOG: Prevented API returning issues set to 'Only team members' to everyone
- [x]  lib/api/helpers.rb:126 [`can?(current_user, :read_issue, issue)`] Maybe here too?
- [x]  lib/gitlab/search_results.rb:53 [`visible_to_user`]

### Previous discussions
- [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b2ff264eddf9819d7693c14ae213d941494fe2b3_128_126
- [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#7b6375270d22f880bdcb085e47b519b426a5c6c7_87_87

See merge request !2031
2016-11-28 21:26:23 -03:00
Douwe Maan d281383261 Merge branch 'refresh-authorizations-with-lease' into 'master'
Refresh project authorizations using a Redis lease

This MR changes `User#refresh_authorized_projects` so it uses a Redis lease instead of relying on serializable transactions. See the commit message(s) for more details.

See merge request !7733
2016-11-28 03:35:37 +00:00
Yorick Peterse 746b6ec82d Merge branch 'timeout-merge-request-for-binary-file' into 'master'
Fix: Timeout creating and viewing merge request for binary file

See merge request !7713
2016-11-25 16:19:03 +00:00
Z.J. van de Weg 6a08de7386 Add issue search slash command
One of many requested in: gitlab-org/gitlab-ce#24768
2016-11-25 15:41:28 +01:00
Valery Sizov 847ada36c4 Fix: Timeout creating and viewing merge request for binary file 2016-11-25 15:25:01 +02:00
Yorick Peterse 92b2c74ce1
Refresh project authorizations using a Redis lease
When I proposed using serializable transactions I was hoping we would be
able to refresh data of individual users concurrently. Unfortunately
upon closer inspection it was revealed this was not the case. This could
result in a lot of queries failing due to serialization errors,
overloading the database in the process (given enough workers trying to
update the target table).

To work around this we're now using a Redis lease that is cancelled upon
completion. This ensures we can update the data of different users
concurrently without overloading the database.

The code will try to obtain the lease until it succeeds, waiting at
least 1 second between retries. This is necessary as we may otherwise
end up _not_ updating the data which is not an option.
2016-11-25 13:35:01 +01:00
Z.J. van de Weg d71ad49fc5 Accept a valid ref for issue show
For example, now we support `/gitlab issue show #1`. Where the # used
to trip the regex.
2016-11-25 12:33:57 +01:00
Douwe Maan a7a9db803b Merge branch 'dz-allow-nested-group-routing' into 'master'
Add nested groups support to the routing

## What does this MR do?

It allows routing with `/` in namespace name 

## Why was this MR needed?

For nested groups feature(https://gitlab.com/gitlab-org/gitlab-ce/issues/2772). We need URI like `/group/subgroup/project` be routed correctly


## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) 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 [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/2772

See merge request !7459
2016-11-24 04:31:54 +00:00
Lin Jen-Shin 9ad2dba250 Use Commit#author so we share logic and cache
Closes #24900
2016-11-24 02:33:55 +08:00
Sean McGivern 1a45de3d45 Merge branch 'post_receive-any-email' into 'master'
post_receive: accept any user email from last commit

See merge request !7225
2016-11-23 12:45:11 +00:00
Dmitriy Zaporozhets 6683fdcfb0
Add nested groups support to the routing
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-23 14:08:36 +02:00
Rémy Coutable 6f7ce37292 Merge branch 'fix-ee_compat_check-when-branch-contains-a-slash' into 'master'
Ensure we sanitize branch names with path-unfriendly characters

See merge request !7696
2016-11-23 11:49:48 +00:00
Douwe Maan db02af3e24 Merge branch 'fix/cycle-analytics-plan-issue' into 'master'
Fix cycle analytics plan stage when commits are missing

Takes into account when commits are `nil` so the app doesn't throw an exception and also removes them.

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

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)


See merge request !7694
2016-11-23 10:13:29 +00:00
Rémy Coutable cd78e02096
Ensure we sanitize branch names with path-unfriendly characters
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-23 10:55:28 +01:00
James Lopez b938aa5cc8 Fix and relevant spec for plan stage breaking with nil commits 2016-11-23 09:10:04 +01:00
Kamil Trzciński a713c9c12c Merge branch 'zj-fix-trailing-whitespace-issue-create' into 'master'
Issue creation now accepts trailing whitespace

See merge request !7633
2016-11-22 16:57:12 +00:00
Kamil Trzciński 0f59075030 Merge branch 'fix/ci-linter-undefined-error' into 'master'
Fix undefined error in CI linter

## What does this MR do?

This MR fixes undefined error in CI linter.

## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- [x] Tests added for this feature/bug
  
## What are the relevant issue numbers?

Closes #24759

See merge request !7650
2016-11-22 09:20:45 +00:00
Grzegorz Bizon c048d5d2d9 Fix entry lookup in CI config inheritance rules 2016-11-22 09:09:38 +01:00
Z.J. van de Weg 3ff0575669 Issue creation now accepts trailing whitespace 2016-11-22 08:48:17 +01:00
Kamil Trzciński 0472bc66f3 Merge branch 'improve-deploy-message' into 'master'
Improve deploy message

## What does this MR do?
Improves deploy message to make it more descriptive and useable then what is already offered by deploy command.

## Does this MR meet the acceptance criteria?

- [ ] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) 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 [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [ ] 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 it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

See merge request !7629
2016-11-21 21:53:39 +00:00
Sean McGivern 149df275db Merge branch 'dz-fix-500-group-git' into 'master'
Fix 500 error when group name ends with git

Closes https://gitlab.com/gitlab-com/support-forum/issues/1298
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/24742

See merge request !7630
2016-11-21 20:39:27 +00:00
Kamil Trzcinski 41aa605d4e Improve deploy command message 2016-11-21 21:36:22 +01:00
Rémy Coutable 2449d787ad Merge branch 'chatops-deploy-command' into 'master'
Add deploy chat command

This adds a new ChatOps command:
```
/trigger deploy <environment> to <environment>
```

See merge request !7619
2016-11-21 20:27:58 +00:00
Kamil Trzciński 3c8d2148fc Merge branch 'feature/send-registry-address-with-build-payload' into 'master'
Send registry address with build payload

## What does this MR do?

Adds `registry_url` as a part of a build payload, when sending a response to a GitLab Runner which requested a new build.

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

Change in `lib/ci/api/entities.rb`.

## Why was this MR needed?

This is one of the steps needed to add support for private/protected registries hosted with GitLab CE/EE.

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [ ] 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 it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

Related to gitlab-org/gitlab-ci-multi-runner#1828, gitlab-org/gitlab-ci-multi-runner!386, gitlab-org/gitlab-ci-multi-runner#1434

See merge request !7474
2016-11-21 20:22:55 +00:00
Dmitriy Zaporozhets 5949f398f7
Fix 500 error when group name ends with git
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-21 21:03:18 +02:00
Tomasz Maczukin 461195665b
Add Gitlab::Ci::Build::Credentials module with build credentials abstraction 2016-11-21 19:49:29 +01:00
Sean McGivern 55ca2da768 Merge branch 'smarter-cache-invalidation' into 'master'
Smarter cache invalidation

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

See merge request !7360
2016-11-21 17:08:36 +00:00
Kamil Trzcinski a36d556137 Introduce deploy command that allows to start deployment from one environment to second one 2016-11-21 17:26:35 +01:00
Kamil Trzcinski 1d16f137d9 Add deploy chat command [ci skip] 2016-11-21 16:28:23 +01:00
Tomasz Maczukin e3fb074022
Send credentials array with build data 2016-11-21 15:01:06 +01:00
James Lopez 9b69168858 refactored a couple of things based on feedback 2016-11-21 14:09:26 +01:00
Yorick Peterse df5548e19e
Unify detecting of special repository files
This moves the logic of detecting special repository files (e.g. a
README or a Koding configuration file) to a single class:
Gitlab::FileDetector. Moving this logic into a single place allows this
to be re-used more easily.

This commit also changes Repository#gitlab_ci_yaml so that its cached
similar to other data (e.g. the Koding configuration file).
2016-11-21 12:51:40 +01:00
James Lopez 0fd397bba1 Added permissions per stage to cycle analytics endpoint 2016-11-21 10:49:05 +01:00
Kamil Trzciński cf0283c893 Merge branch 'fix/require-build-script-configuration-entry' into 'master'
Make job script a required configuration entry

## What does this MR do?

This MR makes a job script a required configuration entry.

## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing

## What are the relevant issue numbers?

Closes #24575

See merge request !7566
2016-11-19 11:02:56 +00:00
Douwe Maan 130c8a5198 Merge branch 'feature/precalculate-authorized-projects' into 'master'
Precalculate authorized projects in database

## What does this MR do?
It caches user's authorized projects in database instead of using multiple unions, which should simplify and speed-up things since this operation (getting authorized projects) is used a lot.

## Are there points in the code the reviewer needs to double check?
Did we miss a scenario where we need to refresh the list of projects?

## 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 [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?
#23150 

See merge request !6839
2016-11-18 19:42:17 +00:00
Ahmad Sherif fd05e26618 Precalculate user's authorized projects in database
Closes #23150
2016-11-18 20:25:45 +02:00
Kamil Trzciński ffc5fc6a38 Merge branch 'zj-slash-commands-mattermost' into 'master'
Slash command for mattermost

Closes  #22540

## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)


See merge request !7438
2016-11-18 18:06:36 +00:00
Douwe Maan 2717675fbc Merge branch 'bugfix/html-only-mail' into 'master'
add parsing support for incoming html email

## What does this MR do?
Fixes #18388 by adding support for parsing HTML email

## Are there points in the code the reviewer needs to double check?
The new class, Gitlab::Email::HTMLParser, which needs to translate the HTML content to text and also delete replies, as they are not necessarily in the correct format to be caught by EmailReplyParser. The solution I found that should work for any HTML-formatted email is to remove all `<table>` and `<blockquote>` tags. Actual `<table>` elements (to be interpreted by markdown) should already be encoded with e.g. `&lt;table&gt;` - the only failure mode is if there is an *actual* HTML table in the content itself, which we wouldn't be able to support easily anyways.

The gem `html2text` traverses the HTML tree and outputs text - and markdown in the case of HTML links or images.

See merge request !7397
2016-11-18 17:15:56 +00:00
Douwe Maan 2343b83098 Merge branch 'feature/cycle-analytics-events' into 'master'
Cycle Analytics: Events per stage

Adds list of events to each stage:

- Issue: list of issues created in the last XX days, that have been labeled or added to a milestone.
- Plan: list of commits that reference for the fist time an issue from the last stage.
- Code: list of MR created in this stage
- Test: List of unique builds triggered by the commits.
- Review: List of MR merged
- Staging: List of deployed builds
- Production: list of issues with the time from idea to production

Fixes #23449 

- [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)
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !6859
2016-11-18 13:50:50 +00:00
Grzegorz Bizon bf25b5f69d Remove CI config helper with same name as an entry 2016-11-18 14:30:27 +01:00
Grzegorz Bizon 65724301e6 Make CI job script a required configuration entry 2016-11-18 14:14:41 +01:00
James Lopez f5b792e22e refactored updater and updated specs 2016-11-18 13:00:38 +01:00
James Lopez cb353d655b added new build updater, specs and refactored allowed_ids 2016-11-18 12:05:29 +01:00
Z.J. van de Weg f749fb7fe0 Improve style, add more tests 2016-11-18 11:38:54 +01:00
Douwe Maan 75c8faf7ba Merge branch '24276-usernames-with-dots' into 'master'
Allow registering users where the username contains dots (.)

## What does this MR do?

- Allow registering users whose usernames contains dots `.`
- This can currently be done by registering with a username containing no dots, and then editing the username to have dots in the user's profile settings.

## Does this MR meet the acceptance criteria?

-  [#24276/!7500] Unable to register names with dot
    - [x]  Implementation
    - [x]  Tests
        - [x]  Added
        - [x]  [Passing](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7500/builds)
    - [x]  Meta
        - [x]  CHANGELOG entry created
        - [x]  Documentation created/updated
        - [x]  API support added
        - [x]  Branch has no merge conflicts with `master`
        - [x]  Squashed related commits together
    - [x]  Review
        - [x]  Endboss
            - [x]  Use `Gitlab::Regex::NAMESPACE_REGEX_STR` instead of a hardcoded pattern
            - [x]  Define `NAMESPACE_REGEX_STR` in terms of `NAMESPACE_REGEX_STR_JS`
    - [ ]  Wait for merge


## What are the relevant issue numbers?

- Closes #24276

See merge request !7500
2016-11-18 09:55:06 +00:00
James Lopez cd222357ad refactor events 2016-11-18 10:13:42 +01:00
Timothy Andrew 78b6d6624b Allow registering users where the username contains dots (.).
Javascript does not support the negative lookbehind assertion (?<!) used
in the Ruby regex (to disallow usernames ending in `.git` or `.atom`.

Getting the client side code to fully support this format is
non-trivial, since we'd either have to heavily complicate the
regex used, or modify the frontend code to support more complex
validation schemes (it currently uses HTML5 validations).

The pragmatic choice is to create a
`Gitlab::Regex::NAMESPACE_REGEX_STR_SIMPLE` regex to serve as a
Javascript-compatible version of `NAMESPACE_REGEX_STR`.

The client-side code will not display an error for usernames ending in
`.git` and `.atom`, but these will be caught by the server-side
validation.
2016-11-18 11:47:37 +05:30
Sean McGivern dd9cd24e36 Merge branch 'feature/24072-improve-importing-of-github-pull-requests' into 'master'
Improve importing of github pull requests

Closes #24072

See merge request !7241
2016-11-17 23:40:47 +00:00
Andrew Smith 3228798b37
Refactor github import to reduce number of API calls
Ref #24073
2016-11-18 07:47:00 +10:00