summaryrefslogtreecommitdiff
path: root/app/services
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | Pass user instance to Labels::FindOrCreateService or skip_authorization: trueadam-fix-labels-find-or-createAdam Niedzielski2016-10-281-4/+7
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-282-19/+15
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | |
| * | | | | | Fix Rubocop unused variables warningStan Hu2016-10-261-2/+2
| | | | | | |
| * | | | | | Remove puts to solve Rubocop errorsStan Hu2016-10-261-2/+0
| | | | | | |
| * | | | | | Fix optimistic lockingKamil Trzcinski2016-10-261-2/+4
| | | | | | |
| * | | | | | Add tests for optimistic lockingKamil Trzcinski2016-10-261-1/+1
| | | | | | |
| * | | | | | Use optimistic lockingKamil Trzcinski2016-10-262-19/+15
| |/ / / / /
* | | | | | Check if repository already exists before trying to re-import itAhmad Sherif2016-10-281-1/+1
|/ / / / /
* | | | | Merge branch 'barthc/gitlab-ce-prevent_authored_vote_from_notes'Rémy Coutable2016-10-241-2/+4
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | See merge request !6544.
| * | | | | Fix authored vote from notesbarthc2016-10-241-2/+4
| | |_|_|/ | |/| | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | | | | Implement third round of review comments from @DouweM.21513-fix-branch-protection-apiTimothy Andrew2016-10-242-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Extract/mutate `params` in the `execute` method of the API services, rather than in `initialize`.
* | | | | Implement second round of review comments from @DouweM.Timothy Andrew2016-10-242-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Pass `developers_and_merge` and `developers_can_push` in `params` instead of using keyword arguments. - Refactor a slightly complex boolean check to a simple `nil?` check.
* | | | | Implement review comments from @DouweM.Timothy Andrew2016-10-241-10/+15
| | | | |
* | | | | Implement review comments from @dbalexandre.Timothy Andrew2016-10-241-37/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Don't have any EE-only code in CE. Ok to have CE-only code in EE. 2. Use `case` instead of `if/elsif`
* | | | | Fix branch protection API.Timothy Andrew2016-10-242-0/+109
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Previously, we were not removing existing access levels before creating new ones. This is not a problem for EE, but _is_ for CE, since we restrict the number of access levels in CE to 1. 2. The correct approach is: CE -> delete all access levels before updating a protected branch EE -> delete developer access levels if "developers_can_{merge,push}" is switched off 3. The dispatch is performed by checking if a "length: 1" validation is present on the access levels or not. 4. Another source of problems was that we didn't put multiple queries in a transaction. If the `destroy_all` passes, but the `update` fails, we should have a rollback. 5. Modifying the API to provide users direct access to CRUD access levels will make things a lot simpler. 6. Create `create/update` services separately for this API, which perform the necessary data translation, before calling the regular `create/update` services. The translation code was getting too large for the API endpoint itself, so this move makes sense.
* | | | Ignore external issues when bulk assigning issues to author of merge request.fix-bulk-assign-issues-for-external-issuesAdam Niedzielski2016-10-201-1/+1
| |_|/ |/| | | | | | | | Fixes #23552
* | | Differentiate the expire from leave eventCallum Dryden2016-10-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we cannot see weather a user left a project due to their membership expiring of if they themselves opted to leave the project. This adds a new event type that allows us to make this differentiation. Note that is not really feasable to go back and reliably fix up the previous events. As a result the events for previous expire removals will remain the same however events of this nature going forward will be correctly represented.
* | | Avoid touch label links that does not belongs to project when moving itfeature/group-level-labelsDouglas Barbosa Alexandre2016-10-191-15/+42
| | |
* | | Rename Labels::CreateService to Labels::FindOrCreateServiceDouglas Barbosa Alexandre2016-10-194-4/+4
| | |
* | | Add support to group labels to SlashCommands::InterpretServiceDouglas Barbosa Alexandre2016-10-191-2/+4
| | |
* | | User Labes::CreateService to create labelsDouglas Barbosa Alexandre2016-10-193-10/+5
| | |
* | | Add service to create project labelsDouglas Barbosa Alexandre2016-10-191-0/+33
| | |
* | | Recreates the label priorities when moving project to another groupDouglas Barbosa Alexandre2016-10-191-1/+2
| | |
* | | Fix IssuableBaseService#find_or_create_label_idsDouglas Barbosa Alexandre2016-10-191-1/+1
| | |
* | | Skip update query if label have the same id on Labels::TransferServiceDouglas Barbosa Alexandre2016-10-191-0/+2
| | |
* | | Include global labels when moving an issue to another projectDouglas Barbosa Alexandre2016-10-191-2/+6
| | |
* | | Recreates missing group labels when moving project to another groupDouglas Barbosa Alexandre2016-10-192-0/+56
| | |
* | | Allow user to create a board list based on a group labelDouglas Barbosa Alexandre2016-10-191-1/+5
| | |
* | | Allow users to apply group labels on Issues/MRsDouglas Barbosa Alexandre2016-10-192-6/+11
| | |
* | | Merge branch 'sh-improve-merge-service-logging' into 'master' Robert Speicher2016-10-191-4/+16
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Improve error logging of MergeService Relates to #23505 See merge request !6975
| * | | Identify merge request project and IID in log messagesh-improve-merge-service-loggingStan Hu2016-10-181-1/+7
| | | |
| * | | Improve error logging of MergeServiceStan Hu2016-10-181-4/+10
| | |/ | |/| | | | | | | Relates to #23505
* | | Merge branch '22191-delete-dynamic-envs-mr' into 'master' Rémy Coutable2016-10-191-6/+15
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mrKamil Trzcinski2016-10-181-4/+20
| |\ \
| * | | Fix environments specsKamil Trzcinski2016-10-171-1/+1
| | | |
| * | | Work on specsKamil Trzcinski2016-10-171-2/+2
| | | |
| * | | Improve after code reviewKamil Trzcinski2016-10-171-2/+3
| | | |
| * | | Save `on_stop` in deploymentKamil Trzcinski2016-10-171-1/+2
| | | |
| * | | Add `action` and `on_stop` to `environment` in .gitlab-ci.ymlKamil Trzcinski2016-10-171-13/+9
| | | |
| * | | Refactor code to use available and stopped statuses and refactor views to ↵Kamil Trzcinski2016-10-171-7/+7
| | | | | | | | | | | | | | | | use separate renders
| * | | Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mrKamil Trzcinski2016-10-1728-119/+358
| |\ \ \
| * | | | Initial support for closing environmentsKamil Trzcinski2016-10-061-1/+11
| | | | |
* | | | | Merge remote-tracking branch 'upstream/master' into pipeline-emailspipeline-emailsLin Jen-Shin2016-10-181-4/+20
|\ \ \ \ \ | | |_|/ / | |/| | / | |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 ...
| * | | Merge branch 'master' into merge-conflicts-editor-2Sean McGivern2016-10-172-25/+24
| |\ \ \ | | | |/ | | |/|
| * | | Allow setting content for resolutionsSean McGivern2016-10-131-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When reading conflicts: 1. Add a `type` field. `text` works as before, and has `sections`; `text-editor` is a file with ambiguous conflict markers that can only be resolved in an editor. 2. Add a `content_path` field pointing to a JSON representation of the file's content for a single file. 3. Hitting `content_path` returns a similar datastructure to the `file`, but without the `content_path` and `sections` fields, and with a `content` field containing the full contents of the file (with conflict markers). When writing conflicts: 1. Instead of `sections` being at the top level, they are now in a `files` array. This matches the read format better. 2. The `files` array contains file hashes, each of which must contain: a. `new_path` b. `old_path` c. EITHER `sections` (which works as before) or `content` (with the full content of the resolved file).
* | | | Merge remote-tracking branch 'upstream/master' into pipeline-emailsLin Jen-Shin2016-10-171-12/+22
|\ \ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * upstream/master: (148 commits) Fix broken rspec in compare text Added logic to handle a revision input that does not exist in the menu Fix broken Spinach tests caused by changes in !6550 Convert CHANGELOG to Markdown Fix active tab test for branches page Fix merge requests feature tests Wait for ajax call in merge request unsubscribe test Fix 500 error when creating mileston from group page Fix 404 when group path has dot in the name Add the tech writers usernames in the doc_sytleguide doc Fix broken SCSS linter errors due to missing newlines Fix Hash syntax to work for both Ruby 2.1 and 2.3 Fix Spinach merge request diff failures remove ashley since she no longer works here Revert "Improve tabbing usability for sign in page" Don't use member properties in users_spec, and remove loading ref. Clean up stray Sign up ref. Back off the array spreading, bc poltergeist freaks out. Convert dispatcher to es6. Add exists to users routes and fix endpoint. ...
| * | | Merge branch 'feature/process-pipeline-hooks-asynchronously' into 'master' Kamil Trzciński2016-10-141-12/+22
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Execute pipeline hooks asynchronously ## What does this MR do? This MR makes it possible to execute pipeline hooks asynchronously, what should help to improve performance of CI pipeline processing. ## What are the relevant issue numbers? Closes #23056 See merge request !6824
| | * | | Check if project exists before creating deploymentGrzegorz Bizon2016-10-141-0/+6
| | | | |
| | * | | Use trasaction to process build deploymentGrzegorz Bizon2016-10-131-12/+16
| | | | |