diff options
Diffstat (limited to 'lib/gitlab/ci/config/entry/commands.rb')
-rw-r--r-- | lib/gitlab/ci/config/entry/commands.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/gitlab/ci/config/entry/commands.rb b/lib/gitlab/ci/config/entry/commands.rb new file mode 100644 index 00000000000..65d19db249c --- /dev/null +++ b/lib/gitlab/ci/config/entry/commands.rb @@ -0,0 +1,33 @@ +module Gitlab + module Ci + class Config + module Entry + ## + # Entry that represents a job script. + # + class Commands < Node + include Validatable + + validations do + include LegacyValidationHelpers + + validate do + unless string_or_array_of_strings?(config) + errors.add(:config, + 'should be a string or an array of strings') + end + end + + def string_or_array_of_strings?(field) + validate_string(field) || validate_array_of_strings(field) + end + end + + def value + Array(@config) + end + end + end + end + end +end |