Commit Graph

209 Commits

Author SHA1 Message Date
GitLab Bot 25eb713a7f Add latest changes from gitlab-org/gitlab@master 2021-01-26 18:09:30 +00:00
GitLab Bot cbd505d80b Add latest changes from gitlab-org/gitlab@master 2021-01-22 21:09:10 +00:00
GitLab Bot 37a492326e Add latest changes from gitlab-org/gitlab@master 2021-01-21 18:09:11 +00:00
GitLab Bot 8f534e1e96 Add latest changes from gitlab-org/gitlab@master 2021-01-14 21:10:37 +00:00
GitLab Bot 152f35d6bf Add latest changes from gitlab-org/gitlab@master 2020-12-21 18:10:26 +00:00
GitLab Bot 7c81500115 Add latest changes from gitlab-org/gitlab@master 2020-12-16 06:10:11 +00:00
GitLab Bot 87911fabb2 Add latest changes from gitlab-org/gitlab@master 2020-12-11 21:10:13 +00:00
GitLab Bot d8995bd33f Add latest changes from gitlab-org/gitlab@master 2020-12-10 00:09:50 +00:00
GitLab Bot 03d56c8af0 Add latest changes from gitlab-org/gitlab@master 2020-12-09 21:09:43 +00:00
GitLab Bot 544eaa9081 Add latest changes from gitlab-org/gitlab@master 2020-12-03 09:09:33 +00:00
GitLab Bot 893ba862a7 Add latest changes from gitlab-org/gitlab@master 2020-12-01 15:09:28 +00:00
GitLab Bot 6fa3630aad Add latest changes from gitlab-org/gitlab@master 2020-11-17 09:09:23 +00:00
GitLab Bot 254f79fb35 Add latest changes from gitlab-org/gitlab@master 2020-11-13 06:09:02 +00:00
GitLab Bot f4182abcb6 Add latest changes from gitlab-org/gitlab@master 2020-11-12 18:09:26 +00:00
GitLab Bot 5a7d44a955 Add latest changes from gitlab-org/gitlab@master 2020-10-29 12:08:50 +00:00
GitLab Bot 9dab4d7b64 Add latest changes from gitlab-org/gitlab@master 2020-10-22 09:08:26 +00:00
GitLab Bot 3940f59a61 Add latest changes from gitlab-org/gitlab@master 2020-10-16 15:08:46 +00:00
GitLab Bot ed7568cc80 Add latest changes from gitlab-org/gitlab@master 2020-10-16 09:09:06 +00:00
GitLab Bot 2ac4833015 Add latest changes from gitlab-org/gitlab@master 2020-10-08 18:08:32 +00:00
GitLab Bot f4fb4d5948 Add latest changes from gitlab-org/gitlab@master 2020-09-25 15:09:36 +00:00
GitLab Bot c5d67a0495 Add latest changes from gitlab-org/gitlab@master 2020-09-23 18:10:15 +00:00
GitLab Bot 7dc8bd3c16 Add latest changes from gitlab-org/gitlab@master 2020-09-15 21:09:35 +00:00
GitLab Bot a69bb17d1e Add latest changes from gitlab-org/gitlab@master 2020-09-08 06:08:57 +00:00
GitLab Bot 202268ad93 Add latest changes from gitlab-org/gitlab@master 2020-08-21 09:10:08 +00:00
GitLab Bot 325318e2dd Add latest changes from gitlab-org/gitlab@master 2020-08-17 09:10:08 +00:00
GitLab Bot 80ddaef34d Add latest changes from gitlab-org/gitlab@master 2020-08-12 00:09:52 +00:00
GitLab Bot db73de5d6d Add latest changes from gitlab-org/gitlab@master 2020-08-07 21:10:07 +00:00
GitLab Bot 46c2316f92 Add latest changes from gitlab-org/gitlab@master 2020-07-23 00:09:43 +00:00
GitLab Bot 192bc8bd31 Add latest changes from gitlab-org/gitlab@master 2020-07-20 21:09:23 +00:00
GitLab Bot da1962d9ac Add latest changes from gitlab-org/gitlab@master 2020-07-15 18:09:09 +00:00
GitLab Bot c7b780b56d Add latest changes from gitlab-org/gitlab@master 2020-07-10 21:09:29 +00:00
GitLab Bot 7dc3246696 Add latest changes from gitlab-org/gitlab@master 2020-07-07 00:08:58 +00:00
GitLab Bot e829ca213b Add latest changes from gitlab-org/gitlab@master 2020-06-22 15:09:27 +00:00
GitLab Bot ce493944f4 Add latest changes from gitlab-org/gitlab@master 2020-06-19 18:08:39 +00:00
GitLab Bot 6744162376 Add latest changes from gitlab-org/gitlab@master 2020-06-15 12:08:44 +00:00
GitLab Bot 6ff3eb60e3 Add latest changes from gitlab-org/gitlab@master 2020-06-09 15:08:05 +00:00
GitLab Bot 908a54b624 Add latest changes from gitlab-org/gitlab@master 2020-06-05 21:08:27 +00:00
GitLab Bot 8f306a7dc5 Add latest changes from gitlab-org/gitlab@master 2020-05-21 06:08:25 +00:00
GitLab Bot 5abd2b70c8 Add latest changes from gitlab-org/gitlab@master 2020-05-21 00:08:06 +00:00
GitLab Bot 1e9d859394 Add latest changes from gitlab-org/gitlab@master 2020-05-15 06:08:40 +00:00
GitLab Bot 2c15256184 Add latest changes from gitlab-org/gitlab@master 2020-05-13 06:08:02 +00:00
GitLab Bot d4f8f25db6 Add latest changes from gitlab-org/gitlab@master 2020-05-07 00:11:11 +00:00
GitLab Bot 53288eeb63 Add latest changes from gitlab-org/gitlab@master 2020-05-05 21:09:42 +00:00
GitLab Bot c74b7b5e43 Add latest changes from gitlab-org/gitlab@master 2020-04-28 12:09:44 +00:00
GitLab Bot e33f87ac0f Add latest changes from gitlab-org/gitlab@master 2020-04-21 15:21:10 +00:00
GitLab Bot 254ec28f54 Add latest changes from gitlab-org/gitlab@master 2020-04-09 21:09:19 +00:00
GitLab Bot 42f41de465 Add latest changes from gitlab-org/gitlab@master 2020-04-03 06:09:14 +00:00
GitLab Bot abae8f34f3 Add latest changes from gitlab-org/gitlab@master 2020-03-31 21:08:05 +00:00
GitLab Bot 154b9bae14 Add latest changes from gitlab-org/gitlab@master 2020-03-17 21:09:16 +00:00
GitLab Bot 8957ace315 Add latest changes from gitlab-org/gitlab@master 2020-03-14 00:09:30 +00:00
GitLab Bot 1078b7bf25 Add latest changes from gitlab-org/gitlab@master 2020-02-11 09:08:39 +00:00
GitLab Bot e3e300557f Add latest changes from gitlab-org/gitlab@master 2020-01-08 12:07:59 +00:00
GitLab Bot 6a7cc8c147 Add latest changes from gitlab-org/gitlab@master 2019-12-05 18:07:51 +00:00
GitLab Bot 4c464055fb Add latest changes from gitlab-org/gitlab@master 2019-11-05 15:06:17 +00:00
GitLab Bot e95a97594a Add latest changes from gitlab-org/gitlab@master 2019-10-25 21:06:20 +00:00
GitLab Bot 914ea32e0e Add latest changes from gitlab-org/gitlab@master 2019-10-16 09:07:51 +00:00
GitLab Bot 77a7772c3b Add latest changes from gitlab-org/gitlab@master 2019-10-08 09:06:09 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
GitLab Bot bd860c22f6 Add latest changes from gitlab-org/gitlab@master 2019-09-17 12:06:48 +00:00
GitLab Bot 48c77599ca Add latest changes from gitlab-org/gitlab@master 2019-09-17 00:06:11 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Matija Čupić 21024065c5
Preload tags when loading Ci::Pipeline 2019-08-23 14:49:52 +02:00
Alex Ives 3e2b45870a Issue #39099: Add links for latest pipelines 2019-08-22 08:49:40 -05:00
Krasimir Angelov 85609c117e Implement support for CI variables of type file
Add env_var and file as supported types for CI variables. Variables of
type file expose to users existing gitlab-runner behaviour - save
variable value into a temp file and set the path to this file in an ENV
var named after the variable key.

Resolves https://gitlab.com/gitlab-org/gitlab-ce/issues/46806.
2019-05-06 13:11:42 +00:00
Stan Hu f2fa7c3299 Fix and expand Gitaly FindCommit caching
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26248 added
support for deduplicating FindCommit requests using Gitaly ref name
caching. However, not all endpoints were covered, and in one case the
Gitaly wrapper wasn't actually surrounding the serialization step. We
can safely cache ref names between FindCommit calls for #index and #show
endpoints for merge requests and pipelines. This can significantly
reduce the number of FindCommit requests.
2019-04-04 13:42:58 -07:00
Stan Hu e37383d453 Cache FindCommit results in pipelines view
For each pipeline, the controller will call `Pipeline#latest?` to
determine if the pipeline's ref is the latest for that branch.
Since it's likely that the same branches are being used in each
pipeline, we can reduce Gitaly overhead by caching the results
of the FindCommit call.
2019-04-02 04:15:32 -07:00
Kamil Trzciński d4c7214799
[master] Pipelines section is available to unauthorized users 2019-01-31 16:52:50 +01:00
Kamil Trzciński c651191d14 Prefer to use overrides on PipelinesController 2019-01-30 12:12:36 +01:00
Francisco Javier López a6778fc647 Rename project's pipelines relation 2018-12-05 14:39:15 +00:00
gfyoung 12ee2753c1 Enable even more frozen string in app/controllers
Enables frozen string for some vestigial files as
well as the following:

* app/controllers/projects/**/*.rb
* app/controllers/sherlock/**/*.rb
* app/controllers/snippets/**/*.rb
* app/controllers/users/**/*.rb

Partially addresses #47424.
2018-09-25 22:43:49 -07:00
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 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Lukas Eipert 8cd80da8bb
remove unneeded `before_action` 2018-08-02 13:49:39 +02:00
Bob Van Landuyt f1d3ea63cf Show the status of a user in interactions
The status is shown for
- The author of a commit when viewing a commit
- Notes on a commit (regular/diff)
- The user that triggered a pipeline when viewing a pipeline
- The author of a merge request when viewing a merge request
- The author of notes on a merge request (regular/diff)
- The author of an issue when viewing an issue
- The author of notes on an issue
- The author of a snippet when viewing a snippet
- The author of notes on a snippet
- A user's profile page
- The list of members of a group/user
2018-07-30 15:01:26 +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
Grzegorz Bizon dab3ae39a2 Do not paginate pipelines active relation twice 2018-05-23 13:29:21 +02:00
Grzegorz Bizon f89f232d19 Simplify pipelines preloader implementation 2018-05-23 10:22:28 +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 19428e8008
Preload pipeline data for project pipelines
When displaying the pipelines of a project we now preload the following
data:

1. Authors of the commits that belong to these pipelines
2. The number of warnings per pipeline, which is used by
   Ci::Pipeline#has_warnings?

== Commit Authors

Previously this data was queried for every Commit separately, leading to
20 SQL queries being executed in the worst case. With an average of 3 to
5 milliseconds per SQL query this could result in 100 milliseconds being
spent in _just_ getting Commit authors.

To preload this data Commit#author now uses BatchLoader (through
Commit#lazy_author), and a separate module
Gitlab::Ci::Pipeline::Preloader is used to ensure all authors are loaded
before they are used.

== Number of warnings

This changes Ci::Pipeline#has_warnings? so it supports preloading of the
number of warnings per pipeline. This removes the need for executing a
COUNT(*) query for every pipeline just to see if it has any warnings or
not.
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
Jan Provaznik 21588f180c Enable update_(build|pipeline) for maintainers 2018-05-15 08:18:22 +00:00
Grzegorz Bizon 3aa5317d93 Merge branch 'fix-failed-jobs-tab' into 'master'
Fix failed jobs tab

See merge request gitlab-org/gitlab-ce!18520
2018-05-08 06:52:50 +00:00
Kamil Trzciński d840535c33 Merge branch '33697-pipelines-json-endpoint' into 'master'
Resolve "CI retry/cancel job or pipeline redirect the user and can't be open in a new tab"

Closes #33697

See merge request gitlab-org/gitlab-ce!18451
2018-05-07 08:32:45 +00:00
Kamil Trzciński 6776fac622 Respect permissions when showing Failed Jobs 2018-05-06 18:46:00 +02:00
Kamil Trzciński f2dda0bd29 Fix syntax error 2018-05-02 14:15:24 +02:00
Kamil Trzciński 6ea31cb7cd Add stages_ajax endpoint to serve old HTML 2018-05-02 00:05:03 +02:00
Kamil Trzciński 2178bd5ff4 Fix stage.json endpoint 2018-04-23 16:20:21 +02:00
Kamil Trzciński 551f8c4b1a Add proper stage.json data 2018-04-23 15:58:59 +02:00
Matija Čupić 3a5773ce07
Accept variable params in create_params 2018-04-18 14:18:27 +02:00
Yorick Peterse cca61980d5
Track and act upon the number of executed queries
This ensures that we have more visibility in the number of SQL queries
that are executed in web requests. The current threshold is hardcoded to
100 as we will rarely (maybe once or twice) change it.

In production and development we use Sentry if enabled, in the test
environment we raise an error. This feature is also only enabled in
production/staging when running on GitLab.com as it's not very useful to
other users.
2018-02-01 17:00:46 +01: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
Maxim Rydkin f364cc34ea
move `lib/ci/charts.rb` into `lib/gitlab/ci/charts.rb` 2017-09-12 22:32:01 +03:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Z.J. van de Weg 9b2ae90d2c Remove references to build in pipeline charts
Being the good boyscouts, but mainly because of [the comment in the
review](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12378#note_33302115)
the words used for classes and variables are changed to not use builds
anymore.
2017-06-23 14:50:03 +02:00
Z.J. van de Weg 13d39971f3 Improve performance for pipeline charts
Achieved by using another table, which both has better indexes and
is smaller. Now the data provided for the user is more valueable too.
2017-06-23 11:46:55 +02:00