Class: Terraform::State
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Terraform::State
- Defined in:
- app/models/terraform/state.rb
Constant Summary collapse
- HEX_REGEXP =
%r{\A\h+\z}- UUID_LENGTH =
32
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Instance Method Summary collapse
Methods included from Gitlab::InternalEventsTracking
Methods included from AfterCommitQueue
#run_after_commit, #run_after_commit_or_now
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from Organizations::Sharding
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Instance Method Details
#latest_file ⇒ Object
37 38 39 |
# File 'app/models/terraform/state.rb', line 37 def latest_file latest_version&.file end |
#locked? ⇒ Boolean
41 42 43 |
# File 'app/models/terraform/state.rb', line 41 def locked? self.lock_xid.present? end |
#update_file!(data, version:, build:) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/models/terraform/state.rb', line 45 def update_file!(data, version:, build:) # This check is required to maintain backwards compatibility with # states that were created prior to versioning being supported. # This can be removed in 14.0 when support for these states is dropped. # See https://gitlab.com/gitlab-org/gitlab/-/issues/258960 if versioning_enabled? create_new_version!(data: data, version: version, build: build) else migrate_legacy_version!(data: data, version: version, build: build) end if reload_latest_version.encryption_enabled? track_internal_event( 'terraform_state_stored_with_encryption', project: project, user: locked_by_user ) else track_internal_event( 'terraform_state_stored_without_encryption', project: project, user: locked_by_user ) end end |