summaryrefslogtreecommitdiff
path: root/app/services/ci
Commit message (Collapse)AuthorAgeFilesLines
* Make the cases clear instead of having guardsslightly-more-readableLin Jen-Shin2016-09-121-3/+3
|
* Project tools visibility levelFelipe Artur2016-09-011-3/+5
|
* Block concurrent pipeline processingsKamil Trzcinski2016-08-311-6/+8
|
* Drop unused CI tables and fileszj-remove-unused-ci-tablesZ.J. van de Weg2016-08-261-35/+0
| | | | | | | | These tables, web hooks and services, are unused but where not dropped with the commits d5c91bb9a601a1a344d94763654f0b0996857497 and 2988e1fbf50b3c9e803a9358933e3e969e64dcc3. The file was left too, but never called.
* rename Statuseable to HasStatusDe Wet Blomerus2016-08-251-1/+1
|
* Use event `enqueue` instead of `queue`Kamil Trzcinski2016-08-121-1/+1
|
* Use state machine for pipeline event processingKamil Trzcinski2016-08-111-2/+3
|
* Pre-create all builds for Pipeline when a trigger is receivedKamil Trzcinski2016-08-115-97/+196
| | | | | | | | | | | 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.
* Add notice implementationKamil Trzcinski2016-07-181-0/+2
|
* Mark builds with manual actions as skippedKamil Trzcinski2016-07-181-1/+3
|
* Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ↵store-variables-and-when-in-builds-tableKamil Trzcinski2016-07-181-0/+1
|\ | | | | | | | | | | | | store-variables-and-when-in-builds-table # Conflicts: # db/schema.rb
| * Track a user who created a pipelineKamil Trzcinski2016-07-151-0/+1
| |
* | Store when and yaml variables in builds tableKamil Trzcinski2016-07-161-1/+3
|/
* Merge remote-tracking branch 'upstream/master' into ↵Lin Jen-Shin2016-06-173-43/+57
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | feature/runner-lock-on-project * upstream/master: (337 commits) Update CHANGELOG for !4659 Center the header logo for all Devise emails Add previews for all customized Devise emails Customize the Devise `unlock_instructions` email Customize the Devise `reset_password_instructions` email Customize the Devise `password_change` emails Use gitlab-git 10.2.0 Use Git cached counters on project show page Fix indentation scss-lint errors Added title attribute to enties in tree view Closes #18353 Banzai::Filter::ExternalLinkFilter use XPath Reduce queries in IssueReferenceFilter Use gitlab_git 10.1.4 Fixed ordering in Project.find_with_namespace Fix images in emails Banzai::Filter::UploadLinkFilter use XPath Turn Group#owners into a has_many association Make project_id nullable CHANGELOG [ci skip] CHANGELOG [ci skip] ...
| * Merge branch 'fix/status-of-pipeline-without-builds' into 'master' Rémy Coutable2016-06-162-38/+40
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve pipeline status in case that pipeline has no jobs ## What does this MR do? This MR resolves problem with pipeline status when there are no build in pipeline. This can happen when builds were skipped - for example - by using `only`/`except` keyword in `.gitlab-ci.yml`. ## What are the relevant issue numbers? Closes #17977 See merge request !4403
| | * Merge branch 'master' into fix/status-of-pipeline-without-buildsfix/status-of-pipeline-without-buildsGrzegorz Bizon2016-06-151-1/+2
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (198 commits) Set inverse_of for Project/Services relation Fix admin hooks spec Prevent default disabled buttons and links. Add index on `requested_at` to the `members` table Rearrange order of tabs Fix admin active tab tests Show created_at in table column Nest li elements directly under ul Move builds tab to admin overview Add monitoring link with subtabs Add sub links to overview Add counter for abuse reports Remove admin layout-nav counters Move admin nav to horizontal layout nav Eager load project relations in IssueParser Use validate and required for environment and project Award Emoji can't be awarded on system notes backend Get rid of Gitlab::ShellEnv Update CHANGELOG. Fix project star tooltip on the fly. ... Conflicts: app/services/ci/create_builds_service.rb
| | * | Remove reduntant method for building pipeline buildsGrzegorz Bizon2016-06-151-1/+2
| | | |
| | * | Merge branch 'master' into fix/status-of-pipeline-without-buildsGrzegorz Bizon2016-06-144-20/+20
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (538 commits) Fix broken URI joining for `teamcity_url` with suffixes Factorize duplicated code into a method in BambooService and update specs Fix broken URI joining for `bamboo_url` with suffixes Honor credentials on calling Bamboo CI trigger Update CHANGELOG Use Issue.visible_to_user in Notes.search to avoid query duplication Project members with guest role can't access confidential issues Allow users to create confidential issues in private projects Update CHANGELOG Remove deprecated issues_tracker and issues_tracker_id from project Schema doesn’t reflect the changes of the last 3 migrations Apply reviewer notes: update CHANGELOG, adjust code formatting Move issue rendering tests into separate contexts Move change description to proper release and fix typo Add more information into RSS fead for issues Revert CHANGELOG Also rename "find" in the specs Change to new Notes styleguide Add guide on changing a document's location Change logs.md location in README ... Conflicts: app/services/ci/create_builds_service.rb app/services/ci/create_pipeline_service.rb app/services/create_commit_builds_service.rb spec/models/ci/commit_spec.rb spec/services/ci/create_builds_service_spec.rb spec/services/create_commit_builds_service_spec.rb
| | * | | Refactor code reponsible for creating buildsGrzegorz Bizon2016-06-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This removes duplications and extracts method that builds build-jobs without persisting those objects, to a separate method.
| | * | | Update CreateCommitBuildsService to pass testsKamil Trzcinski2016-06-031-1/+2
| | | | |
| | * | | Save Ci::Commit object to persist all created buildsKamil Trzcinski2016-06-032-1/+2
| | | | |
| | * | | Do not create pipeline objects when no buildsGrzegorz Bizon2016-06-031-17/+24
| | | | |
| | * | | Add minor improvements in create builds serviceGrzegorz Bizon2016-06-031-7/+2
| | | | |
| | * | | Refactor ci commit pipeline to prevent implicit savesGrzegorz Bizon2016-06-031-13/+11
| | | | |
| * | | | Merge branch 'fair-usage-of-shared-runners' into 'master' Stan Hu2016-06-151-6/+17
| |\ \ \ \ | | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fair usage of Shared Runners ## What does this MR do? Introduces a fair usage scheduler for shared runners. It tries to assign builds to shared runner from projects that have the lowest number of builds currently running on shared runners. **Example 1**: ``` We have following builds in queue: build 1 for project 1 build 2 for project 1 build 3 for project 1 build 4 for project 2 build 5 for project 2 build 6 for project 3 With the new algorithm we will assign builds in following order: - We choose build 1, because project 1 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds, - We choose build 4, because project 2 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds, - We choose build 6, because project 3 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds, - We choose build 2, because project 1 as other it runs 1 build, - We choose build 5, because project 2 runs 1 build, where project 1 runs 2 builds now, - We choose build 3, because project 1 and runs 2 builds. ``` **Example 2**: ``` We have following builds in queue: build 1 for project 1 build 2 for project 1 build 3 for project 1 build 4 for project 2 build 5 for project 2 build 6 for project 3 With the new algorithm we will assign builds in following order: - We choose build 1, because project 1 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds, - We finish build 1, - We choose build 2, because project 1 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds, - We choose build 4, because project 2 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds, - We finish build 4, - We choose build 5, because project 2 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds, - We choose build 6, because project 3 doesn't run currently any builds, - We choose build 3, because project 1, 2 and 3 runs exactly one build now, ``` ## Why was this MR needed? Currently, we are scheduling builds using FIFO. This is catastrophic if there are projects that create a 100-300 jobs, this basically eats most of available shared runners. ## Performance All this logic is implemented with the help of SQL queries, because this is the fastest way to process 1k-2k pending builds in queue. It's not the fastest SQL query, because it sorts based on number of running_builds, and this forces to calculate a number of running builds for all dependent projects. However, since we have one/two shared runners that asks every few seconds for builds this should have minimal impact on DB performance. ``` explain analyze SELECT "ci_builds".* FROM "ci_builds" JOIN (SELECT "ci_builds"."gl_project_id", count(case when status = 'running' AND runner_id = (SELECT "ci_runners"."id" FROM "ci_runners" WHERE "ci_runners"."is_shared" = 't') then 1 end) as running_builds FROM "ci_builds" INNER JOIN "projects" ON "projects"."id" = "ci_builds"."gl_project_id" AND "projects"."pending_delete" = 'f' WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."status" IN ('running', 'pending') AND "projects"."builds_enabled" = 't' AND "projects"."shared_runners_enabled" = 't' GROUP BY "ci_builds"."gl_project_id") AS projects ON ci_builds.gl_project_id=projects.gl_project_id WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."status" = 'pending' AND "ci_builds"."runner_id" IS NULL ORDER BY projects.running_builds ASC, ci_builds.id ASC; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- Sort (cost=64777.28..64777.29 rows=1 width=1010) (actual time=301.794..302.535 rows=1537 loops=1) Sort Key: (count(CASE WHEN (((public.ci_builds.status)::text = 'running'::text) AND (public.ci_builds.runner_id = $0)) THEN 1 ELSE NULL::integer END)), public.ci _builds.id Sort Method: quicksort Memory: 1423kB -> Nested Loop (cost=63279.78..64777.27 rows=1 width=1010) (actual time=66.384..298.724 rows=1537 loops=1) -> HashAggregate (cost=63177.15..63177.30 rows=15 width=15) (actual time=65.641..65.851 rows=187 loops=1) InitPlan 1 (returns $0) -> Seq Scan on ci_runners (cost=0.00..26963.66 rows=1 width=4) (actual time=1.145..34.381 rows=1 loops=1) Filter: is_shared Rows Removed by Filter: 6965 -> Nested Loop (cost=0.00..36186.34 rows=2715 width=15) (actual time=0.065..29.717 rows=1710 loops=1) -> Index Scan using index_ci_builds_on_status on ci_builds (cost=0.00..8913.95 rows=3577 width=15) (actual time=0.051..12.012 rows=2583 loops =1) Index Cond: ((status)::text = ANY ('{running,pending}'::text[])) Filter: ((type)::text = 'Ci::Build'::text) Rows Removed by Filter: 1219 -> Index Scan using projects_pkey on projects (cost=0.00..7.61 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=2583) Index Cond: (id = public.ci_builds.gl_project_id) Filter: ((NOT pending_delete) AND builds_enabled AND shared_runners_enabled) Rows Removed by Filter: 0 -> Bitmap Heap Scan on ci_builds (cost=102.63..106.64 rows=1 width=1002) (actual time=1.216..1.231 rows=8 loops=187) Recheck Cond: ((gl_project_id = public.ci_builds.gl_project_id) AND ((status)::text = 'pending'::text)) Filter: ((runner_id IS NULL) AND ((type)::text = 'Ci::Build'::text)) -> BitmapAnd (cost=102.63..102.63 rows=1 width=0) (actual time=1.201..1.201 rows=0 loops=187) -> Bitmap Index Scan on index_ci_builds_on_gl_project_id (cost=0.00..10.52 rows=241 width=0) (actual time=0.406..0.406 rows=1944 loops=187) Index Cond: (gl_project_id = public.ci_builds.gl_project_id) -> Bitmap Index Scan on index_ci_builds_on_status (cost=0.00..91.78 rows=3089 width=0) (actual time=0.652..0.652 rows=3362 loops=187) Index Cond: ((status)::text = 'pending'::text) Total runtime: 303.832 ms ``` ## Specific runners It doesn't affect the specific runners which still serve builds FIFO. @stanhu @markpundsack @yorickpeterse What do you think? See merge request !4634
| | * | | Fix typoKamil Trzcinski2016-06-151-1/+1
| | | | |
| | * | | Optimise SQL queryKamil Trzcinski2016-06-141-13/+11
| | | | |
| | * | | Fair usage of Shared RunnersKamil Trzcinski2016-06-131-6/+19
| | | |/ | | |/|
| * | | Added initial version of deploymentsKamil Trzcinski2016-06-101-1/+2
| |/ /
* | | Merge branch 'master' into feature/runner-lock-on-projectLin Jen-Shin2016-06-141-1/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (147 commits) Update CHANGELOG Remove deprecated issues_tracker and issues_tracker_id from project Schema doesn’t reflect the changes of the last 3 migrations Revert CHANGELOG Also rename "find" in the specs Change to new Notes styleguide Add guide on changing a document's location Change logs.md location in README Move logs/logs.md to administration/logs.md Make "four phase test" Only show branches for revert / cherry-pick Instrument all Banzai::ReferenceParser classes Removed old comment from update_column_in_batches Update columns in batches until no rows are left Remove counters from Pipeline navigation Handle NULL migration errors in migration helpers Fix typo causing related branches to Error 500 Improved SVG sanitizer specs to include smoke tests for clean. Refactored SVG sanitizer Added SVG sanitizer fix to the changelog ...
| * | Rename commit to pipeline in TriggerRequestKamil Trzcinski2016-06-091-1/+1
| | |
* | | Remove Build#can_be_served? and rename Runner#can_serve? to can_pick?Lin Jen-Shin2016-06-091-1/+1
|/ / | | | | | | This also moves tests from build_spec.rb to runner_spec.rb
* | Merge branch 'rename-ci-commit-phase-2' into rename-ci-commit-phase-3Kamil Trzcinski2016-06-071-1/+1
|\ \
| * | Fix tests failuresKamil Trzcinski2016-06-071-1/+1
| | |
* | | Rename all ci_commit[s] in application code to pipeline[s]Kamil Trzcinski2016-06-032-6/+6
|/ /
* | Rename `commit` to `pipeline` in application codeKamil Trzcinski2016-06-031-9/+9
| |
* | Rename Ci::Commit to Ci::Pipeline and rename some of the ci_commit to pipelineKamil Trzcinski2016-06-023-4/+4
|/
* Create pipeline objects with parameterswith-pipeline-viewKamil Trzcinski2016-05-181-3/+1
|
* Use pipelines.errors when communicating the errorKamil Trzcinski2016-05-181-14/+22
|
* Add method new_pipelineKamil Trzcinski2016-05-141-4/+6
|
* Fix CI testsKamil Trzcinski2016-05-121-1/+1
|
* Improve pipelines designKamil Trzcinski2016-05-101-0/+42
|
* Fix rest of rspec and spinach testsKamil Trzcinski2016-04-121-1/+1
|
* Fix specsKamil Trzcinski2016-04-113-8/+9
|
* Use Ci::Commit as PipelineKamil Trzcinski2016-04-112-10/+19
|
* add 'triggers' keyword to gitlab-ci.yml 'only' and 'except' fields to allow ↵Jason Roehm2016-03-151-1/+1
| | | | control over whether triggers will cause jobs to run
* Cleanup CiCommit and CiBuildKamil Trzcinski2016-03-141-1/+1
| | | | | | - Remove all view related methods from Ci::Build and CommitStatus - Remove unused Ci::Commit and Ci::Build methods - Use polymorphism to render different types of CommitStatus
* Return a builds array in builds create serviceGrzegorz Bizon2016-02-181-0/+1
|
* Improve CI status badge implementationGrzegorz Bizon2016-02-111-12/+7
|
* Run builds from projects with enabled CIci-project-migrateKamil Trzcinski2015-12-111-1/+1
|