Commit Graph

702 Commits

Author SHA1 Message Date
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
Grzegorz Bizon 965d0394d3 Merge branch 'live-trace-v2-efficient-destroy-all' into 'master'
Live trace: Use efficient destroy all (for `dependent: :destory` problem)

See merge request gitlab-org/gitlab-ce!18575
2018-05-07 12:01:32 +00:00
Kamil Trzciński 8d8534d7ab Enforce proper 416 support for runner trace patch endpoint 2018-05-07 08:53:32 +02:00
Shinya Maeda 1fd10d4f24 Merge branch 'live-trace-v2' into live-trace-v2-efficient-destroy-all 2018-05-07 12:04:30 +09:00
Shinya Maeda 1f39fcd112 Merge branch 'master' into live-trace-v2 2018-05-07 11:59:43 +09:00
Shinya Maeda 90da0d4fe2 Merge branch 'live-trace-v2' into live-trace-v2-efficient-destroy-all 2018-05-03 14:21:37 +09:00
Shinya Maeda 30464bceaa Merge branch 'master' into live-trace-v2 2018-05-03 14:21:06 +09:00
Matija Čupić fc42ba6c5d
Merge branch 'master' into 44059-specify-variables-when-executing-a-manual-pipeline-from-the-ui 2018-05-02 15:54:06 +02:00
Rémy Coutable 3f9bfb0ccc Merge branch 'blackst0ne-rails5-fix-tzinfo-invalid-timezone-identifier' into 'master'
[Rails5] Fix `TZInfo::InvalidTimezoneIdentifier` exception

See merge request gitlab-org/gitlab-ce!18640
2018-05-02 07:58:43 +00:00
Shinya Maeda 502b170927 Merge branch 'live-trace-v2' into live-trace-v2-efficient-destroy-all 2018-05-02 14:46:57 +09:00
Shinya Maeda 4b34c875f7 Add guardclause of offset < 0 in #truncate 2018-05-02 14:46:04 +09:00
Shinya Maeda 6ed91266d0 Skip truncate when offset == size. Fix static analysys. 2018-05-02 14:27:28 +09:00
Grzegorz Bizon 0fd0b64be6 Use stages position column to track stage index 2018-05-01 14:30:44 +02:00
Grzegorz Bizon b337a086d5 Merge branch 'master' into backstage/gb/migrate-pipeline-stages-index
* master: (106 commits)
2018-05-01 14:24:39 +02:00
Shinya Maeda 1d53918b62 Introduces `FastDestroyAll` module 2018-05-01 17:06:44 +09:00
Jose d3327e0dfa Merge branch 'master' into 44059-specify-variables-when-executing-a-manual-pipeline-from-the-ui 2018-04-30 17:00:16 -05:00
Shinya Maeda 671f004451 Merge branch 'live-trace-v2' into live-trace-v2-efficient-destroy-all 2018-04-30 14:53:38 +09:00
Shinya Maeda 23c8e19846 Fix spec. Revert #truncate in stream (But still prevent redandant calls) 2018-04-30 14:52:29 +09:00
blackst0ne b26a3f91b8 [Rails5] Fix TZInfo::InvalidTimezoneIdentifier exception
In Rails 4.2.10 the `ActiveSupport::TimeZone.find_tzinfo(timezone_name)`
method calls `TZInfo::TimezoneProxy.new(timezone_name)` which returns
`timezone_name` if it is invalid.

But in Rails 5.0 the `ActiveSupport::TimeZone.find_tzinfo(timezone_name)`
method now calls the `TZInfo::Timezone.new(timezone_name)` method which
throws the `TZInfo::InvalidTimezoneIdentifier: Invalid identifier`
exception if `timezone_name` is invalid.

This commit adds the rescue block to return timezone name if the
exception is raised.

Also this change fixes the error:

```
  1) Ci::PipelineSchedule validations does not allow invalid cron patters
     Failure/Error: ActiveSupport::TimeZone.find_tzinfo(timezone).name

     TZInfo::InvalidTimezoneIdentifier:
       Invalid identifier
     # ./lib/gitlab/ci/cron_parser.rb:28:in `timezone_name'
     # ./lib/gitlab/ci/cron_parser.rb:9:in `initialize'
     # ./app/validators/cron_validator.rb:6:in `new'
     # ./app/validators/cron_validator.rb:6:in `validate_each'
     # ./spec/models/ci/pipeline_schedule_spec.rb:26:in `block (3 levels) in <top (required)>'
```
2018-04-29 10:10:36 +11:00
Shinya Maeda 0a4e57f3d7 Merge branch 'master' into live-trace-v2 2018-04-27 23:11:15 +09:00
Shinya Maeda 645b404d89 Fix specs. Align with the new table name ci_build_trace_chunk 2018-04-26 17:25:20 +09:00
Shinya Maeda 1fb66181db Merge branch 'live-trace-v2' into live-trace-v2-efficient-destroy-all 2018-04-26 16:39:56 +09:00
Shinya Maeda f819bb7270 Optimize Trace#write/append/raw by caching data and avoiding unnecesary truncate 2018-04-26 16:30:27 +09:00
Shinya Maeda 9d6fe7bfdf Refactoring ci_job_trace to ci_build_trace 2018-04-26 15:06:04 +09:00
Grzegorz Bizon e4d6984465 Do not save associated records for pipeline builds twice 2018-04-25 13:35:40 +02:00
Grzegorz Bizon c9dc51111d Rename stage index column name to priority column 2018-04-24 15:48:10 +02:00
Kamil Trzciński 12711de256 Implement efficient destroy of job_trace_chunks 2018-04-24 15:13:46 +02:00
Grzegorz Bizon f0d59b95f1 Validate presence of a stage index in the model 2018-04-24 11:07:37 +02:00
Shinya Maeda 94ce223391 Swap redis chunks when build finished 2018-04-24 14:53:14 +09:00
Shinya Maeda 0a6b7caac8 Merge branch 'master' into live-trace-v2 2018-04-20 21:51:44 +09:00
Matija Čupić 317477fc67
Extend Gitlab::Ci::Pipeline::Chain::Command with variables_attributes 2018-04-18 19:28:59 +02:00
🙈 jacopo beschi 🙉 c6b1043e9d Resolve "Make a Rubocop that forbids returning from a block" 2018-04-18 09:19:40 +00:00
Kamil Trzciński (OoO till 16th of April) df0a457d6f Merge branch '44981-http-io-trace-with-multi-byte-char' into 'master'
Fix `Trace::HttpIO` can not render multi-byte chars

Closes #44981

See merge request gitlab-org/gitlab-ce!18417
2018-04-18 08:25:53 +00:00
blackst0ne 18c2b06268 [Rails5] Remove `as` keyword from `Gitlab:Ci:Trace:Stream.delegate :valid?` 2018-04-18 08:15:02 +00:00
Shinya Maeda 1e817e0018 Align force_encoding strategy into Trace::Stream 2018-04-18 15:19:53 +09:00
Shinya Maeda c91b64366a Make HTTPIO compatible with multi-byte chars (Extracted from ChunkedIO) 2018-04-17 14:50:32 +09:00
Shinya Maeda 23634e4567 Merge branch 'master' into live-trace-v2 2018-04-17 12:07:56 +09:00
Marin Jankovski b9d868e33d Merge branch 'fix/gb/fix-pipeline-statuses-illustrations' into 'master'
Fix empty state for build that does not have a trace

Closes #45204

See merge request gitlab-org/gitlab-ce!18278
2018-04-12 07:54:48 +00:00
Grzegorz Bizon c079474b8a Merge branch '45159-fix-illustration' into 'master'
Resolve "Illustration for the case where the job has finished and the log was erased"

Closes #45159

See merge request gitlab-org/gitlab-ce!18253
2018-04-11 12:29:54 +00:00
Grzegorz Bizon 8196794c1e Add a test for job empty state with missing trace 2018-04-11 10:52:09 +02:00
Grzegorz Bizon 2ea25cbcaf Revert adding `Empty` extended status to avoid N+1 queries 2018-04-11 10:52:09 +02:00
Grzegorz Bizon 199e31eb24 Extend specs for detailed build extended statuses 2018-04-11 10:52:09 +02:00
Grzegorz Bizon 160ffb6870 Fix empty state for build that doesn ot have a trace
It also adds a fallback that covers other edge cases that might surface
later.
2018-04-11 10:52:08 +02:00
Grzegorz Bizon 07c781dcc0 Fix file-specific variables collection item option 2018-04-11 10:07:15 +02:00
Filipa Lacerda ea7a1e030d
Fixes illustration for when job log was erased 2018-04-09 13:16:08 +01:00
Shinya Maeda 8a9955cf5c Fix wrong sql at calculation size 2018-04-06 20:41:56 +09:00
Shinya Maeda cffee49f7f Change Redis TTL to 1day. Fixing nitpicks 2018-04-06 19:30:23 +09:00
Kamil Trzciński 2bf8345542 Merge branch 'master' into '42568-pipeline-empty-state'
# Conflicts:
#   app/views/projects/jobs/show.html.haml
#   lib/gitlab/ci/status/core.rb
2018-04-06 09:16:40 +00:00
Shinya Maeda 4c6cb3cf06 Fix Stream#file? duplicates. And the spec 2018-04-06 15:07:55 +09:00
Shinya Maeda b525b416c8 Merge branch 'master' into live-trace-v2 2018-04-06 15:01:52 +09:00