Class: Gitlab::Ci::Config::External::File::Template
- Defined in:
- lib/gitlab/ci/config/external/file/template.rb
Constant Summary collapse
- SUFFIX =
'.gitlab-ci.yml'
- HOST =
'https://gitlab.com/gitlab-org/gitlab/-/raw/master'
Constants inherited from Base
Base::YAML_WHITELIST_EXTENSION
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Attributes inherited from Base
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(params, context) ⇒ Template
constructor
A new instance of Template.
- #metadata ⇒ Object
- #validate_context! ⇒ Object
- #validate_location! ⇒ Object
Methods inherited from Base
#eql?, #error_message, #hash, #invalid_extension?, #invalid_location_type?, #load_and_validate_expanded_hash!, #matching?, #preload_content, #preload_context, #to_hash, #valid?, #validate_content!
Constructor Details
#initialize(params, context) ⇒ Template
Returns a new instance of Template.
14 15 16 17 18 |
# File 'lib/gitlab/ci/config/external/file/template.rb', line 14 def initialize(params, context) @location = params[:template] super end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
9 10 11 |
# File 'lib/gitlab/ci/config/external/file/template.rb', line 9 def location @location end |
Instance Method Details
#content ⇒ Object
20 21 22 |
# File 'lib/gitlab/ci/config/external/file/template.rb', line 20 def content strong_memoize(:content) { fetch_template_content } end |
#metadata ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/ci/config/external/file/template.rb', line 24 def super.merge( type: :template, location: masked_location, blob: nil, raw: masked_raw, extra: {} ) end |
#validate_context! ⇒ Object
34 35 36 |
# File 'lib/gitlab/ci/config/external/file/template.rb', line 34 def validate_context! # no-op end |
#validate_location! ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/gitlab/ci/config/external/file/template.rb', line 38 def validate_location! super unless template_name_valid? errors.push("Template file `#{masked_location}` is not a valid location!") end end |