Class: Gitlab::Ci::Config::Entry::Artifacts

Inherits:
Gitlab::Config::Entry::Node show all
Includes:
Gitlab::Config::Entry::Attributable, Gitlab::Config::Entry::Configurable, Gitlab::Config::Entry::Validatable
Defined in:
lib/gitlab/ci/config/entry/artifacts.rb

Overview

Entry that represents a configuration of job artifacts.

Constant Summary collapse

ALLOWED_KEYS =
i[name untracked paths reports when expire_in expose_as exclude].freeze
EXPOSE_AS_REGEX =
/\A\w[-\w ]*\z/.freeze
EXPOSE_AS_ERROR_MESSAGE =
"can contain only letters, digits, '-', '_' and spaces"

Constants inherited from Gitlab::Config::Entry::Node

Gitlab::Config::Entry::Node::InvalidError

Instance Attribute Summary

Attributes inherited from Gitlab::Config::Entry::Node

#config, #default, #description, #key, #metadata, #parent

Instance Method Summary collapse

Methods included from Gitlab::Config::Entry::Validatable

#compose!, #errors, included, #validate, #validator

Methods included from Gitlab::Config::Entry::Configurable

#compose!, #entry_create!, #skip_config_hash_validation?

Methods inherited from Gitlab::Config::Entry::Node

#[], #add_warning, #ancestors, aspects, #compose!, default, #descendants, #errors, #hash?, #initialize, #inspect, #integer?, #leaf?, #location, #opt, #relevant?, #specified?, #string?, #valid?, #warnings, with_aspect

Constructor Details

This class inherits a constructor from Gitlab::Config::Entry::Node

Instance Method Details

#exclude_enabled?Boolean

Returns:

  • (Boolean)

63
64
65
# File 'lib/gitlab/ci/config/entry/artifacts.rb', line 63

def exclude_enabled?
  ::Gitlab::Ci::Features.artifacts_exclude_enabled?
end

#expose_as_present?Boolean

Returns:

  • (Boolean)

54
55
56
57
58
59
60
61
# File 'lib/gitlab/ci/config/entry/artifacts.rb', line 54

def expose_as_present?
  # This duplicates the `validates :config, type: Hash` above,
  # but Validatable currently doesn't halt the validation
  # chain if it encounters a validation error.
  return false unless @config.is_a?(Hash)

  !@config[:expose_as].nil?
end

#valueObject


49
50
51
52
# File 'lib/gitlab/ci/config/entry/artifacts.rb', line 49

def value
  @config[:reports] = reports_value if @config.key?(:reports)
  @config
end