Class: Gitlab::Ci::Config::External::File::Remote
- Inherits:
-
Base
- Object
- Base
- Gitlab::Ci::Config::External::File::Remote
show all
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/config/external/file/remote.rb
Constant Summary
Constants inherited
from Base
Base::YAML_ALLOWLIST_EXTENSION
Instance Attribute Summary
Attributes inherited from Base
#context, #errors, #location, #params
Instance Method Summary
collapse
Methods inherited from Base
#eql?, #error_message, #hash, #inputs_only!, #inputs_only?, #invalid_extension?, #invalid_location_type?, #load_and_validate_expanded_hash!, #load_uninterpolated_yaml, #matching?, #preload_context, #to_hash, #valid?, #validate_content_keys!, #validate_content_presence!
Constructor Details
#initialize(params, context) ⇒ Remote
Returns a new instance of Remote.
11
12
13
14
15
|
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 11
def initialize(params, context)
@location = params[:remote]
super
end
|
Instance Method Details
#content ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 21
def content
fetch_with_error_handling do
fetch_async_content.value.tap do |content|
verify_integrity(content) if params[:integrity]
end
end
end
|
30
31
32
33
34
35
36
37
38
|
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 30
def metadata
super.merge(
type: :remote,
location: masked_location,
blob: nil,
raw: masked_location,
extra: {}
)
end
|
#preload_content ⇒ Object
17
18
19
|
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 17
def preload_content
fetch_async_content
end
|
#validate_context! ⇒ Object
40
41
42
|
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 40
def validate_context!
end
|
#validate_location! ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/gitlab/ci/config/external/file/remote.rb', line 44
def validate_location!
super
unless ::Gitlab::UrlSanitizer.valid?(location)
errors.push("Remote file `#{masked_location}` does not have a valid address!")
end
end
|