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
path: root/lib/ci
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-06-14 18:05:26 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-06-14 18:05:26 +0300
commitfd285f71d8da46e76719a1055f168cd0b7e45094 (patch)
tree2bb31ad005d9d65a066c115044d27b35292c4b39 /lib/ci
parent1b8f52d9206bdf19c0dde04505c4c0b1cf46cfbe (diff)
parent121c6322809951105d43a90e573378785b9e33a8 (diff)
Merge branch 'master' into feature/runner-lock-on-project
* master: (147 commits) Update CHANGELOG Remove deprecated issues_tracker and issues_tracker_id from project Schema doesn’t reflect the changes of the last 3 migrations Revert CHANGELOG Also rename "find" in the specs Change to new Notes styleguide Add guide on changing a document's location Change logs.md location in README Move logs/logs.md to administration/logs.md Make "four phase test" Only show branches for revert / cherry-pick Instrument all Banzai::ReferenceParser classes Removed old comment from update_column_in_batches Update columns in batches until no rows are left Remove counters from Pipeline navigation Handle NULL migration errors in migration helpers Fix typo causing related branches to Error 500 Improved SVG sanitizer specs to include smoke tests for clean. Refactored SVG sanitizer Added SVG sanitizer fix to the changelog ...
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/api/entities.rb2
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb26
2 files changed, 26 insertions, 2 deletions
diff --git a/lib/ci/api/entities.rb b/lib/ci/api/entities.rb
index b25e0e573a8..a902ced35d7 100644
--- a/lib/ci/api/entities.rb
+++ b/lib/ci/api/entities.rb
@@ -56,7 +56,7 @@ module Ci
class TriggerRequest < Grape::Entity
expose :id, :variables
- expose :commit, using: Commit
+ expose :pipeline, using: Commit, as: :commit
end
end
end
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 130f5b0892e..40a5d180fd0 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -8,6 +8,8 @@ module Ci
ALLOWED_JOB_KEYS = [:tags, :script, :only, :except, :type, :image, :services,
:allow_failure, :type, :stage, :when, :artifacts, :cache,
:dependencies, :before_script, :after_script, :variables]
+ ALLOWED_CACHE_KEYS = [:key, :untracked, :paths]
+ ALLOWED_ARTIFACTS_KEYS = [:name, :untracked, :paths, :when]
attr_reader :before_script, :after_script, :image, :services, :path, :cache
@@ -135,6 +137,12 @@ module Ci
end
def validate_global_cache!
+ @cache.keys.each do |key|
+ unless ALLOWED_CACHE_KEYS.include? key
+ raise ValidationError, "#{name} cache unknown parameter #{key}"
+ end
+ end
+
if @cache[:key] && !validate_string(@cache[:key])
raise ValidationError, "cache:key parameter should be a string"
end
@@ -200,7 +208,7 @@ module Ci
raise ValidationError, "#{name} job: allow_failure parameter should be an boolean"
end
- if job[:when] && !job[:when].in?(%w(on_success on_failure always))
+ if job[:when] && !job[:when].in?(%w[on_success on_failure always])
raise ValidationError, "#{name} job: when parameter should be on_success, on_failure or always"
end
end
@@ -233,6 +241,12 @@ module Ci
end
def validate_job_cache!(name, job)
+ job[:cache].keys.each do |key|
+ unless ALLOWED_CACHE_KEYS.include? key
+ raise ValidationError, "#{name} job: cache unknown parameter #{key}"
+ end
+ end
+
if job[:cache][:key] && !validate_string(job[:cache][:key])
raise ValidationError, "#{name} job: cache:key parameter should be a string"
end
@@ -247,6 +261,12 @@ module Ci
end
def validate_job_artifacts!(name, job)
+ job[:artifacts].keys.each do |key|
+ unless ALLOWED_ARTIFACTS_KEYS.include? key
+ raise ValidationError, "#{name} job: artifacts unknown parameter #{key}"
+ end
+ end
+
if job[:artifacts][:name] && !validate_string(job[:artifacts][:name])
raise ValidationError, "#{name} job: artifacts:name parameter should be a string"
end
@@ -258,6 +278,10 @@ module Ci
if job[:artifacts][:paths] && !validate_array_of_strings(job[:artifacts][:paths])
raise ValidationError, "#{name} job: artifacts:paths parameter should be an array of strings"
end
+
+ if job[:artifacts][:when] && !job[:artifacts][:when].in?(%w[on_success on_failure always])
+ raise ValidationError, "#{name} job: artifacts:when parameter should be on_success, on_failure or always"
+ end
end
def validate_job_dependencies!(name, job)