gitlab-org--gitlab-foss/app/services
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
..
auth Fix private method visibility in container registry 2016-07-19 15:12:06 +02:00
ci Pre-create all builds for Pipeline when a trigger is received 2016-08-11 15:22:35 +02:00
commits Revert "Revert "Merge branch '18193-developers-can-merge' into 'master' "" 2016-07-18 10:16:56 +02:00
files Merge branch 'master' into rename-repo-files 2016-07-19 11:23:08 +01:00
groups Address feedback 2016-03-22 00:09:20 +01:00
issues Refactor spam validation to a concern that can be easily reused and improve legibility in SpamCheckService 2016-07-26 19:29:16 -05:00
members New AccessRequests API endpoints for Group & Project 2016-08-10 19:07:05 +02:00
merge_requests switch from diff_file_collection to diffs 2016-08-03 07:00:20 +02:00
milestones Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
notes Fix not normalized emoji paths 2016-07-14 08:51:00 +02:00
oauth2 Enable Style/EmptyLinesAroundAccessModifier rubocop cop 2016-06-03 10:34:20 +02:00
projects Clean up project destruction 2016-08-10 09:28:21 -07:00
protected_branches Implement final review comments from @rymai. 2016-07-29 15:20:39 +05:30
search Restrict access to confidential issues on search results 2016-03-17 20:55:59 -03:00
wiki_pages Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
audit_event_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
base_service.rb Tweaks, refactoring, and specs 2016-03-20 21:04:07 +01:00
compare_service.rb switch from diff_file_collection to diffs 2016-08-03 07:00:20 +02:00
create_branch_service.rb Fix of 'Commits being passed to custom hooks are already reachable when using the UI' 2016-07-19 07:45:22 +03:00
create_deployment_service.rb Revert "squashed merge and fixed conflicts" 2016-06-16 12:59:07 +02:00
create_release_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
create_snippet_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
create_spam_log_service.rb Support Akismet spam checking for creation of issues via API 2016-02-02 11:25:44 -02:00
create_tag_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
delete_branch_service.rb Update to gitlab_git 10.4.1 and take advantage of preserved Ref objects 2016-07-28 12:24:47 -04:00
delete_tag_service.rb Update to gitlab_git 10.4.1 and take advantage of preserved Ref objects 2016-07-28 12:24:47 -04:00
delete_user_service.rb Clean up project destruction 2016-08-10 09:28:21 -07:00
destroy_group_service.rb Clean up project destruction 2016-08-10 09:28:21 -07:00
event_create_service.rb Create a "destroyed Milestone" event and keep Milestone events around in the DB 2015-09-15 05:51:11 -07:00
git_hooks_service.rb Better message for git hooks and file locks 2016-07-04 15:31:49 +03:00
git_push_service.rb Pre-create all builds for Pipeline when a trigger is received 2016-08-11 15:22:35 +02:00
git_tag_push_service.rb Pre-create all builds for Pipeline when a trigger is received 2016-08-11 15:22:35 +02:00
gravatar_service.rb Add support for HiDPI displays in gravatar service 2015-09-26 20:53:16 +02:00
import_export_clean_up_service.rb using shared path for project import uploads and refactored gitlab remove export worker 2016-08-04 12:51:55 +02:00
issuable_base_service.rb Allow bulk (un)subscription from issues in issue index 2016-07-14 19:36:19 -03:00
notification_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
repair_ldap_blocked_user_service.rb Code style fixes and some code simplified 2016-01-08 16:26:04 -02:00
repository_archive_clean_up_service.rb using shared path for project import uploads and refactored gitlab remove export worker 2016-08-04 12:51:55 +02:00
spam_check_service.rb Refactor spam validation to a concern that can be easily reused and improve legibility in SpamCheckService 2016-07-26 19:29:16 -05:00
system_hooks_service.rb Revert "Fix merge conflicts - squashed commit" 2016-06-03 11:10:17 +02:00
system_note_service.rb Refactor system notes service to make it singleton 2016-07-19 15:12:14 +02:00
test_hook_service.rb Added X-GitLab-Event header for web hooks 2015-05-08 16:49:03 +03:00
todo_service.rb When Issue author assign or mention himself Todos are created 2016-07-14 10:56:44 +02:00
update_release_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00
update_snippet_service.rb Services: code style fixes, minor refactoring 2016-07-06 20:58:43 +03:00