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
- #cancel_gracefully? ⇒ Boolean
- #degenerate! ⇒ Object
- #degenerated? ⇒ Boolean
- #ensure_metadata ⇒ Object
- #has_exposed_artifacts? ⇒ Boolean
- #interruptible ⇒ Object
- #interruptible=(value) ⇒ Object
- #options ⇒ Object
- #options=(value) ⇒ Object
- #yaml_variables ⇒ Object
- #yaml_variables=(value) ⇒ Object
Instance Method Details
#cancel_gracefully? ⇒ Boolean
30 31 32 |
# File 'app/models/concerns/ci/metadatable.rb', line 30 def cancel_gracefully? !!&.cancel_gracefully? end |
#degenerate! ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/models/concerns/ci/metadatable.rb', line 42 def degenerate! self.class.transaction do self.update!(options: nil, yaml_variables: nil) self.needs.all.delete_all self.&.destroy end end |
#degenerated? ⇒ Boolean
38 39 40 |
# File 'app/models/concerns/ci/metadatable.rb', line 38 def degenerated? self..blank? end |
#ensure_metadata ⇒ Object
34 35 36 |
# File 'app/models/concerns/ci/metadatable.rb', line 34 def || (project: project) end |
#has_exposed_artifacts? ⇒ Boolean
26 27 28 |
# File 'app/models/concerns/ci/metadatable.rb', line 26 def has_exposed_artifacts? !!&.has_exposed_artifacts? end |
#interruptible ⇒ Object
72 73 74 |
# File 'app/models/concerns/ci/metadatable.rb', line 72 def interruptible &.interruptible end |
#interruptible=(value) ⇒ Object
76 77 78 |
# File 'app/models/concerns/ci/metadatable.rb', line 76 def interruptible=(value) .interruptible = value end |
#options ⇒ Object
50 51 52 |
# File 'app/models/concerns/ci/metadatable.rb', line 50 def (:options, :config_options, {}) end |
#options=(value) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'app/models/concerns/ci/metadatable.rb', line 58 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
54 55 56 |
# File 'app/models/concerns/ci/metadatable.rb', line 54 def yaml_variables (:yaml_variables, :config_variables, []) end |
#yaml_variables=(value) ⇒ Object
68 69 70 |
# File 'app/models/concerns/ci/metadatable.rb', line 68 def yaml_variables=(value) (:yaml_variables, :config_variables, value) end |