diff options
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/build/image.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/image.rb | 19 |
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 5a4b85f98cf..7d6a9f7ab4c 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1299,7 +1299,7 @@ module API end class Image < Grape::Entity - expose :name, :entrypoint + expose :name, :entrypoint, :user end class Service < Image diff --git a/lib/gitlab/ci/build/image.rb b/lib/gitlab/ci/build/image.rb index c811f88f483..2714707cd67 100644 --- a/lib/gitlab/ci/build/image.rb +++ b/lib/gitlab/ci/build/image.rb @@ -2,7 +2,7 @@ module Gitlab module Ci module Build class Image - attr_reader :alias, :command, :entrypoint, :name + attr_reader :alias, :command, :entrypoint, :name, :user class << self def from_image(job) @@ -29,6 +29,7 @@ module Gitlab @command = image[:command] @entrypoint = image[:entrypoint] @name = image[:name] + @user = image[:user] end end diff --git a/lib/gitlab/ci/config/entry/image.rb b/lib/gitlab/ci/config/entry/image.rb index 2844be80a84..fc424f30948 100644 --- a/lib/gitlab/ci/config/entry/image.rb +++ b/lib/gitlab/ci/config/entry/image.rb @@ -7,15 +7,22 @@ module Gitlab # class Image < Node include Validatable + include Attributable - ALLOWED_KEYS = %i[name entrypoint].freeze + ALLOWED_KEYS = %i[name entrypoint user].freeze + + attributes ALLOWED_KEYS validations do validates :config, hash_or_string: true validates :config, allowed_keys: ALLOWED_KEYS validates :name, type: String, presence: true - validates :entrypoint, array_of_strings: true, allow_nil: true + + with_options allow_nil: true do + validates :entrypoint, array_of_strings: true + validates :user, type: String + end end def hash? @@ -26,14 +33,6 @@ module Gitlab @config.is_a?(String) end - def name - value[:name] - end - - def entrypoint - value[:entrypoint] - end - def value return { name: @config } if string? return @config if hash? |