gitlab-org--gitlab-foss/app/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 Pre-create all builds for Pipeline when a trigger is received 2016-08-11 15:22:35 +02:00
hooks
members New AccessRequests API endpoints for Group & Project 2016-08-10 19:07:05 +02:00
network
project_services Replace the tinder gem by bare HTTP requests 2016-08-11 08:52:13 +02:00
protected_branch Implement final review comments from @rymai. 2016-07-29 15:20:39 +05:30
.gitkeep
ability.rb Move abilities by subject class to a dedicated method 2016-08-04 16:00:31 +02:00
abuse_report.rb
appearance.rb
application_setting.rb
audit_event.rb
award_emoji.rb
blob.rb Ensure relative paths for video are rewritten as we do for images 2016-07-26 10:22:17 +02:00
broadcast_message.rb
commit.rb Speed up Commit#repo_changes 2016-08-03 19:23:44 +02:00
commit_range.rb
commit_status.rb Pre-create all builds for Pipeline when a trigger is received 2016-08-11 15:22:35 +02:00
compare.rb Make Compare#diffs diff_options a regular argument 2016-08-03 09:32:01 -07:00
deploy_key.rb
deploy_keys_project.rb
deployment.rb
diff_note.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
discussion.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.rb
environment.rb Incorporate feedback 2016-07-29 13:54:45 +02:00
event.rb
external_issue.rb
forked_project_link.rb
generic_commit_status.rb
global_label.rb
global_milestone.rb
group.rb
identity.rb
issue.rb Added concern for a faster "cache_key" method 2016-08-08 16:49:22 +02:00
key.rb Add simple identifier to public SSH keys 2016-08-02 06:56:23 +01:00
label.rb
label_link.rb squashed - fixed label and milestone association problems, updated specs and refactored reader class a bit 2016-08-01 09:57:40 +02:00
legacy_diff_note.rb switch from diff_file_collection to diffs 2016-08-03 07:00:20 +02:00
lfs_object.rb
lfs_objects_project.rb
member.rb Incorporate review comments 2016-07-26 16:53:39 -07:00
merge_request.rb change the API on the merge_request_diff model from diffs -> raw_diffs 2016-08-03 23:32:12 +02:00
merge_request_diff.rb Enable Style/SpaceAroundEqualsInParameterDefault cop 2016-08-06 04:03:01 +02:00
milestone.rb
namespace.rb
note.rb Added concern for a faster "cache_key" method 2016-08-08 16:49:22 +02:00
notification_setting.rb
oauth_access_token.rb
personal_access_token.rb
personal_snippet.rb
project.rb New AccessRequests API endpoints for Group & Project 2016-08-10 19:07:05 +02:00
project_group_link.rb
project_import_data.rb
project_snippet.rb
project_team.rb Fix Rename `add_users_into_project` and `projects_ids` 2016-08-04 08:55:50 -03:00
project_wiki.rb
protected_branch.rb Use `Gitlab::Access` to protected branch access levels. 2016-07-29 15:20:39 +05:30
release.rb
repository.rb Update version_sorter and use new interface for faster tag sorting 2016-08-08 14:36:39 -04:00
security_event.rb
sent_notification.rb
service.rb Make Service.external_wikis return only active external wikis 2016-07-21 10:36:02 +02:00
snippet.rb
spam_log.rb
spam_report.rb
subscription.rb
todo.rb
tree.rb
u2f_registration.rb
user.rb Store OTP secret key in secrets.yml 2016-08-03 15:46:37 +01:00
users_star_project.rb
wiki_page.rb `WikiPage` should have a slug even when not persisted. 2016-07-25 09:22:47 +05:30