summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-09-02 01:00:29 +0000
committerAsh McKenzie <amckenzie@gitlab.com>2019-09-02 01:00:29 +0000
commit6e744f7071f435b453223445e0097bf114c4aaa0 (patch)
tree083baf94524744200a1a36d271a0eb5971d33d53 /lib/gitlab
parenteaae9cec212c2ff60c4fbe7074f16039166b379c (diff)
parentbf50573710ca008081063338664ec8b47a87d059 (diff)
downloadgitlab-ce-6e744f7071f435b453223445e0097bf114c4aaa0.tar.gz
Merge branch 'sh-fix-ci-lint-500-error' into 'master'
Fix 500 error in CI lint when included templates are an array Closes #66605 See merge request gitlab-org/gitlab-ce!32232
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/ci/config/external/file/base.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/ci/config/external/file/base.rb b/lib/gitlab/ci/config/external/file/base.rb
index 2ffbb214a92..c56d33544ba 100644
--- a/lib/gitlab/ci/config/external/file/base.rb
+++ b/lib/gitlab/ci/config/external/file/base.rb
@@ -26,6 +26,10 @@ module Gitlab
location.present?
end
+ def invalid_location_type?
+ !location.is_a?(String)
+ end
+
def invalid_extension?
location.nil? || !::File.basename(location).match?(YAML_WHITELIST_EXTENSION)
end
@@ -71,7 +75,9 @@ module Gitlab
end
def validate_location!
- if invalid_extension?
+ if invalid_location_type?
+ errors.push("Included file `#{location}` needs to be a string")
+ elsif invalid_extension?
errors.push("Included file `#{location}` does not have YAML extension!")
end
end