Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-14 14:53:02 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-09-18 14:57:14 +0300
commit10a486b366a834b24c6eef432ec16af4237ec06d (patch)
tree1a9650372d6adfeac3ca9b6c54fc1d7738529112 /lib/gitlab
parent241197c29aa8fe3cae9e5ded9947cfb2bee3574c (diff)
Remove YAML processor refactoring stubs and fix specs
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/ci/build/policy/refs.rb2
-rw-r--r--lib/gitlab/ci/yaml_processor.rb56
2 files changed, 26 insertions, 32 deletions
diff --git a/lib/gitlab/ci/build/policy/refs.rb b/lib/gitlab/ci/build/policy/refs.rb
index 4f2bbd9eaac..9e1b639f12d 100644
--- a/lib/gitlab/ci/build/policy/refs.rb
+++ b/lib/gitlab/ci/build/policy/refs.rb
@@ -26,7 +26,7 @@ module Gitlab
def matches_pattern?(pattern, pipeline)
return true if pipeline.tag? && pattern == 'tags'
- return true if !pipeline.tag? && pattern == 'branches'
+ return true if pipeline.branch? && pattern == 'branches'
return true if source_to_pattern(pipeline.source) == pattern
if pattern.first == "/" && pattern.last == "/"
diff --git a/lib/gitlab/ci/yaml_processor.rb b/lib/gitlab/ci/yaml_processor.rb
index d688683474c..19951f1842e 100644
--- a/lib/gitlab/ci/yaml_processor.rb
+++ b/lib/gitlab/ci/yaml_processor.rb
@@ -22,28 +22,12 @@ module Gitlab
end
- # REFACTORING STUB, remove this method, used only in tests.
- #
- def builds_for_stage_and_ref(stage, ref, tag = false, source = nil)
- pipeline_stage_builds(stage, ::Ci::Pipeline.new(ref: ref, source: source, tag: tag))
- end
-
def builds
@jobs.map do |name, _|
build_attributes(name)
end
end
- def stage_seeds(pipeline)
- seeds = @stages.uniq.map do |stage|
- builds = pipeline_stage_builds(stage, pipeline)
-
- Gitlab::Ci::Stage::Seed.new(pipeline, stage, builds) if builds.any?
- end
-
- seeds.compact
- end
-
def build_attributes(name)
job = @jobs[name.to_sym] || {}
@@ -71,21 +55,8 @@ module Gitlab
}.compact }
end
- def self.validation_message(content)
- return 'Please provide content of .gitlab-ci.yml' if content.blank?
-
- begin
- Gitlab::Ci::YamlProcessor.new(content)
- nil
- rescue ValidationError, Psych::SyntaxError => e
- e.message
- end
- end
-
- private
-
def pipeline_stage_builds(stage, pipeline)
- stage_jobs = @jobs.select do |_, job|
+ selected_jobs = @jobs.select do |_, job|
next unless job[:stage] == stage
only_specs = Gitlab::Ci::Build::Policy
@@ -97,9 +68,32 @@ module Gitlab
except_specs.none? { |spec| spec.satisfied_by?(pipeline, path: @path) }
end
- stage_jobs.map { |_, job| build_attributes(job[:name]) }
+ selected_jobs.map { |_, job| build_attributes(job[:name]) }
+ end
+
+ def stage_seeds(pipeline)
+ seeds = @stages.uniq.map do |stage|
+ builds = pipeline_stage_builds(stage, pipeline)
+
+ Gitlab::Ci::Stage::Seed.new(pipeline, stage, builds) if builds.any?
+ end
+
+ seeds.compact
+ end
+
+ def self.validation_message(content)
+ return 'Please provide content of .gitlab-ci.yml' if content.blank?
+
+ begin
+ Gitlab::Ci::YamlProcessor.new(content)
+ nil
+ rescue ValidationError, Psych::SyntaxError => e
+ e.message
+ end
end
+ private
+
def initial_parsing
##
# Global config