Class: Ci::ListConfigVariablesService
- Inherits:
-
BaseService
- Object
- BaseService
- Ci::ListConfigVariablesService
- Includes:
- ReactiveCaching
- Defined in:
- app/services/ci/list_config_variables_service.rb
Constant Summary
Constants included from ReactiveCaching
ReactiveCaching::ExceededReactiveCacheLimit, ReactiveCaching::InvalidateReactiveCache, ReactiveCaching::WORK_TYPE
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Class Method Summary collapse
Instance Method Summary collapse
- #calculate_reactive_cache(sha) ⇒ Object
- #execute(ref) ⇒ Object
-
#id ⇒ Object
Required for ReactiveCaching, it is also used in ‘reactive_cache_worker_finder`.
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseService
Class Method Details
Instance Method Details
#calculate_reactive_cache(sha) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/services/ci/list_config_variables_service.rb', line 26 def calculate_reactive_cache(sha) config = ::Gitlab::Ci::ProjectConfig.new(project: project, sha: sha) return {} unless config.exists? result = Gitlab::Ci::YamlProcessor.new( config.content, project: project, user: current_user, sha: sha ).execute result.valid? ? result.root_variables_with_prefill_data : {} end |
#execute(ref) ⇒ Object
20 21 22 23 24 |
# File 'app/services/ci/list_config_variables_service.rb', line 20 def execute(ref) sha = project.commit(ref).try(:sha) with_reactive_cache(sha) { |result| result } end |
#id ⇒ Object
Required for ReactiveCaching, it is also used in ‘reactive_cache_worker_finder`
42 43 44 |
# File 'app/services/ci/list_config_variables_service.rb', line 42 def id "#{project.id}-#{current_user.id}" end |