gitlab-org--gitlab-foss/spec/models
Rémy Coutable 7e9b41896d Merge branch 'refactor-builds-creation-service' into 'master'
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
2016-08-11 14:27:42 +00:00
..
ci Pre-create all builds for Pipeline when a trigger is received 2016-08-11 15:22:35 +02:00
concerns adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
hooks Clean up project destruction 2016-08-10 09:28:21 -07:00
members New AccessRequests API endpoints for Group & Project 2016-08-10 19:07:05 +02:00
project_services Merge branch 'refactor-builds-creation-service' into 'master' 2016-08-11 14:27:42 +00:00
ability_spec.rb Method for returning issues readable by a user 2016-07-29 12:51:18 +02:00
abuse_report_spec.rb Remove the annotate gem and delete old annotations 2016-05-09 18:00:28 +02:00
appearance_spec.rb Branded login page also in CE 2016-02-26 15:50:51 +01:00
application_setting_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
award_emoji_spec.rb Incorportate feedback 2016-06-01 12:10:08 +02:00
blob_spec.rb Ensure relative paths for video are rewritten as we do for images 2016-07-26 10:22:17 +02:00
broadcast_message_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
build_spec.rb Pre-create all builds for Pipeline when a trigger is received 2016-08-11 15:22:35 +02:00
commit_range_spec.rb Fix note validation spec failures 2016-06-01 10:31:46 -07:00
commit_spec.rb Expand commit message width in repo view 2016-08-02 11:40:44 -05:00
commit_status_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
compare_spec.rb switch from diff_file_collection to diffs 2016-08-03 07:00:20 +02:00
deploy_key_spec.rb Remove the annotate gem and delete old annotations 2016-05-09 18:00:28 +02:00
deploy_keys_project_spec.rb Remove the annotate gem and delete old annotations 2016-05-09 18:00:28 +02:00
deployment_spec.rb Improve manual actions code and add model, service and feature tests 2016-07-18 14:46:20 +02:00
diff_note_spec.rb Speedup DiffNote#active? on discussions, preloading noteables and avoid touching git repository to return diff_refs when possible 2016-08-02 16:04:15 +02:00
email_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
environment_spec.rb Use Grape DSL for environment endpoints 2016-07-29 20:35:38 +02:00
event_spec.rb Update test with new factory name 2016-07-07 15:57:38 -04:00
external_issue_spec.rb Hide number sign for string prefixed external issues 2016-04-12 10:01:52 +02:00
forked_project_link_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
generic_commit_status_spec.rb Avoid `describe`-ing symbols in specs 2016-07-12 10:27:58 -05:00
global_milestone_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
group_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
identity_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
issue_spec.rb Method for returning issues readable by a user 2016-07-29 12:51:18 +02:00
key_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
label_link_spec.rb Remove the annotate gem and delete old annotations 2016-05-09 18:00:28 +02:00
label_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
legacy_diff_note_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
member_spec.rb New AccessRequests API endpoints for Group & Project 2016-08-10 19:07:05 +02:00
merge_request_diff_spec.rb change the API on the merge_request_diff model from diffs -> raw_diffs 2016-08-03 23:32:12 +02:00
merge_request_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
milestone_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
namespace_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
note_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
notification_setting_spec.rb Exclude projects pending delete from notifications 2016-07-07 20:49:17 +01:00
personal_access_token_spec.rb Fix rubocop spec. 2016-06-03 10:11:36 +05:30
project_group_link_spec.rb Bring ProjectGroupLink model and migrations from EE 2016-03-11 17:47:05 +01:00
project_security_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
project_snippet_spec.rb Remove the annotate gem and delete old annotations 2016-05-09 18:00:28 +02:00
project_spec.rb Add a method in Project to return a cached value of total count of projects 2016-08-09 16:08:03 -07:00
project_team_spec.rb Only use RequestStore in ProjectTeam#max_member_access_for_user if it is active 2016-08-01 13:11:45 -07:00
project_wiki_spec.rb Fix hook data for Wiki Page event 2016-05-31 11:24:58 -03:00
protected_branch_spec.rb Support wildcard matches for protected branches at the model level. 2016-07-05 10:50:34 +05:30
release_spec.rb Remove the annotate gem and delete old annotations 2016-05-09 18:00:28 +02:00
repository_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
service_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
snippet_spec.rb Fix visibility of private project snippets for members when searching 2016-06-22 20:09:19 -03:00
spam_log_spec.rb Refactor Admin::SpamLogsController to block user before destroying 2016-02-02 11:25:44 -02:00
todo_spec.rb Remove the annotate gem and delete old annotations 2016-05-09 18:00:28 +02:00
tree_spec.rb Prioritize previewable over plain README files 2016-01-25 11:27:07 -02:00
user_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
wiki_page_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00