summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Backport Group API code that was added in EE onlybackport-ee-js-groups-apiRémy Coutable2016-10-311-0/+3
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Merge branch '22271-drone-tag-pipeline-build' into 'master' Douwe Maan2016-10-312-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix lightweight tags not processed correctly by GitTagPushService ## What does this MR do? Fix lightweight tags not processed correctly by GitTagPushService ## Are there points in the code the reviewer needs to double check? No ## Why was this MR needed? Lightweight tags were being processed incorrectly, causing tag triggers to receive wrong information and not function properly. ## Does this MR meet the acceptance criteria? - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [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 you do - 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? Closes #22271 See merge request !6532
| * Fix lightweight tags not processed correctly by GitTagPushService22271-drone-tag-pipeline-buildAlejandro Rodríguez2016-10-282-3/+3
| | | | | | | | | | | | | | | | When we updated gitlab_git to 10.4.1, `tag.target` changed from pointing to the sha of the tag to the sha of the commit the tag points to. The problem is that only annotated tags have `object_sha`s, lightweight tags don't (it's nil), so (only) in their case we still need to use `tag.target`.
* | Ignore teaspoon tasks in production environmentwinniehell2016-10-291-18/+20
| |
* | Merge branch 'dz-internal-api-fullpath' into 'master' Dmitriy Zaporozhets2016-10-281-4/+9
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make internal api work with full repo path and name ## What does this MR do? Make internal api work with full repo path and name ## Why was this MR needed? So we can pass full repository path on filesystem from gitlab-shell instead of extracted one. We need this for nested groups support where project is can be nested under several groups. ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/2772 See merge request !7148
| * Refactor storage path extraction from full repo pathdz-internal-api-fullpathDmitriy Zaporozhets2016-10-281-6/+1
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * Make internal api work with full repo path instead of nameDmitriy Zaporozhets2016-10-271-4/+14
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Merge branch 'adam-fix-labels-find-or-create' into 'master' Douwe Maan2016-10-285-8/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass user instance to Labels::FindOrCreateService or skip_authorization: true ## What does this MR do? It fixes a bug described in #23694 when `project.owner` was passed to `Labels::FindOrCreateService`. `Labels::FindOrCreateService` expected a user instance and `project.owner` may return a group as well. This MR makes sure that we either pass a user instance or `skip_authorization: true`. ## Are there points in the code the reviewer needs to double check? - places where we pass `skip_authorization: true` ## Does this MR meet the acceptance criteria? - 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) - [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? Fixes #23694 See merge request !7093
| * | Pass user instance to Labels::FindOrCreateService or skip_authorization: trueadam-fix-labels-find-or-createAdam Niedzielski2016-10-285-8/+8
| | | | | | | | | | | | | | | | | | Do not pass project.owner because it may return a group and Labels::FindOrCreateService throws an error in this case. Fixes #23694.
* | | Merge branch 'use-optimistic-locking' into 'master' Stan Hu2016-10-281-0/+19
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Make retry_lock to not be infiniteuse-optimistic-lockingKamil Trzcinski2016-10-271-3/+7
| | | |
| * | | Add tests for optimistic lockingKamil Trzcinski2016-10-261-5/+7
| | | |
| * | | Use optimistic lockingKamil Trzcinski2016-10-261-0/+13
| | | |
* | | | Merge branch 'clean-up-issue_spec.js' into 'master' Rémy Coutable2016-10-281-0/+23
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace static fixture by generated one in issue_spec.js ## What does this MR do? - clean up `issue_spec.js` - introduce an alternative approach to #19445 - rename `rake teaspoon` to `rake teaspoon:tests` - introduce `rake teaspoon:fixtures` which generates fixtures using RSpec - introduce `rake teaspoon` which runs `rake teaspoon:fixtures` and `rake teaspoon:tests` ## Why was this MR needed? - many duplications - missing existence checks - missing conditions - static fixtures don't match real views ## Reasoning I want to explain some of my decisions here, so that they stay visible for future discussions. ### Why not HAML? - same number of HAML templates as number of fixtures (many input files) - embedded logic less readable - can not be rendered by JavaScript (because of inline Ruby) ### Why RSpec? - real controllers for fixtures - spys available for mocking - easily report failed fixture generations ### Why not magic_lamp? (#19445) - introduces another dependency/tool - needs to run a server concurrently to teaspoon - makes it harder to use a JavaScript test runner - static HTML files serve faster See merge request !6059
| * | | | Replace static issue fixtures by script (!6059)winniehell2016-10-281-0/+23
| | | | |
* | | | | Merge branch 'fix/make-github-import-retryable' into 'master' Sean McGivern2016-10-288-23/+112
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | Modify GitHub importer to be retryable Closes #23533 See merge request !7003
| * | | | Fix typosfix/make-github-import-retryableAhmad Sherif2016-10-282-2/+2
| | | | |
| * | | | Abstract the use of imported[!?] and {current,increment}_page in GitHub importerAhmad Sherif2016-10-281-50/+34
| | | | |
| * | | | Use public_send instead of sendAhmad Sherif2016-10-281-1/+1
| | | | |
| * | | | Modify GitHub importer to be retryableAhmad Sherif2016-10-287-25/+130
| | | | |
* | | | | Merge branch '23890-api-should-accepts-boolean' into 'master' Sean McGivern2016-10-281-0/+1
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | API: Fix booleans not recognized as such when using the `to_boolean` helper Fixes #22831 Fixes #23890 See merge request !7149
| * | | | API: Fix booleans not recognized as such when using the `to_boolean` helper23890-api-should-accepts-booleanRémy Coutable2016-10-271-0/+1
| | |/ / | |/| | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | Merge branch 'fix/gh-import-bugs' into 'master' Sean McGivern2016-10-282-13/+23
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | Fix couple of GitHub importing bugs Fix a bug in GH comment importing and label applying for imported MRs. See merge request !7139
| * | | Fix importing MR comments from GitHubfix/gh-import-bugsAhmad Sherif2016-10-271-6/+7
| | | |
| * | | Fix applying labels for GitHub-imported MRsAhmad Sherif2016-10-272-7/+16
| | |/ | |/|
* | | Merge branch '21645-mail_room_sentinel'Douwe Maan2016-10-272-1/+14
|\ \ \ | |/ / |/| |
| * | Updated mail_room and added sentinel support to Reply by Email21645-mail_room_sentinelGabriel Mazetto2016-10-262-1/+14
| | |
* | | Merge branch '5613-backups-fail' into 'master' Douwe Maan2016-10-271-16/+76
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backups fail occasionally with "tar: ./objects: file changed as we read it" error - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] API support added - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] 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) Closes #5613 See merge request !5814
| * | | Backups do not fail anymore when using tar on annex and custom_hookstiagonbotelho2016-10-271-16/+76
| | |/ | |/| | | | | | | only.
* | | Merge branch 'eslint' into 'master' Fatih Acet2016-10-262-0/+16
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add ESLint ## What does this MR do? - create `package.json` - add ESLint dependencies to `package.json` - add JavaScript linting to CI - add Rake task `lint:javascript`as alias for `eslint` (which itself is an alias for `npm run eslint`) ## Are there points in the code the reviewer needs to double check? Probably not. ## Why was this MR needed? My hovercraft was full of eels. ## What are the relevant issue numbers? - https://gitlab.com/gitlab-org/gitlab-ce/issues/13224#note_12537431 - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5006#note_13255658 See merge request !5445
| * | | add Rake tasks eslint and lint:javascriptwinniehell2016-10-262-0/+16
| |/ /
* | | Fixes various errors when adding deploy keys caused by not exiting the ↵Joshua Welsh2016-10-261-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | control flow. When adding a deploy key that already exists in the project the existing key would not be returned, resulting in an attempt to create a new one, which in turn caused a 500 error due to an ActiveRecord exception. When adding a deploy key that exists within another project the key would be joined to the project, but would also attempt to create a new one, which resulted in a 400 error due to the key already existing. Fixes #22741 Fixes #21754 Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | Merge branch 'grapify-tags' into 'master' Rémy Coutable2016-10-261-49/+45
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Grapify tags API ## What does this MR do? Add the Grape-DSL to the tags API. ## Are there points in the code the reviewer needs to double check? The delete endpoint only has a description but no success entity because we don't have one. We only return the branch name as JSON. Should I do something else? ## What are the relevant issue numbers? Related to #22928 See merge request !6860
| * | Grapify tags APIgrapify-tagsRobert Schilling2016-10-261-49/+45
| | |
* | | Merge branch 'fix-events-api' into 'master' Rémy Coutable2016-10-251-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix events order in users/:id/events endpoint ## What does this MR do? Order of events in contributions API is currently being lost, though docs are saying: > Get the contribution events for the specified user, sorted **from newest to oldest**. Order becomes different after `.merge(ProjectsFinder.new.execute(current_user))` call, so I moved ordering below this line. This MR also removes extra `.page(params[:page])` call in the method chain, since [`paginate(events)` already does it](https://gitlab.com/airat/gitlab-ce/blob/master/lib/api/helpers.rb#L112). See merge request !7039
| * | | Get rid of extra .page callAirat Shigapov2016-10-241-2/+1
| | | |
| * | | Fix events order in user contributions APIAirat Shigapov2016-10-241-1/+2
| | | |
* | | | Don't schedule ProjectCacheWorker unless neededproject-cache-worker-schedulingYorick Peterse2016-10-251-1/+8
| |_|/ |/| | | | | | | | | | | | | | 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.
* | | Merge branch '23372-fix-ce-to-ee-merge-check-task' into 'master' Robert Speicher2016-10-254-101/+277
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Change the approach to check if patches apply cleanly Closes #23372 See merge request !6949
| * | | Disable Rails/Output cop since it makes no sense here23372-fix-ce-to-ee-merge-check-taskRémy Coutable2016-10-241-0/+1
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | | Use File.write instead of File.open + File#writeRémy Coutable2016-10-241-1/+1
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | | Don't print out implementation detail stepRémy Coutable2016-10-241-1/+1
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | | Change the approach to check if patches apply cleanlyRémy Coutable2016-10-214-101/+276
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | Escape ref and path for relative links (!6050)winniehell2016-10-241-2/+2
| |/ / |/| |
* | | Merge branch 'grapify-labels-api' into 'master' Rémy Coutable2016-10-241-53/+38
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Grapify the labels API Add the Grape-DSL to the labels API. Since the input validation messages are checked, two tests are modified slightly. ## What are the relevant issue numbers? Related to #22928 See merge request !7070
| * | | Grapify the labels APIgrapify-labels-apiRobert Schilling2016-10-241-53/+38
| | | |
* | | | Merge branch 'grapify-builds-api' into 'master' Rémy Coutable2016-10-241-83/+79
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Grapify builds API ## What does this MR do? Add the Grape-DSL to the builds API. ## What are the relevant issue numbers? Related to #22928 The artifacts API directly downloads a file rather then returning a JSON entity. See merge request !6877
| * | | | Grapify builds APIgrapify-builds-apiRobert Schilling2016-10-241-83/+79
| |/ / /
* | | | Added path parameter to Commits APILuis HGO2016-10-241-0/+2
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | Merge branch '21513-fix-branch-protection-api' into 'master' Douwe Maan2016-10-241-33/+15
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix branch protection API. ## What does this MR do? - Fixes the branch protection API. - Closes #21513 - EE Merge Request: gitlab-org/gitlab-ee!718 ## Tasks - [ ] #21513 !6215 Protected branches API bug - [x] Investigate - [x] Test + Fix - [x] Changelog - [x] MR - [x] Wait for build to pass - [x] Review - [x] Check for EE conflicts - [x] Create EE MR - [x] Refactor + Fix - [x] Rebase EE MR against EE master - [x] Wait for builds to pass - [x] Assign to dbalexandre/douwe - [x] Implement latest review comments - [x] Wait for Douwe's review - [x] Implement changes - [x] Port changes to EE MR - [x] Assign both back to Douwe - [ ] Wait for merge - [ ] Merge gitlab-org/gitlab-ee!718 See merge request !6215