diff options
author | Leandro Camargo <leandroico@gmail.com> | 2016-11-18 01:42:35 -0200 |
---|---|---|
committer | Leandro Camargo <leandroico@gmail.com> | 2017-01-25 01:07:43 -0200 |
commit | 646b9c54d043edf17924e82d8e80a56e18d14ce4 (patch) | |
tree | 421dda5a4bb04d156c32254db4d79eb855a68617 | |
parent | 6a3d29c73d2578c7b2a40f2dfcb823b681a70f7e (diff) | |
download | gitlab-ce-646b9c54d043edf17924e82d8e80a56e18d14ce4.tar.gz |
Comply to requests made in the review and adjust to the Entry/Node changes
This commit:
* Turns `coverage_regex` into `coverage` entry in yml file
* Fixes smaller requests from code reviewers for the previous commit
* This commit is temporary (will be squashed afterwards)
This commit does not (further commits will do though):
* Add global `coverage` entry handling in yml file as suggested by Grzegorz
* Add specs
* Create changelog
* Create docs
-rw-r--r-- | app/models/ci/build.rb | 6 | ||||
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/coverage.rb (renamed from lib/gitlab/ci/config/node/regexp.rb) | 4 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/job.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/legacy_validation_helpers.rb | 3 |
5 files changed, 12 insertions, 11 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 4691b33ee9b..46a6b4c724a 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -276,8 +276,8 @@ module Ci def update_coverage return unless project - return unless coverage_regex = self.coverage_regex - coverage = extract_coverage(trace, coverage_regex) + return unless regex = self.coverage_regex + coverage = extract_coverage(trace, regex) if coverage.is_a? Numeric update_attributes(coverage: coverage) @@ -522,7 +522,7 @@ module Ci end def coverage_regex - read_attribute(:coverage_regex) || build_attributes_from_config[:coverage] || project.build_coverage_regex + read_attribute(:coverage_regex) || project.build_coverage_regex end def when diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 2f5ef4d36bd..649ee4d018b 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -61,7 +61,7 @@ module Ci allow_failure: job[:allow_failure] || false, when: job[:when] || 'on_success', environment: job[:environment_name], - coverage_regex: job[:coverage_regex], + coverage_regex: job[:coverage], yaml_variables: yaml_variables(name), options: { image: job[:image], diff --git a/lib/gitlab/ci/config/node/regexp.rb b/lib/gitlab/ci/config/entry/coverage.rb index 7c5843eb8b6..88fc03db2d9 100644 --- a/lib/gitlab/ci/config/node/regexp.rb +++ b/lib/gitlab/ci/config/entry/coverage.rb @@ -1,11 +1,11 @@ module Gitlab module Ci class Config - module Node + module Entry ## # Entry that represents a Regular Expression. # - class Regexp < Entry + class Coverage < Node include Validatable validations do diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index 3c7ef99cefc..bde6663344a 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -11,7 +11,7 @@ module Gitlab ALLOWED_KEYS = %i[tags script only except type image services allow_failure type stage when artifacts cache dependencies before_script - after_script variables environment coverage_regex] + after_script variables environment coverage] validations do validates :config, allowed_keys: ALLOWED_KEYS @@ -71,12 +71,12 @@ module Gitlab entry :environment, Entry::Environment, description: 'Environment configuration for this job.' - node :coverage_regex, Node::Regexp, + entry :coverage, Entry::Coverage, description: 'Coverage scanning regex configuration for this job.' helpers :before_script, :script, :stage, :type, :after_script, :cache, :image, :services, :only, :except, :variables, - :artifacts, :commands, :environment, :coverage_regex + :artifacts, :commands, :environment, :coverage attributes :script, :tags, :allow_failure, :when, :dependencies @@ -133,7 +133,7 @@ module Gitlab variables: variables_defined? ? variables_value : nil, environment: environment_defined? ? environment_value : nil, environment_name: environment_defined? ? environment_value[:name] : nil, - coverage_regex: coverage_regex_defined? ? coverage_regex_value : nil, + coverage: coverage_defined? ? coverage_value : nil, artifacts: artifacts_value, after_script: after_script_value } end diff --git a/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb b/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb index 34e7052befc..98db4632dad 100644 --- a/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb +++ b/lib/gitlab/ci/config/entry/legacy_validation_helpers.rb @@ -29,7 +29,8 @@ module Gitlab end def validate_regexp(value) - !!::Regexp.new(value) + Regexp.new(value) + true rescue RegexpError false end |