Commit Graph

147 Commits

Author SHA1 Message Date
Steve Azzopardi c80abb40fc
Add retried jobs to pipeline stages
closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50461
2018-09-13 17:31:52 +02:00
Yorick Peterse 7a233b37cd
Remove code for dynamically generating routes
This adds a database migration that creates routes for any projects and
namespaces that don't already have one. We also remove the runtime code
for dynamically creating routes, as this is no longer necessary.
2018-07-25 16:41:29 +02:00
Rémy Coutable b7b3a059f9
Allow 2 more queries in spec/controllers/projects/pipelines_controller_spec.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-07-05 13:28:46 +02:00
Bob Van Landuyt 04b046587f Add pipeline lists to GraphQL
This adds Keyset pagination to GraphQL lists. PoC for that is
pipelines on merge requests and projects.

When paginating a list, the base-64 encoded id of the ordering
field (in most cases the primary key) can be passed in the `before` or
`after` GraphQL argument.
2018-07-04 10:53:39 +02:00
Douwe Maan 290ca339ad Merge branch 'feature/customizable-favicon' into 'master'
Customizable favicon

Closes #15661

See merge request gitlab-org/gitlab-ce!14497
2018-06-07 16:54:41 +00:00
Alexis Reigel 949c30d42b
remove all .ico favicon variations, use png always
the ci status icons are generated client side, wo we don't need the
static files anymore.
2018-06-05 16:20:22 +02:00
Grzegorz Bizon 3662f14769 Improve specs for pipelines controller 2018-05-29 17:19:39 +02:00
Grzegorz Bizon bc9a0e10b5 Reduce amount of expected pipeline serialization queries in specs 2018-05-23 14:22:22 +02:00
Grzegorz Bizon dab3ae39a2 Do not paginate pipelines active relation twice 2018-05-23 13:29:21 +02:00
Grzegorz Bizon 0b3cca568d Fix rubocop offense in pipeline controller specs 👮 2018-05-22 14:38:25 +02:00
Grzegorz Bizon ea35fd05bb Refactor pipeline preloader to split reponsibilities better 2018-05-22 13:55:05 +02:00
Grzegorz Bizon 76a7157c76 Abstract persisted/legacy stages in pipeline model 2018-05-22 13:04:07 +02:00
Grzegorz Bizon 6c63f96e0a Preload number of warnings in every stage in a pipeline
This makes it possible to avoid N+1 queries when loading pipelines
table.
2018-05-22 12:30:45 +02:00
Grzegorz Bizon 631bd9bf08 Use persisted stages to load pipelines index table 2018-05-21 15:13:32 +02:00
Yorick Peterse 878ca2e69b
Exclude coverage data from the pipelines page
When displaying a project's pipelines
(Projects::PipelinesController#index) we now exclude the coverage data.
This data was not used by the frontend, yet getting it would require one
SQL query per pipeline. These queries in turn could be quite expensive
on GitLab.com.
2018-05-17 13:53:00 +02:00
Yorick Peterse 70985aa19b
Limit the number of pipelines to count
When displaying the project pipelines dashboard we display a few tabs
for different pipeline states. For every such tab we count the number of
pipelines that belong to it. For large projects such as GitLab CE this
means having to count over 80 000 rows, which can easily take between 70
and 100 milliseconds per query.

To improve this we apply a technique we already use for search results:
we limit the number of rows to count. The current limit is 1000, which
means that if more than 1000 rows are present for a state we will show
"1000+" instead of the exact number. The SQL queries used for this
perform much better than a regular COUNT, even when a project has a lot
of pipelines.

Prior to these changes we would end up running a query like this:

    SELECT COUNT(*)
    FROM ci_pipelines
    WHERE project_id = 13083
    AND status IN ('success', 'failed', 'canceled')

This would produce a plan along the lines of the following:

    Aggregate  (cost=3147.55..3147.56 rows=1 width=8) (actual time=501.413..501.413 rows=1 loops=1)
      Buffers: shared hit=17116 read=861 dirtied=2
      ->  Index Only Scan using index_ci_pipelines_on_project_id_and_ref_and_status_and_id on ci_pipelines  (cost=0.56..2984.14 rows=65364 width=0) (actual time=0.095..490.263 rows=80388 loops=1)
            Index Cond: (project_id = 13083)
            Filter: ((status)::text = ANY ('{success,failed,canceled}'::text[]))
            Rows Removed by Filter: 2894
            Heap Fetches: 353
            Buffers: shared hit=17116 read=861 dirtied=2
    Planning time: 1.409 ms
    Execution time: 501.519 ms

Using the LIMIT count technique we instead run the following query:

    SELECT COUNT(*)
    FROM (
        SELECT 1
        FROM ci_pipelines
        WHERE project_id = 13083
        AND status IN ('success', 'failed', 'canceled')
        LIMIT 1001
    ) for_count

This query produces the following plan:

    Aggregate  (cost=58.77..58.78 rows=1 width=8) (actual time=1.726..1.727 rows=1 loops=1)
      Buffers: shared hit=169 read=15
      ->  Limit  (cost=0.56..46.25 rows=1001 width=4) (actual time=0.164..1.570 rows=1001 loops=1)
            Buffers: shared hit=169 read=15
            ->  Index Only Scan using index_ci_pipelines_on_project_id_and_ref_and_status_and_id on ci_pipelines  (cost=0.56..2984.14 rows=65364 width=4) (actual time=0.162..1.426 rows=1001 loops=1)
                  Index Cond: (project_id = 13083)
                  Filter: ((status)::text = ANY ('{success,failed,canceled}'::text[]))
                  Rows Removed by Filter: 9
                  Heap Fetches: 10
                  Buffers: shared hit=169 read=15
    Planning time: 1.832 ms
    Execution time: 1.821 ms

While this query still uses a Filter for the "status" field the number
of rows that it may end up filtering (at most 1001) is small enough that
an additional index does not appear to be necessary at this time.

See https://gitlab.com/gitlab-org/gitlab-ce/issues/43132#note_68659234
for more information.
2018-05-17 13:52:59 +02:00
Matija Čupić a6866fbcab
Align elements of the hash literal parameter 2018-05-02 18:00:12 +02:00
Kamil Trzciński 6ea31cb7cd Add stages_ajax endpoint to serve old HTML 2018-05-02 00:05:03 +02:00
Zeger-Jan van de Weg c6edae3887
Load commit in batches for pipelines#index
Uses `list_commits_by_oid` on the CommitService, to request the needed
commits for pipelines. These commits are needed to display the user that
created the commit and the commit title.

This includes fixes for tests failing that depended on the commit
being `nil`. However, now these are batch loaded, this doesn't happen
anymore and the commits are an instance of BatchLoader.
2017-12-19 10:05:40 +01:00
Zeger-Jan van de Weg 3411fef1df
Cache commits on the repository model
Now, when requesting a commit from the Repository model, the results are
not cached. This means we're fetching the same commit by oid multiple times
during the same request. To prevent us from doing this, we now cache
results. Caching is done only based on object id (aka SHA).

Given we cache on the Repository model, results are scoped to the
associated project, eventhough the change of two repositories having the
same oids for different commits is small.
2017-10-27 12:49:11 +02:00
Jacopo 2f40dac352 Refactor `have_http_status` into `have_gitlab_http_status` in the specs 2017-10-20 10:13:18 +02:00
Zeger-Jan van de Weg 61f4d08b7b
Allow testing on Gitaly call count
Previous efforts were aimed at detecting N + 1 queries, general
regressions are hard to find and mitigate.
2017-10-16 13:25:51 +02:00
Mike Greiling 7b262c4356 Resolve "Precompiled assets with digest strings are ignored in CI" 2017-10-03 14:47:56 +00:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Robert Speicher 9513bd18c4 Ensure all project factories use `:repository` trait or `:empty_project` 2017-08-01 14:51:52 -04:00
Lin Jen-Shin 7bd5e57125 Instead of adding master, stub_not_protect_default_branch 2017-07-18 23:48:14 +08:00
Lin Jen-Shin 28553dbc05 Update tests due to permission changes 2017-07-04 21:56:41 +08:00
Kamil Trzcinski 25b99a5b3b Update tests and application 2017-06-13 16:05:38 +02:00
Oswaldo Ferreira 34ba80392d Use :request_store hooks on specs 2017-06-09 18:18:36 -03:00
Z.J. van de Weg 63da91725e Improve pipeline size for query limit test
The pipeline was quite meagre in both stages and the number of groups.
This has been improved. Performance is not yet optimal, but to limit
this from sliding further this slippery slope, a hard limit has been
set.
2017-05-17 15:06:32 +02:00
Zeger-Jan van de Weg c17e6a6c68 Real time pipeline show action 2017-05-06 16:45:46 +00:00
Grzegorz Bizon 4f3dc19aaf Add specs for new pipeline action for JSON format 2017-05-05 09:32:13 +02:00
Jacopo ff76adb547 Unnecessary "include WaitForAjax" and "include ApiHelpers"
Removed all the unnecessary include of `WaitForAjax` and `ApiHelpers` in the specs.
Removed unnecessary usage of `api:true`
2017-04-21 22:32:02 +02:00
Luke "Jared" Bennett b544d8fade
Review changes, used eq instead of match 2017-04-17 13:18:40 +01:00
Luke "Jared" Bennett b24cb99856
Updated specs 2017-04-13 12:50:03 +01:00
Shinya Maeda a375d80eb0 Use detailed_status effectively. Remove unnecesarry context(nest). Add new context in merge_requests_controller_spec.rb and fix a bug. Correct description of spec. 2017-03-23 17:11:49 +09:00
Shinya Maeda 08a0bc5397 Add more specs 2017-03-23 17:11:49 +09:00
Shinya Maeda 38b1ec2cc0 Fix rspec failure 2017-03-23 17:11:49 +09:00
Shinya Maeda 3b63500297 3 lines to One line. Correct spec caption. 2017-03-23 17:11:49 +09:00
Shinya Maeda f8d6e81b92 Fix rubocop anger 2017-03-23 17:11:49 +09:00
Shinya Maeda 4fa4a2ce99 Add controllers spec 2017-03-23 17:11:48 +09:00
Douwe Maan ad640bc5f9 Use Namespace#full_path instead of #path where appropriate 2017-02-23 17:55:01 -06:00
Filipa Lacerda 66bca235c1 Adds missing tests for all status accepted in scope 2017-02-23 13:44:58 +00:00
Filipa Lacerda 0f36cfd7f5 Adds Pending and Finished tabs to pipelines page
Fix broken test
2017-02-16 22:25:01 +00:00
Grzegorz Bizon 63bb849145 Add controller specs for pipeline index API endpoint
[ci skip]
2016-12-21 15:13:43 +01:00
Grzegorz Bizon 2b486c2bb2 Fix stage and pipeline specs and rubocop offenses 2016-12-20 20:07:34 +01:00
Grzegorz Bizon 9c6480db89 Move test for HTML stage endpoint to controller specs 2016-12-20 15:57:39 +01:00