Module: Ci::Metadatable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/ci/metadatable.rb
Overview
This module implements methods that need to read and write metadata for CI/CD entities.
Instance Method Summary collapse
- #degenerate! ⇒ Object
- #degenerated? ⇒ Boolean
- #ensure_metadata ⇒ Object
- #interruptible ⇒ Object
- #interruptible=(value) ⇒ Object
- #options ⇒ Object
- #options=(value) ⇒ Object
- #yaml_variables ⇒ Object
- #yaml_variables=(value) ⇒ Object
Instance Method Details
#degenerate! ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/models/concerns/ci/metadatable.rb', line 34 def degenerate! self.class.transaction do self.update!(options: nil, yaml_variables: nil) self.needs.all.delete_all self.&.destroy end end |
#degenerated? ⇒ Boolean
30 31 32 |
# File 'app/models/concerns/ci/metadatable.rb', line 30 def degenerated? self..blank? end |
#ensure_metadata ⇒ Object
26 27 28 |
# File 'app/models/concerns/ci/metadatable.rb', line 26 def || (project: project) end |
#interruptible ⇒ Object
64 65 66 |
# File 'app/models/concerns/ci/metadatable.rb', line 64 def interruptible &.interruptible end |
#interruptible=(value) ⇒ Object
68 69 70 |
# File 'app/models/concerns/ci/metadatable.rb', line 68 def interruptible=(value) .interruptible = value end |
#options ⇒ Object
42 43 44 |
# File 'app/models/concerns/ci/metadatable.rb', line 42 def (:options, :config_options, {}) end |
#options=(value) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/models/concerns/ci/metadatable.rb', line 50 def (value) (:options, :config_options, value) .tap do || # Store presence of exposed artifacts in build metadata to make it easier to query .has_exposed_artifacts = value&.dig(:artifacts, :expose_as).present? .environment_auto_stop_in = value&.dig(:environment, :auto_stop_in) end end |
#yaml_variables ⇒ Object
46 47 48 |
# File 'app/models/concerns/ci/metadatable.rb', line 46 def yaml_variables (:yaml_variables, :config_variables, []) end |
#yaml_variables=(value) ⇒ Object
60 61 62 |
# File 'app/models/concerns/ci/metadatable.rb', line 60 def yaml_variables=(value) (:yaml_variables, :config_variables, value) end |