Commit Graph

1541 Commits

Author SHA1 Message Date
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
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
Lin Jen-Shin 101cde38cf Use Ci::Pipeline#latest for finding pipelines
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7333#note_18861407
2016-11-24 18:41:45 +08: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 4646d453b3 Merge branch 'milestone_start_date' into 'master'
Add a starting date to milestones

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

See merge request !7484
2016-11-23 13:23:13 +00: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
Valery Sizov 3789cfe056 Add a starting date to milestones 2016-11-23 13:41:04 +02:00
Ahmad Sherif 747959a832 Update ProjectTeam#max_member_access_for_user_ids to use project authorizations 2016-11-23 12:59:13 +02: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
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
Grzegorz Bizon 4c34b4e517 Extend specs for global ci configuration entry 2016-11-22 09:05:16 +01:00
Z.J. van de Weg 3ff0575669 Issue creation now accepts trailing whitespace 2016-11-22 08:48:17 +01:00
Stan Hu 7a155137a4 Fix spec for Bitbucket importer 2016-11-21 22:06:09 -08:00
Lin Jen-Shin 60fe975452 Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (497 commits)
  Use single quote for strings
  Ue svg from SVGs object
  Dont trigger CI builds [ci skip]
  Revert "Test only migrations"
  Add custom copy for each empty stage
  Fetch only one revision
  Highlight nav item on hover
  Test only migrations
  Fix migration paths tests
  Scroll CA stage panel on mobile
  Fix CSS declaration
  administer to administrator
  Move SVGs to JS objects for easy reuse
  Improve deploy command message
  No enough data to Not enough data
  Keep the cookie name as before
  Fix variable usage
  Evalute time_ago method instead of printing it
  Removed button styling from restricted visibility levels and added checkboxes with icons
  Do not show overview message if there’s already CA data
  ...
2016-11-22 13:59:07 +08:00
Stan Hu fc40c3f28a Fix Rubocop errors with Bitbucket Importer spec 2016-11-21 20:58:46 -08:00
Stan Hu 402cc95c1a Fix Bitbucket importer spec to pass with 2.0 API 2016-11-21 20:49:40 -08:00
Stan Hu 2747e515c6 Fix BitbucketImport::ProjectCreator spec 2016-11-21 16:47:30 -08:00
Stan Hu f25d64d41a Remove no longer used BitbucketImport::Client spec 2016-11-21 16:47:29 -08: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
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
Tomasz Maczukin 461195665b
Add Gitlab::Ci::Build::Credentials module with build credentials abstraction 2016-11-21 19:49:29 +01:00
Kamil Trzcinski d375e3f15b Fix specs and improve code readability 2016-11-21 18:22:03 +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
Sean McGivern 80eaed1651 Merge branch 'fix/cycle-analytics-permissions' into 'master'
Added permissions per stage to cycle analytics endpoint

See merge request !7613
2016-11-21 16:07:27 +00: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
Sean McGivern b98193c55e Merge branch 'issue_5541' into 'master'
Allow to block JIRA events for commits and merge requests

implements #5541 

See merge request !7469
2016-11-21 11:07:46 +00: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
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
Rémy Coutable 03933cd279 Merge branch 'fix-tests-for-different-host' into 'master'
Use `Gitlab.config.gitlab.host` over `'localhost'`

Use `Gitlab.config.gitlab.host` over `'localhost'`

This would fix long standing failures running tests on
my development machine, which set `Gitlab.config.gitlab.host`
to another host because it's not my local computer. Now I
finally cannot withstand it and decided to fix them once and
for all.

See merge request !7562
2016-11-18 17:46:44 +00:00
Felipe Artur d399e1ae2b Allow enabling and disabling commit and MR events for JIRA 2016-11-18 15:17:51 -02: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
Kamil Trzcinski 1db1896ed2 Rename mattermost_command to mattermost_slash_commands 2016-11-18 17:27:14 +01: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
Z.J. van de Weg c72c76fde3 Fix typos 2016-11-18 14:23:26 +01:00
Grzegorz Bizon 65724301e6 Make CI job script a required configuration entry 2016-11-18 14:14:41 +01:00
Lin Jen-Shin 9c4e0d6445 Use `Gitlab.config.gitlab.host` over `'localhost'`
This would fix long standing failures running tests on
my development machine, which set `Gitlab.config.gitlab.host`
to another host because it's not my local computer. Now I
finally cannot withstand it and decided to fix them once and
for all.
2016-11-18 20:17:10 +08:00
James Lopez f5b792e22e refactored updater and updated specs 2016-11-18 13:00:38 +01:00
James Lopez 0aa477884c fix small typo 2016-11-18 12:09:36 +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
Lin Jen-Shin a41ee7eb5e Fix an old copypasta: internal -> private 2016-11-18 18:37:32 +08:00
James Lopez c76ef84781 run pipeline worker in cycle analytics dev setup 2016-11-18 10:50:47 +01:00
James Lopez cd222357ad refactor events 2016-11-18 10:13:42 +01:00
Z.J. van de Weg 0d04724fa1 More coverage on service level 2016-11-18 10:00:40 +01:00
James Lopez e56c305be0 fix spec failures 2016-11-18 08:13:34 +01:00
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
Z.J. van de Weg 778b5a5a04 Merge remote-tracking branch 'origin/master' into zj-slash-commands-mattermost 2016-11-17 21:56:38 +01:00
Z.J. van de Weg 166ee0965b More refactoring, push present to base command 2016-11-17 21:44:26 +01:00
Z.J. van de Weg 1607efa400 Add tests for increased converage 2016-11-17 21:34:24 +01:00
Z.J. van de Weg 6737ada0c8 Remove some commands for now 2016-11-17 21:34:24 +01:00
Z.J. van de Weg d4def9cbcd Incorporate feedback, improve presenter class
[ci skip]
2016-11-17 21:34:24 +01:00
Z.J. van de Weg 1b4fdb9893 Rename from service, and move to lib/gitlab 2016-11-17 21:34:24 +01:00
Kamil Trzcinski bb988fd214 Add most of specs for chat names 2016-11-17 21:34:23 +01:00
Lin Jen-Shin 8c1a01e05f We never check user privilege if it's a deploy key 2016-11-18 03:48:23 +08:00
Rémy Coutable 726a414169 Merge branch 'chat-name-authorize' into 'master'
Allows to authorize chat user against GitLab.

This is needed for: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7438

See merge request !7450
2016-11-17 18:08:24 +00:00
James Lopez d5b673da79 more refactoring and added some auth checks 2016-11-17 18:00:37 +01:00
Lin Jen-Shin a8a879eebc Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (236 commits)
  Mention Git strategy none
  Remove ToC since it's now supported in the docs portal itself
  Add 8.14 to versions with further additions to review apps
  Add Limitations sections to environments and review apps docs
  Add link to environments docs
  Fix URL to review apps docs
  Add a prerequisites section, add some links
  Link to NGINX example project for the time being
  Get rid most of the irrelevant sections
  Add note about current limitation in $CI_BUILD_REF_NAME
  Add an intro and an Overview section for Review Apps
  WIP review apps
  Add Review apps link to CI README
  Add stop environment permissions and remove delete
  Add note about auto-stopping of environments
  Update CHANGELOG.md for 8.13.6
  Finish "Stopping envs" and "Grouping similar envs" sections
  Highlight first user autocomplete option
  Remove ToC and fix headings in Markdown docs
  Revert "Merge branch '22680-unlabel-limit-autocomplete-to-selected-items' into 'master'"
  ...
2016-11-17 23:28:58 +08:00
James Lopez af80fcb477 fix specs 2016-11-17 14:14:23 +01:00
James Lopez ed39d61d74 refactor events facade so it uses separate classes and refactor query stuff 2016-11-17 13:22:27 +01:00
James Lopez cbd7d00039 added custom date helper and spec and fixed some unrelated spec failures 2016-11-17 08:22:59 +01:00
James Lopez cf2dcf043c Refactor all query config stuff into separate classes and added specs 2016-11-17 08:22:59 +01:00
James Lopez f93607a305 get rid of light url builder and fix wrong spec 2016-11-17 08:22:58 +01:00
James Lopez 73e9ec6319 serialize all the things! 2016-11-17 08:22:58 +01:00
James Lopez 8743e59f78 get all stages to use serlalizers - apart from plan - WIP 2016-11-17 08:22:58 +01:00
James Lopez f560099751 fix issue events and related spec - now using generic serializer for a hash 2016-11-17 08:22:58 +01:00
James Lopez 3b179bc37b WIP - refactored events to use build serializer, related spec passing 2016-11-17 08:22:58 +01:00
James Lopez 7ac7cfeb75 refactored and added missing spec to light URL builder 2016-11-17 08:22:57 +01:00
James Lopez 83130ae877 Updated production events with new fields 2016-11-17 08:22:57 +01:00
James Lopez beeb64610e Refactored staging events, added missing fields and fixed specs 2016-11-17 08:22:57 +01:00
James Lopez bd31f24c54 Added branch option to test events
Also fixed test events ordering issue
2016-11-17 08:22:57 +01:00
James Lopez eccb6a5e92 Refactored test events
Now test events return the builds instead a list of pipelines to avoid calling pipeline.builds per each and get the info. Also, added missing fields/data, URLs, and fixed specs in events spec.
2016-11-17 08:22:57 +01:00
James Lopez 11bad33a42 added missing fields to code events and updated spec 2016-11-17 08:22:57 +01:00
James Lopez 1b5b2eac22 added missing fields to plan events and updated spec 2016-11-17 08:22:56 +01:00
James Lopez 8f7266cd4b added missing fields to issue. Also, added a light url builder to add URLs easily from arel. Updated specs. 2016-11-17 08:22:56 +01:00
James Lopez ca9ae8bf63 add email to user related queries so it can be used for displaying avatar in the UI 2016-11-17 08:22:56 +01:00
James Lopez 3cdc9af78e added production events and related spec 2016-11-17 08:22:55 +01:00
James Lopez 1f701cb5e2 added staging events and spec 2016-11-17 08:22:55 +01:00
James Lopez f8acc7ea77 fixing spec failures 2016-11-17 08:22:55 +01:00
James Lopez d99cec7f55 review events - spec and logic 2016-11-17 08:22:55 +01:00
James Lopez ebd5ced7eb Added test events specs and logic. Also fixed some SQL and refactored the pipeline worker spec. 2016-11-17 08:22:55 +01:00
James Lopez 1a4ff5d720 Added code events spec and logic. Also fixed SQL issues and refactored the code a bit. 2016-11-17 08:22:55 +01:00
James Lopez 72660d58af plan events and spec working. Also added some TODOs to the code. 2016-11-17 08:22:54 +01:00
James Lopez 3b5d947730 commit events and spec 2016-11-17 08:22:54 +01:00
James Lopez 1d6068a1c3 fix specs - issue events working 2016-11-17 08:22:54 +01:00
James Lopez c545968ece fix timestamp diff and spec 2016-11-17 08:22:54 +01:00
James Lopez 847d2796cf fixed spec and SQL query 2016-11-17 08:22:54 +01:00
James Lopez 470e39d64f WIP - refactored some arel queries 2016-11-17 08:22:54 +01:00
James Lopez ec7db295d2 Started refactoring stuff to add events to cycle analytics
- Refactored cycle analytics class to extract DB logic
- Reuse logic in new events fetcher
- Started adding cycle analytics events class and spec (still not functional)
2016-11-17 08:22:54 +01:00
http://jneen.net/ 1734124433 fix rubocop failures 2016-11-17 11:59:44 +09:00
http://jneen.net/ f7b0692912 add parsing support for incoming html email 2016-11-17 11:59:44 +09:00
Kamil Trzcinski 6f714dfb4a Improve code design after code review 2016-11-16 23:10:27 +01:00
Kamil Trzcinski d2d64393ed Merge remote-tracking branch 'origin/master' into chat-name-authorize 2016-11-16 16:05:03 +01:00
Lin Jen-Shin 48090a9188 Introduce no_user_or_blocked? and fix tests due to
checking user permission.
2016-11-16 22:07:04 +08:00
Kamil Trzcinski d64183e1fa Add most of specs for chat names 2016-11-16 14:56:30 +01:00
Valery Sizov a5632e802b Search for a filename in a project 2016-11-16 14:25:54 +02:00
Douwe Maan fdd7e3f6e9 Merge branch 'stanhu/gitlab-ce-fix-error-500-with-mr-images' into 'master'
Fix Error 500 when creating a merge request that contains an image that was deleted and added

_Originally opened at !4816 by @stanhu._

- - -

## What does this MR do?

This MR fixes an Error 500 when creating a merge request that contains an image that was deleted and added. Before, when displaying the before and after image, the code would always retrieve the image from the parent commit. However, in a diff, this could cause two different problems:
The "before" image may not actually be the image you want to compare against (regression of #14327)
It may appear as though a file was modified when it was really just added during the diff

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

There may be a more elegant to fix this bug.

## What are the relevant issue numbers?

Closes #3893, gitlab-org/gitlab-ee#678

See merge request !7457
2016-11-15 10:22:36 +00:00
Douwe Maan 3a3b06b4fa Merge branch 'fix_saml_ldap_link' into 'master'
Omniauth auto link LDAP user falls back to find by DN when user cannot be found by uid

Unfortunately, SAML IDs can be an LDAP UID, DN, or something else entirely. UID and DN are most common, though. This adds a fallback scenario so we first try to find a matching LDAP user by UID, then by DN. This will fix a problem for the customer in https://gitlab.zendesk.com/agent/tickets/43298

See merge request !7002
2016-11-15 10:20:11 +00:00
Stan Hu 0f61bb2dc5
Fix Error 500 when creating a merge request that contains an image that was deleted and added
Steps to reproduce:

1. Start with a repo with an image
2. Add a commit to delete the image
3. Add another commit to replace the image with another image

In a diff comparison, we really just compare about what the image was before the diff, not
the direct parent of the last commit. This MR fixes that.

Closes #3893, gitlab-org/gitlab-ee#678

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-14 15:57:01 +01:00
Kamil Trzciński 39ec62ea98 Merge branch 'fix/improve-naming-convention-in-ci-config' into 'master'
Improve naming convention in ci configuration module

## What does this MR do?

This MR improves the naming convention in CI configuration module to reflect the domain design better.

## What are the relevant issue numbers?

Related to #15060

See merge request !7448
2016-11-14 11:59:11 +00:00
Grzegorz Bizon a761d29366 Change name of method for setting CI config entries 2016-11-14 10:51:56 +01:00
Grzegorz Bizon c701468390 Improve naming convention in ci configuration module 2016-11-14 10:31:45 +01:00
Drew Blessing c50b98da72 Centralize LDAP config/filter logic
Centralize all LDAP config logic in `GitLab::LDAP::Config`. Previously,
some logic was in the Devise initializer and it was not honoring the
`user_filter`. If a user outside the configured `user_filter` signed
in, an account would be created but they would then be denied access.
Now that logic is centralized, the filter is honored and users outside
the filter are never created.
2016-11-11 15:58:33 -06:00
Patricio Cano e840749b84 Refactored Sidekiq Throttler and updated documentation 2016-11-11 11:14:58 -06:00
Lin Jen-Shin 40632455b8 Fix a typo: acccess -> access 2016-11-11 21:54:10 +08:00
Lin Jen-Shin 71ae01fefe Add more tests and fix write to project check 2016-11-11 21:44:33 +08:00
Lin Jen-Shin 24d9f51e7b Correct the test. Not sure why change it in the first place 2016-11-11 21:21:43 +08:00
Lin Jen-Shin 8b2426f898 Mark DeployKey#can_push a safe attribute 2016-11-11 20:47:47 +08:00
Drew Blessing 3cff3a2e5b Omniauth auto link LDAP user falls back to find by DN when user cannot be found by uid 2016-11-10 15:47:40 -06:00
Patricio Cano 208530494e Refactored initializer code to its own class and added tests 2016-11-10 11:38:11 -06:00
Lin Jen-Shin 42e252da42 Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (3852 commits)
  Grapify token API
  Fix cache for commit status in commits list to respect branches
  Grapify milestones API
  Grapify runners API
  Improve EeCompatCheck, cache EE repo and keep artifacts for the ee_compat_check task
  Use 'Forking in progress' title when appropriate
  Fix CHANGELOG after 8.14.0-rc1 tag
  Update CHANGELOG.md for 8.14.0-rc1
  Fix YAML syntax on CHANGELOG entry
  Remove redundant rescue from repository keep_around
  Remove redundant space from repository model code
  Remove order-dependent expectation
  Minor CHANGELOG.md cleanups
  Add a link to Git cheatsheet PDF in docs readme
  Grapify the session API
  Add 8.13.5, 8.12.9, and 8.11.11 CHANGELOG
  Merge branch 'unauthenticated-container-registry-access' into 'security'
  Merge branch '23403-fix-events-for-private-project-features' into 'security'
  Merge branch 'fix-unathorized-cloning' into 'security'
  Merge branch 'markdown-xss-fix-option-2.1' into 'security'
  ...
2016-11-10 15:16:33 +00:00
Sean McGivern de8c2b79c0 Merge branch 'ldap_check_bind' into 'master'
Improve ldap:check errors

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

See merge request !6601
2016-11-09 15:37:23 +00:00
Robert Speicher b0088b527e
Merge branch '23403-fix-events-for-private-project-features' into 'security'
Respect project visibility settings in the contributions calendar

This MR fixes a number of bugs relating to access controls and date selection of events for the contributions calendar

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

See merge request !2019

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-09 12:27:41 +01:00
Douwe Maan b0bf92140f
Merge branch 'fix-unathorized-cloning' into 'security'
Ensure external users are not able to clone disabled repositories.

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

See merge request !2017

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-09 12:27:17 +01:00
Douwe Maan bf061d0aff
Merge branch 'issue_23548_dev' into 'master'
disable markdown in comments when referencing disabled features

fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23548

This MR prevents the following references when tool is disabled:

- issues
- snippets
- commits - when repo is disabled
- commit range - when repo is disabled
- milestones

This MR does not prevent references to repository files, since they are just markdown links and don't leak
information.

See merge request !2011

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-09 12:25:17 +01:00
Drew Blessing dc30783057 Introduce better credential and error checking to `rake gitlab:ldap:check`
It was previously possible for invalid credential errors to go unnoticed
in this task. Users would believe everything was configured correctly and
then sign in would fail with 'invalid credentials'. This adds a specific
bind check, plus catches errors connecting to the server. Also, specs :)
2016-11-08 15:46:10 -06:00
Douwe Maan 9c3f3e9e35 Merge branch 'use-separate-token-for-incoming-email' into 'master'
Use separate email-friendly token for incoming email

See merge request !5914
2016-11-08 10:47:45 +00:00
tiagonbotelho 011e561bfa implements reset incoming email token on issues modal and account page,
reactivates all tests and writes more tests for it
2016-11-07 15:56:18 +00:00
Douwe Maan 9d51421346 Use separate email-friendly token for incoming email and let incoming
email token be reset
2016-11-07 15:55:42 +00:00
Elan Ruusamäe b9176afbc8 update existing test 2016-11-06 20:27:58 +02:00
Jacob Vosmaer 6bcc52a536 Refine Git garbage collection 2016-11-04 14:30:11 +01:00
Douwe Maan dc9b3db8b0 Merge branch 'fix/import-export-symlink-vulnerability' into 'security'
Fix symlink vulnerability in Import/Export

Replaces https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2018 made by @james

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

See merge request !2022

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-03 16:04:18 +01:00
Douwe Maan cfb511ea69 Merge branch 'fix/import-projectmember-security' into 'security'
Fix Import/Export foreign key issue to do with project members

Cleans-up any foreign keys in `ProjectMember` - same as we do with the rest of the models when importing.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23837 and https://gitlab.com/gitlab-org/gitlab-ce/issues/23739

See merge request !2020

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-03 16:04:18 +01:00
Rémy Coutable d733a966e4 Merge branch 'allow-owner-to-run-ci-builds' into 'master'
Allow owners to fetch source code in CI builds

Due to different way of handling owners of a project, they were not allowed to fetch CI sources for project.

This adds a separate code path for handling owners, that are not admins.

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

See merge request !6943
2016-11-02 09:48:22 +00:00
Felipe Artur f4e31b820e Fix project features default values 2016-11-01 11:03:56 -02:00
Kamil Trzcinski 517dd4a3f3 Allow owners to fetch source code in CI builds
Due to different way of handling owners of a project, they were not allowed to fetch CI sources for project.
2016-11-01 09:37:20 +01:00
Stan Hu d306b0d7c2 Merge branch 'use-optimistic-locking' into 'master'
Use optimistic locking

## What does this MR do?
Removes the usage of pessimistic locking in favor of optimistic which is way cheaper and doesn't block database operation.

Since this is very simple change it should be safe. If we receive `StaleObjectError` message we will reload object a retry operations in lock.

However, I still believe that we need this one: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7005 as this will reduce a load on Database and FS.
This changes a behavior from:

### Pesimistic locking (previous behavior)

#### For updating
1. SELECT * FOR UPDATE (other updates wait on this)
2. we update ci_pipeline
3. latest_build_status
4. enqueue: (use: transition :created -> :pending)
5. [state_machine] we are in  state created, we can go to pending
6. [state_machine] ci_pipeline.status = created
7. [state_machine] ci_pipeline.save
8. [state_machine] after_transition: (if for success): PipelineSuccessWorker on Sidekiq
9. release DB lock

#### If no update is required
1. SELECT * FOR UPDATE (other updates wait on this)
2. we update ci_pipeline
3. latest_build_status
4. we are in pending, we can't transition to pending, because it's forbidden
5. release DB lock

### Optimistic locking (implemented by this MR)

#### For updating
1. latest_build_status
2. enqueue: (use `transition :created -> :pending`)
3. [state_machine] we are in state created, we can go to pending
4. [state_machine] ci_pipeline.status = created
5. [state_machine] ci_pipeline.save
6. [state_machine] [save] where(lock_version: ci_pipeline.lock_version).update_all(status: :created, updated_at: Time.now)
7. [state_machine] [save] unless we_updated_row then raise ObjectInconsistentError

#### If no update is required
1. we update ci_pipeline
2. latest_build_status
3. we are in pending, we can't transition to pending, because it's forbidden

## Why was this MR needed?
We have been seeing a number of problems when we migrated Pipeline/Build processing to Sidekiq. Especially we started seeing a lot of blocking queries.

We used a pessimistic locking which doesn't seem to be required. This effectively allows us to fix our issues with blocked queries by using more efficient method of operation.

## What are the relevant issue numbers?
Issues: https://gitlab.com/gitlab-com/infrastructure/issues/623 and https://gitlab.com/gitlab-com/infrastructure/issues/584, but also there's a bunch of Merge Requests that try to improve behavior of scheduled jobs.

cc @pcarranza @yorickpeterse @stanhu

See merge request !7040
2016-10-28 14:41:24 +00:00
Ahmad Sherif 14fbd25d06 Modify GitHub importer to be retryable 2016-10-28 11:30:20 +02:00
Sean McGivern 66870960af Merge branch 'fix/gh-import-bugs' into 'master'
Fix couple of GitHub importing bugs

Fix a bug in GH comment importing and label applying for imported MRs.

See merge request !7139
2016-10-28 08:48:08 +00:00
Douwe Maan e5950e687c Merge branch '21645-mail_room_sentinel' 2016-10-27 15:51:34 +01:00
Ahmad Sherif 4259334fb6 Fix applying labels for GitHub-imported MRs 2016-10-27 15:42:28 +02:00
Kamil Trzcinski 2822526e7b Make retry_lock to not be infinite 2016-10-27 12:34:35 +01:00
Kamil Trzcinski d8aed6a27b Fix optimistic locking 2016-10-26 11:37:23 +02:00
Kamil Trzcinski 47b2add4f6 Add tests for optimistic locking 2016-10-26 11:37:23 +02:00
Gabriel Mazetto f9126fbe0a Updated mail_room and added sentinel support to Reply by Email 2016-10-26 05:02:47 +02:00
Yorick Peterse 3b4af59a5f
Don't schedule ProjectCacheWorker unless needed
This changes ProjectCacheWorker.perform_async so it only schedules a job
when no lease for the given project is present. This ensures we don't
end up scheduling hundreds of jobs when they won't be executed anyway.
2016-10-25 16:02:36 +02:00
Lin Jen-Shin a4ef4244d4 Preserve note_type and position for notes from emails
Closes #23208
2016-10-20 16:18:53 +08:00
James Lopez 891e5f4851 Update specs to cope with new label types and priorities
Fixed all related specs and also changed the logic to handle edge cases. This includes exporting and exporting of group labels, which will get associated with the new group (if any) or they will become normal project labels otherwise.

Found other issues to do with not being able to import all labels at once in the beginning of the JSON - code was much simpler when we import all labels and milestones associated to a project first, then the associations will find the already created labels instead of creating them from the associations themselves.
2016-10-19 14:58:28 -02:00
Douglas Barbosa Alexandre f0ad0ceff5 Fix GitHub importer spec 2016-10-19 14:58:28 -02:00
Douglas Barbosa Alexandre 7e11ca86fd Reuse LabelsFinder on Issueable#add_labels_by_names 2016-10-19 14:58:25 -02:00
James Lopez 723e576782 fix rubocop warning 2016-10-19 14:58:25 -02:00
James Lopez 77b7bfd463 Fix import/export labels to cope with project and group labels. Added relevant specs. 2016-10-19 14:58:25 -02:00
Douglas Barbosa Alexandre 07709c5576 Unfold references for group labels when moving issue to another project 2016-10-19 14:58:25 -02:00
Douglas Barbosa Alexandre e00c739f97 Add Label attributes: type, and group_id to safe model attributes 2016-10-19 14:58:25 -02:00
Douwe Maan 7a650d1578 Merge branch 'backport-git-access-spec-changes' into 'master'
Backport git access spec changes from EE

https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/645#note_16391185

See merge request !6961
2016-10-19 09:37:58 +00:00
Rémy Coutable f0c7e6713f Merge branch '22191-delete-dynamic-envs-mr' into 'master'
Delete dynamic environments

- Adds "close environment" action to a merge request
- Adds tabs to environments list
- Adds close button to each environment row in environments list
- Replaces Destroy button with Close button inside an environment
- Adds close button to builds list inside an environment

#### Configuration

In order to enable stopping environments a valid `.gitlab-ci.yml` syntax has to be used:

```
review:
  environment:
    name: review/$app
    on_stop: stop_review

stop_review:
  script: echo Delete My App
  when: manual
  environment:
    name: review/$app
    action: stop
```

This MR requires that `stop_review` has to have: `when`, `environment:name` and `environment:action` defined.
The next MR after this one will verify that and enforce that these settings are configured.

It will also implicitly configure these settings, making it possible to define it like this:

```
review:
  environment:
    name: review/$app
    on_stop: stop_review

stop_review:
  script: echo Delete My App
```

Closes #22191 

See merge request !6669
2016-10-19 07:53:05 +00:00
Kamil Trzciński 2f7e1c0ead Merge branch 'pipeline-emails' into 'master'
Add a new pipeline email service

## What does this MR do?

Add a new pipeline email service

## What are the relevant issue numbers?

Closes #3976 

## Remaining tasks

* [x] Preserve `&middot;` and `&nbsp;`
* [x] Use XHTML 1.0
* [ ] Use the same layout (`app/views/layouts/notify.html.haml`)
* [ ] Digest or not (assets or public)
* [x] A similar email for succeeded pipeline
* [x] Plain text versions for both emails

## Screenshots (if relevant)

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6019#note_16594345

## 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] `PipelinesEmailService`
  - [x] `SendPipelineNotificationService`

See merge request !6019
2016-10-18 16:56:13 +00:00
Sean McGivern cc6d42861b Backport git access spec changes from EE
These were introduced in:
<https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/645>
2016-10-18 17:28:57 +01:00
Kamil Trzcinski 19300a1a3d Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mr 2016-10-18 17:48:27 +02:00
Phil Hughes a1deb6ece3 Merge branch 'master' into issue_19734_2 2016-10-18 12:23:44 +01:00
Kamil Trzcinski 66ff67b063 Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mr 2016-10-18 11:56:48 +02:00
Lin Jen-Shin 88d988a2ed Merge remote-tracking branch 'upstream/master' into pipeline-emails
* upstream/master: (58 commits)
  Update endpoint to username validator
  change border color to variable
  Add todo for deprecated user routes and more information about deprecation to changelog
  Provide better error message to the user
  Apply better hierarchy to markdown headers and issue/mr titles
  Swapped button text manipulation outcomes for the toggle query
  Fixed find file keyboard navigation
  Update CHANGELOG for 8.12.7
  Added download-button class and applied button margin
  Enable activerecord_sane_schema_dumper for test
  Updated logo from @luke
  Fix broken specs on MySQL after https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6896
  Fix Test Env (proper error handling when gitlab-shell is not clonned)
  Fix randomly crashing spinach test for merge request
  [Great spinach fix] Replace gsub with delete
  Remove carriage returns from commit description as summary is on a newline and will always include carriage returns
  Convert due_date_select.js filetype to es6.
  Stop directly parsing due_date with Date.parse, prefer parsing implicitly.
  Improve spec for pipeline metrics worker
  Add Pipeline metrics worker
  ...
2016-10-18 08:15:13 +00:00
Kamil Trzcinski bebfceb1df Fix specs 2016-10-17 23:42:49 +02:00
Felipe Artur da07c2e4d3 Add visibility level to project repository 2016-10-17 18:12:18 -02:00
Kamil Trzcinski 25dd1712ca Add specs to test on_stop and action on environments 2016-10-17 16:23:17 +02:00
Kamil Trzcinski 9b790f1cf9 Improve after code review 2016-10-17 16:13:19 +02:00
Lin Jen-Shin dc1d269f67 Merge remote-tracking branch 'upstream/master' into pipeline-emails
* upstream/master: (237 commits)
  Grapify boards API
  Add test, fix merge error
  Use local assigns to get the dropdown title
  Updated issuable dropdown titles
  Added safety check for formatted values
  Minor style improvement
  Fixed conflict and corrected teaspoon test
  Rename method in test
  Moved ci_status environments logic to new action ci_envrionments_status and set up frontend polling
  Refactor ci_status on MergeRequestController
  Fix indenting error in HAML
  Show what time ago a MR was deployed
  Fixed missing links
  Fixed missing links
  Refactor merge requests revisions
  Add link to update docs for source installations
  Grapify todos API
  Link to review apps example from docs
  fix grafana_configuration.md move link
  Do not run before_script, artifacts, cache in trigger_docs job
  ...
2016-10-14 11:31:10 +00:00
Sean McGivern 3764fd4b41 Add blob_ace_mode to conflict content response 2016-10-13 14:16:35 -05:00
Sean McGivern 11e93ad59d Merge branch 'feature/issues-board' into 'master'
Refactoring Issues Board

## What does this MR do?

This MR aims to minimize conflicts between the CE issues board feature with EE multiple boards feature.

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

## Why was this MR needed?

To avoid a lot of conflicts with EE multiple boards feature.

## Screenshots (if 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)~~
- [x] API support added
- Tests
  - [X] Added for this feature/bug
  - [ ] 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)
- [ ] Branch has no merge conflicts with `master` (if you do - 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-ee/issues/929

https://gitlab.com/gitlab-org/gitlab-ee/issues/1084

See merge request !6727
2016-10-13 14:21:14 +00:00
tiagonbotelho c90483406e refactors tests because of gitlab-test repository changes 2016-10-11 16:33:06 +01:00
Douglas Barbosa Alexandre 81c253ded1 Add Project#boards to import/export configuration file 2016-10-11 11:39:05 -03:00
Lin Jen-Shin 94611607e5 Merge remote-tracking branch 'upstream/master' into pipeline-emails
* upstream/master: (292 commits)
  Deletes extra empty line breaking the build
  Optimize the `award_user_list` helper spec
  Fix typo and add he MWBS accronym for "Merge When Build Succeeds"
  Added missing content and improved layout
  ExpireBuildArtifactsWorker query builds table without ordering enqueuing one job per build to cleanup
  Improve the contribution and MR review guide
  Updates test in order to look for link
  Make projects API docs match parameter style
  Fix Event#reset_project_activity updates
  Update user whitelist reject message
  Call ensure_secret_token! in secret token test's before block since it would be called in an initializer.
  Add a CHANGELOG for CacheMarkdownField
  Enable CacheMarkdownField for the remaining models
  Make search results use the markdown cache columns, treating them consistently
  Use CacheMarkdownField for notes
  Add markdown cache columns to the database, but don't use them yet
  Update issue board spec
  Link to Registry docs from project settings
  Truncate long labels with ellipsis in labels page
  Improve issue load time performance by avoiding ORDER BY in find_by call
  ...
2016-10-08 07:51:07 +00:00
Rémy Coutable 0876b46024 Merge branch 'memoize_shell_secret_token' into 'master'
Memoize Github::Shell's secret token

## What does this MR do?

`API::Helpers#secret_token` was reading the secret file on every invocation. This MR reads the file in the `gitlab_shell_secret_token.rb` initializer and saves it as a class variable at `Gitlab::Shell.secret_token`

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

 - I'm not sure if the use of `cattr_accessor` is the best approach, or if should be moved into the `class << self` block?
 - Should `API::Helpers#secret_token` be removed in favor of using `Gitlab::Shell.secret_token`?

## Why was this MR needed?

Performance optimization.

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

See merge request !6599
2016-10-07 10:35:03 +00:00
Justin DiPierro 1c462cf7d6 Call ensure_secret_token! in secret token test's before block since it would be called in an initializer. 2016-10-06 22:40:04 -04:00
Nick Thomas e94cd6fdfe Add markdown cache columns to the database, but don't use them yet
This commit adds a number of _html columns and, with the exception of Note,
starts updating them whenever the content of their partner fields changes.

Note has a collision with the note_html attr_accessor; that will be fixed later

A background worker for clearing these cache columns is also introduced - use
`rake cache:clear` to set it off. You can clear the database or Redis caches
separately by running `rake cache:clear:db` or `rake cache:clear:redis`,
respectively.
2016-10-07 02:54:25 +01:00
Justin DiPierro fe46e4eb35 Load Github::Shell's secret token from file on initialization instead of every request. 2016-10-06 11:22:37 -04:00
Paco Guzman 640a4c8834 Use higher size on Gitlab::Redis connection pool on Sidekiq servers 2016-10-06 10:50:03 +02:00
Kamil Trzciński 0bbeff3d5e Merge branch 'feature/improve-async-pipeline-processing' into 'master'
Improve asynchronous pipeline processing

## What does this MR do?

This MR improves asynchronous processing of pipeline.

## Why was this MR needed?

It eliminates some race conditions and improves performance.

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing

## What are the relevant issue / merge request numbers?

Related merge request:  !6410  
Extracted from !6411

See merge request !6650
2016-10-06 08:42:35 +00:00
Rémy Coutable 67aabcc764 Merge remote-tracking branch 'dev/master' 2016-10-06 08:34:39 +02:00
Rémy Coutable c9396bc7c5 Merge branch 'test-improve-gitlab-identifier' into 'master'
Refactor Gitlab::Identifier

## What does this MR do?

This refactors `Gitlab::Identifier` so that it:

1. Has tests
2. Caches output in an instance variable to reduce queries
3. Uses only a single query to find a user by an SSH key, instead of 2

## Why was this MR needed?

This code was untested and would execute more SQL queries than needed.

See merge request !6680
2016-10-05 11:38:58 +00:00
Yorick Peterse 16ed9b6129
Refactor Gitlab::Identifier
This refactors Gitlab::Identifier so it uses fewer queries and is
actually tested. Queries are reduced by caching the output as well as
using 1 query (instead of 2) to find a user using an SSH key.
2016-10-05 12:40:17 +02:00
Douglas Barbosa Alexandre b5f9541778 Skip wiki creation when GitHub project has wiki enabled
If the GitHub project repository has wiki, we should not create
the default wiki. Otherwise the GitHub importer will fail because
the wiki repository already exist.

This bug was introduced here
https://gitlab.com/gitlab-org/gitlab-ce/commit/892dea67717c0efbd6a28f763
9f34535ec0a8747
2016-10-04 13:06:45 -03:00
Grzegorz Bizon ebeee31100 Fix pipeline fixtures and calls to removed method 2016-10-04 14:43:24 +02:00
Lin Jen-Shin 0cc3fc5627 Add pipeline_email_service. Fixes:
https://gitlab.com/gitlab-org/gitlab-ce/builds/4710913
2016-10-04 04:16:14 +08:00
Lin Jen-Shin f39ba1bb5e Merge remote-tracking branch 'upstream/master' into pipeline-emails
* upstream/master: (372 commits)
  Enable Lint/StringConversionInInterpolation cop and autocorrect offenses
  resolve duplicated changelog entry
  credit myself 😄
  change determine conditions
  override subject method in devise mailer
  follow the styleguide: Don't use parentheses around a literal
  wrap subject with method subject
  move spec back into shared example `an email sent from GitLab`
  stub config settings in spec
  remove empty line at block body end
  remove extra entry
  create new test in `spec/mailers/notify_spec.rb`
  move changelog to 8.13
  add configurable email subject suffix
  Fixes sidebar navigation.
  Convert "SSH Keys" Spinach features to RSpec
  Enable import/export back for non-admins
  Update gitlab-shell to 3.6.3
  Updated artwork of empty group state.
  Better empty state for Groups view.
  ...
2016-10-04 02:38:25 +08:00
Robert Speicher 4a191c83d1 Enable Lint/StringConversionInInterpolation cop and autocorrect offenses 2016-10-03 16:09:57 +02:00
Robert Speicher e64594ac44 Merge branch '21983-member-add_user-doesn-t-detect-existing-members-that-have-requested-access' into 'master'
Resolve "`Member.add_user`doesn't detect existing members that have requested access"

## What does this MR do?

This merge request handle the case when an access requester is added to a group or project (via the members page or the API).

In `Member.add_user`, if an access requester already exists, we simply accept their request (and set the `created_by`, `access_level` and `expires_at` attributes if given).

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

I've taken the opportunity to cleanup the whole `{Group,Project}Member.add_user*` methods since it was quite a mess.

## What are the relevant issue numbers?

Closes #21983

See merge request !6393
2016-10-02 11:42:57 +00:00
Douwe Maan 8a866bfce3 Merge branch 'fix/id-claim-import-issue' into 'master'
Prevent claiming associated model IDs via import

On the import side, we should be careful not to use any IDs as part of the JSON file that could have been manipulated.

Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/20821


Things we already do (__before__ this fix):

1. Remove all primary keys
1. **Always** reassign some of the foreign keys, such as ALL project IDs and user IDs (so it would be difficult to impersonate or try to gain access to another project)
1. Ignore/reject attributes that do not exist in the model
1. If someone reassigns a foreign key `submodel_id`, and that object has another json as the submodel, the new submodel will reassign the `submodel_id` to the newly created submodel ID.

Things we should do:

1. Remove/nullify any other foreign keys that we don't reassign (checked this, and there aren't many, fortunately. In fact, I don't think much harm can be done at all - at the moment).

See merge request !1985
2016-09-30 07:31:02 +00:00
Douwe Maan 029c0d79af Merge branch 'lfs-ssh-authorization-fix' into 'master'
Do not regenerate the `lfs_token` every time `git-lfs-authenticate` is called

## What does this MR do?

 Do not regenerate the `lfs_token` every time `git-lfs-authenticate` is called, instead return the saved token if one is present.

This was causing a lot of 401s, leading to 403s, as state in #22527

As it turns out, when pushing a lot of LFS objects, the LFS client was calling `git-lfs-authenticate` in the middle of the request again. This caused the `lfs_token` to be regenerated. The problem lies in that the LFS client was not aware of this change, and was still using the old token. This caused all subsequent requests to fail with a 401 error.

Since HTTP Auth is protected by Rack Attack, this 401s where immediately flagged and resulted in the IP of the user being banned. 

With this change, GitLab returns the value stored in Redis, if one is present, thus if the LFS client calls `git-lfs-authenticate` again during the request, the auth header will remain unchanged, allowing all subsequent requests to continue without issues.

## What are the relevant issue numbers?

Fixes #22527

cc @SeanPackham @jacobvosmaer-gitlab

See merge request !6551
2016-09-28 18:13:34 +00:00
Patricio Cano 2772109ac1 Handle LFS token creation and retrieval in the same method, and in the same Redis connection.
Reset expiry time of token, if token is retrieved again before it expires.
2016-09-28 12:13:48 -05:00
Rémy Coutable ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Markus Koller 68364fe2f0
Log LDAP lookup errors and don't swallow unrelated exceptions
Signed-off-by: Roger Meier <r.meier@siemens.com>
2016-09-28 07:44:58 +02:00
Ahmad Sherif e30bfb809a Import all GitHub comments after importing issues and PRs 2016-09-27 20:45:07 +02:00
Ahmad Sherif dbcbbf262b Speed up label-applying process for GitHub importing
* No need to re-fetch issues from GH to read their labels, the labels
  are already there from the index request.
* No need to look up labels on the database for every application, so we
  cache them.
2016-09-27 20:45:07 +02:00
Ahmad Sherif 395a9301b2 Process each page of GitHub resources instead of concating them then processing
This should avoid having large memory growth when importing GitHub repos
with lots of resources.
2016-09-27 20:45:07 +02:00
James Lopez 4c480be39b Prevent claiming associated model IDs via import and added relevant specs 2016-09-27 15:48:10 +02:00
James Lopez fc548207d5 fix model order in import/export config and 1to1 relation issue. Added relevant specs. 2016-09-27 14:56:33 +02:00
James Lopez a5b9e1c260 added more specs 2016-09-26 09:49:05 +02:00
James Lopez a9f1e972ec Fixes issue with rails reserved keyword type exporting/importing services. Also fixed CustomIssueTrackerService title setter and added relevant specs. 2016-09-26 09:49:05 +02:00
Robert Speicher 0a9f9c10e4 Merge branch '22229-use-base-sha-when-downloading-merge-requests' into 'master'
Use base SHA for patches and diffs

## What does this MR do?

Switch from using 'start SHA' to 'base SHA' for patches and diffs

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

## Why was this MR needed?

Makes the downloaded patches and diffs on the merge request page match the frontend-rendered "changes" in these scenarios:

* Unpatched gitlab-workhorse, downloading patchsets of open MRs (https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/68)
* Unpatched gitlab-workhorse, downloading diffs of open and merged MRs
* Patched gitlab-workhorse, downloading patchsets of merged merge requests

## What are the relevant issue numbers?

Closes #22229

See merge request !6435
2016-09-25 10:30:37 +00:00
Nick Thomas a8829f25d3 Use base SHA for patches and diffs
This commit changes the revisions used for diffs. The current behaviour is
to show all changes between current tip of master and tip of the MR, rather
than matching the output of the web frontend (which just shows the changes
in the MR). Switching from start_sha to base_sha fixes this.
2016-09-22 18:49:31 +01:00