Commit Graph

724 Commits

Author SHA1 Message Date
Shinya Maeda e8ecae7e0b Reveert build_relations and simply add a line for creating iid 2018-06-02 11:55:42 +09:00
Shinya Maeda b02b2602c1 Merge branch 'master' into per-project-pipeline-iid 2018-06-02 11:15:53 +09:00
NLR dca702a599 Make http_io honor HTTP(S)_PROXY environment. 2018-06-01 14:32:10 +00:00
Shinya Maeda 59e1e97108 Add build_relations method in Chain::Populate 2018-05-30 15:17:09 +09:00
Shinya Maeda 8e92e25b62 Remvoe disable_ddl_transaction! and redandant RecordNotUnique exception rescue 2018-05-22 15:21:45 +09:00
Shinya Maeda f61666c0d7 Merge branch 'master' into per-project-pipeline-iid 2018-05-22 14:32:40 +09:00
Kamil Trzciński 46d5ab68b7 Merge branch 'feature/gb/add-regexp-variables-expression' into 'master'
Add support for variables expression regexp syntax

Closes #43601

See merge request gitlab-org/gitlab-ce!18902
2018-05-18 12:08:12 +00:00
Grzegorz Bizon afa2451421 Simplify pattern lexeme fabrication and matcher 2018-05-18 10:14:19 +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
Grzegorz Bizon 8b3e21b66b Add variables expression pattern validation support 2018-05-17 12:44:46 +02:00
Grzegorz Bizon a1f1e08670 Add anti-corruption layer above expressions pattern matching 2018-05-17 12:35:20 +02:00
Grzegorz Bizon c1377c6cf0 Remove useless assignment in pattern lexeme 2018-05-15 14:35:12 +02:00
Grzegorz Bizon df91580cc4 Do not support inverse variable pattern matching 2018-05-15 13:31:45 +02:00
Grzegorz Bizon 65f4e7b2a1 Add support for pattern matching in variables expressions 2018-05-15 13:04:18 +02:00
Grzegorz Bizon 475d2edf04 Reorganize exceptions in pipeline expressions module 2018-05-15 12:37:09 +02:00
Grzegorz Bizon f16f2b5994 Add pattern matching variables expression lexeme 2018-05-14 15:03:10 +02:00
Grzegorz Bizon ac65257c40 Raise variables statement exception if pattern is invalid 2018-05-14 14:38:08 +02:00
Grzegorz Bizon b784a985f2 Do not raise if variable expression can not be evaluated 2018-05-14 14:27:07 +02:00
Grzegorz Bizon 8b736c91fc Implement variables expression untrusted pattern lexeme 2018-05-11 13:29:05 +02:00
Shinya Maeda 46fa3089c8 Rescue RecordNotUnique when pipeline is created with non-unique iid 2018-05-11 16:49:18 +09:00
Shinya Maeda 6a108b8fbd Fix ensure_iid! method override problem 2018-05-10 16:22:43 +09:00
Shinya Maeda 632b87a80e Merge branch 'master' into per-project-pipeline-iid 2018-05-08 14:32:45 +09: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
Kamil Trzciński 58f229af99 Make Atomic Internal ID work for pipelines 2018-05-03 10:49:13 +02: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