summaryrefslogtreecommitdiff
path: root/app/models
Commit message (Collapse)AuthorAgeFilesLines
* Move to project dropdown with infinite scroll for better performance17932-move-to-project-dropdown-improvePaco Guzman2016-08-172-0/+9
| | | | | | | | Use just SQL to check is a user can admin_issue on a project Tradeoff - we duplicate how we check admin_issue in a SQL relation in the Ability class
* Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ↵Kamil Trzcinski2016-08-168-12/+91
|\ | | | | | | pipeline-hooks-without-slack
| * Backport changes from gitlab-org/gitlab-ee!581 to CE.Timothy Andrew2016-08-164-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | !581 has a lot of changes that would cause merge conflicts if not properly backported to CE. This commit/MR serves as a better foundation for gitlab-org/gitlab-ee!581. = Changes = 1. Move from `has_one {merge,push}_access_level` to `has_many`, with the `length` of the association limited to `1`. This is _effectively_ a `has_one` association, but should cause less conflicts with EE, which is set to `has_many`. This has a number of related changes in the views, specs, and factories. 2. Make `gon` variable loading more consistent (with EE!581) in the `ProtectedBranchesController`. Also use `::` to prefix the `ProtectedBranches` services, because this is required in EE. 3. Extract a `ProtectedBranchAccess` concern from the two access level models. This concern only has a single `humanize` method here, but will have more methods in EE. 4. Add `form_errors` to the protected branches creation form. This is not strictly required for EE compatibility, but was an oversight nonetheless.
| * Further refactor and syntax fixes.Patricio Cano2016-08-153-39/+17
| |
| * Refactored AkismetHelper into AkismetService and cleaned up `Spammable`Patricio Cano2016-08-152-50/+31
| | | | | | | | - Refactored SpamCheckService into SpamService
| * Allow `Issue` to be submitted as spamPatricio Cano2016-08-151-3/+15
| | | | | | | | | | - Added controller actions as reusable concerns - Added controller tests
| * Allow `SpamLog` to be submitted as hamPatricio Cano2016-08-151-0/+4
| | | | | | | | | | - Added `submitted_as_ham` to `SpamLog` to mark which logs have been submitted to Akismet. - Added routes and controller action.
| * Refactored spam related code even furtherPatricio Cano2016-08-152-16/+41
| | | | | | | | | | | | | | - Removed unnecessary column from `SpamLog` - Moved creation of SpamLogs out of its own service and into SpamCheckService - Simplified code in SpamCheckService. - Moved move spam related code into Spammable concern
| * Complete refactor of the `Spammable` concern and tests:Patricio Cano2016-08-153-17/+58
| | | | | | | | | | | | | | - Merged `AkismetSubmittable` into `Spammable` - Clean up `SpamCheckService` - Added tests for `Spammable` - Added submit (ham or spam) options to `AkismetHelper`
| * Lay the ground works to submit information to AkismetPatricio Cano2016-08-153-0/+32
| | | | | | | | | | | | - New concern `AkismetSubmittable` to allow issues and other `Spammable` models to be submitted to Akismet. - New model `UserAgentDetail` to store information needed for Akismet. - Services needed for their creation and tests.
* | Revert unrelevant changespipeline-hooks-without-slackKamil Trzcinski2016-08-161-2/+3
| |
* | Merge remote-tracking branch 'origin/master' into pipeline-hooks-without-slackKamil Trzcinski2016-08-157-6/+60
|\ \ | |/
| * Merge branch 'ee-parity' into 'master' Robert Speicher2016-08-151-0/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Add method missing from EE ## Why was this MR needed? `ProjectWiki#repository_exists?` is present in EE but not on CE, and there's no particular reason why it shouldn't See merge request !5802
| | * Add method missing from EEee-parityAlejandro Rodríguez2016-08-121-0/+4
| | |
| * | Merge branch 'zj-deployment-status-on-mr' into 'master' Douwe Maan2016-08-153-0/+20
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Show deployment status on a MR view ## What are the relevant issue numbers? Resolves #19571, one in the list of #19992 ## Screenshots (if relevant) external_url = nil ![Screen_Shot_2016-08-02_at_13.57.03](/uploads/20ea1587eea556c7a1acd0ff726a5bfb/Screen_Shot_2016-08-02_at_13.57.03.png) external_url != nil ![Screen_Shot_2016-08-02_at_13.59.59](/uploads/0094b9ddece3f4bf76c83988840c096d/Screen_Shot_2016-08-02_at_13.59.59.png) Note, the timings are weird between merging and deploying, that is because I did it in the wrong order. ## 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 See merge request !5622
| | * | Method names changed to #includes_commit?zj-deployment-status-on-mrZ.J. van de Weg2016-08-123-5/+6
| | | |
| | * | Incorporate feedbackZ.J. van de Weg2016-08-113-6/+6
| | | |
| | * | Show deployment status on a MR viewZ.J. van de Weg2016-08-113-0/+19
| | | |
| * | | Merge branch 'svg-render-size-limit' into 'master' Douwe Maan2016-08-151-0/+7
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Limit the size of SVGs when viewing them as blobs ## What does this MR do? This MR prevents rendering of SVG blobs larger than 2 MB. ## Are there points in the code the reviewer needs to double check? I couldn't figure out how to properly test the view for this as this requires a large SVG (inflating the repository size) _or_ stubbing, the latter doesn't really seem possible using Spinach and all the stuff potentially involved. ## Why was this MR needed? When rendering large SVG blobs (e.g. 20 MB files) a request may time out and consume a lot of memory. ## What are the relevant issue numbers? #1435 ## Screenshots (if relevant) ![svg_notice](/uploads/c8de32522eda95a41a24555c3f85bfc1/svg_notice.jpg) ## Does this MR meet the acceptance criteria? - [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 - [ ] All builds are passing - [ ] 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) cc @jschatz1 @annabeldunstone (there are some UI changes, see the above screenshot). See merge request !5794
| | * | | Limit the size of SVGs when viewing them as blobssvg-render-size-limitYorick Peterse2016-08-151-0/+7
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that SVGs greater than 2 megabytes are not scrubbed and rendered. This in turn prevents requests from timing out due to reading/scrubbing large SVGs potentially taking a lot of time (and memory). The use of 2 megabytes is completely arbitrary. Fixes gitlab-org/gitlab-ce#1435
| * | | Merge branch '20842-todos-queries-cache' into 'master' Yorick Peterse2016-08-151-2/+2
| |\ \ \ | | | | | | | | | | | | | | | | | | | | Try to get back todo's cache or at least avoid hitting the database See merge request !5789
| | * | | Use cache for todos counter calling TodoServicePaco Guzman2016-08-121-2/+2
| | | | |
| * | | | Ability to specify branches for pivotal tracker integrationEgor Lynko2016-08-151-4/+27
| | |/ / | |/| |
* | | | Merge remote-tracking branch 'origin/master' into pipeline-hooks-without-slackKamil Trzcinski2016-08-131-0/+2
|\ \ \ \ | |/ / /
| * | | Merge branch 'fix-namespace-deletion' into 'master' Robert Speicher2016-08-121-0/+2
| |\ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix bug where destroying a namespace would not always destroy projects There is a race condition in DestroyGroupService now that projects are deleted asynchronously: 1. User attempts to delete group 2. DestroyGroupService iterates through all projects and schedules a Sidekiq job to delete each Project 3. DestroyGroupService destroys the Group, leaving all its projects without a namespace 4. Projects::DestroyService runs later but the can?(current_user, :remove_project) is `false` because the user no longer has permission to destroy projects with no namespace. 5. This leaves the project in pending_delete state with no namespace/group. Projects without a namespace or group also adds another problem: it's not possible to destroy the container registry tags, since `container_registry_path_with_namespace` is the wrong value. The fix is to destroy the group asynchronously and run `execute` directly on Projects::DestroyService. Closes #17893 See merge request !4341
| | * | Fix bug where destroying a namespace would not always destroy projectsStan Hu2016-08-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a race condition in DestroyGroupService now that projects are deleted asynchronously: 1. User attempts to delete group 2. DestroyGroupService iterates through all projects and schedules a Sidekiq job to delete each Project 3. DestroyGroupService destroys the Group, leaving all its projects without a namespace 4. Projects::DestroyService runs later but the can?(current_user, :remove_project) is `false` because the user no longer has permission to destroy projects with no namespace. 5. This leaves the project in pending_delete state with no namespace/group. Projects without a namespace or group also adds another problem: it's not possible to destroy the container registry tags, since container_registry_path_with_namespace is the wrong value. The fix is to destroy the group asynchronously and to run execute directly on Projects::DestroyService. Closes #17893
* | | | Merge remote-tracking branch 'origin/master' into pipeline-hooks-without-slackKamil Trzcinski2016-08-124-22/+11
|\ \ \ \ | |/ / /
| * | | Merge branch 'improve-pipeline-processing' into 'master' Rémy Coutable2016-08-123-43/+89
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve pipeline processing ## What does this MR do? This works on top of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5295 trying to solve some edge cases introduced by that Merge Request. The fix switches to a state machine which is already a part of `Ci::Pipeline` and uses events with conditional transitions to switch between pipeline states. This is approach is much more bullet proof and much easier to understand than a previous one where we were calling a `reload_status!` which manually updated `status`. Previous approach become confusing and prone to number of errors. ## Why was this MR needed? This improves changes introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5295 ## What are the relevant issue numbers? None, yet. ## Screenshots (if relevant) Not needed. ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added (not needed since changelog for https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5295 is already introduced) - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] API support added (not needed) - Tests - [x] Added for this feature/bug (most of tests do cover the triggering of Pipeline) - [ ] 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) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5782
| | * | | Improve transition between states for event `enqueue`Kamil Trzcinski2016-08-121-1/+1
| | | | |
| | * | | Use event `enqueue` instead of `queue`Kamil Trzcinski2016-08-123-16/+10
| | | | |
| | * | | Fix test failuresKamil Trzcinski2016-08-121-1/+1
| | | | |
| * | | | Merge branch 'remove-unused-spam-report' into 'master' Robert Speicher2016-08-111-5/+0
| |\ \ \ \ | | |_|/ / | |/| | | | | | | | | | | | | Remove unused SpamReport model; this was renamed to SpamLog See merge request !5778
| | * | | Remove unused SpamReport model; this was renamed to SpamLogremove-unused-spam-reportStan Hu2016-08-111-5/+0
| | | | |
* | | | | Fix test failuresKamil Trzcinski2016-08-121-1/+1
| | | | |
* | | | | Make `execute_methods` publicKamil Trzcinski2016-08-121-2/+2
| | | | |
* | | | | Merge branch 'improve-pipeline-processing' into pipeline-hooks-without-slackKamil Trzcinski2016-08-124-49/+96
|\ \ \ \ \ | | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | # Conflicts: # app/models/ci/pipeline.rb # app/models/commit_status.rb # app/services/ci/create_pipeline_service.rb # spec/models/ci/pipeline_spec.rb
| * | | | Added specs for started_at and finished_atKamil Trzcinski2016-08-121-7/+8
| | | | |
| * | | | Use explicit events to transition between statesKamil Trzcinski2016-08-122-13/+33
| | | | |
| * | | | Merge remote-tracking branch 'origin/master' into improve-pipeline-processingKamil Trzcinski2016-08-121-0/+1
| |\ \ \ \ | | |/ / /
| | * | | api for generating new merge requestScott Le2016-08-111-0/+1
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DRY code + fix rubocop Add more test cases Append to changelog DRY changes list find_url service for merge_requests use GET for getting merge request links remove files rename to get_url_service reduce loop add test case for cross project refactor tiny thing update changelog
| * | | Fix test failures, that did occur because of missing previously used ↵Kamil Trzcinski2016-08-112-28/+27
| | | | | | | | | | | | | | | | `reload_status!` call
| * | | Use state machine for pipeline event processingKamil Trzcinski2016-08-112-22/+47
| | | |
| * | | Verify the pipeline status after executing events on buildsKamil Trzcinski2016-08-112-1/+8
| |/ /
* | | Simplify the name for data builder, feedback:Lin Jen-Shin2016-08-124-5/+4
| | | | | | | | | | | | https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5620#note_13671791
* | | Fix tests for pipeline eventsKamil Trzcinski2016-08-111-1/+3
| | |
* | | Fix pipeline status change from pending to runningKamil Trzcinski2016-08-112-1/+8
| | |
* | | Remove stage parameter from send payloadKamil Trzcinski2016-08-111-0/+2
| | |
* | | Merge remote-tracking branch 'origin/master' into pipeline-hooks-without-slackKamil Trzcinski2016-08-117-103/+121
|\ \ \ | |/ / | | | | | | | | | | | | | | | # Conflicts: # app/models/ci/pipeline.rb # app/services/ci/create_pipeline_service.rb # spec/models/project_services/hipchat_service_spec.rb
| * | Merge branch 'refactor-builds-creation-service' into 'master' Rémy Coutable2016-08-114-86/+72
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor pipeline creation service ## What does this MR do? This refactors GitLab CI build processing: all builds for pipeline are pre-created when a pipeline object is created. The builds are created with a new introduced status `created`. The builds are then automatically promoted to `pending` when a previous stage do succeed. This significantly simplifies pipeline processing code solving a lot of problems of lazily initialisation of previous approach (builds were created on-demand). ## Why was this MR needed? The previous mechanism had a lot of flows (shown in related issues) in how it work, but also in code design. Removing cross model-service-library dependencies. The current approach moves a build creation to single place `CreatePipelineService` and removes a dynamic dependency on `config_processor` significantly simplifying a build creation and pipeline processing. Pipeline processing is implemented in `ProcessPipelineService`. This also allows to easily extend GitLab with Manual Actions which is part of 8.10 direction issue. ## Migration problem ~~This MR removes the a on-demand creation of builds in pipelines. Pipelines that are running and are in mid-stage (some stages started, but not all) will not be fully evaluated after application restart. This happens, because the code responsible for on-demand creation is removed. There's no easy way to migrate existing pipelines, other than doing offline migration and putting pipeline processing in migration code (which seems to be a really bad idea).~~ To support old pipelines I added a lazy initialization of builds if none is found. ## What are the relevant issue numbers? Fixes: https://gitlab.com/gitlab-org/gitlab-ce/issues/12839 Solves: https://gitlab.com/gitlab-org/gitlab-ce/issues/18644 https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/289 Allows to easily implement: https://gitlab.com/gitlab-org/gitlab-ce/issues/17010 ## Does this MR meet the acceptance criteria? - [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 - [ ] 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) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5295
| | * | Pre-create all builds for Pipeline when a trigger is receivedKamil Trzcinski2016-08-114-86/+72
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change simplifies a Pipeline processing by introducing a special new status: created. This status is used for all builds that are created for a pipeline. We are then processing next stages and queueing some of the builds (created -> pending) or skipping them (created -> skipped). This makes it possible to simplify and solve a few ordering problems with how previously builds were scheduled. This also allows us to visualise a full pipeline (with created builds). This also removes an after_touch used for updating a pipeline state parameters. Right now in various places we explicitly call a reload_status! on pipeline to force it to be updated and saved.