Class: Ci::PersistentRef
- Inherits:
-
Object
- Object
- Ci::PersistentRef
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/ci/persistent_ref.rb
Overview
The persistent pipeline ref to ensure runners can safely fetch source code even if force-push/source-branch-deletion happens.
Instance Attribute Summary collapse
-
#pipeline ⇒ Object
Returns the value of attribute pipeline.
Instance Method Summary collapse
Instance Attribute Details
#pipeline ⇒ Object
Returns the value of attribute pipeline
10 11 12 |
# File 'app/models/ci/persistent_ref.rb', line 10 def pipeline @pipeline end |
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 |
# File 'app/models/ci/persistent_ref.rb', line 22 def create create_ref(sha, path) rescue => e Gitlab::ErrorTracking .track_exception(e, pipeline_id: pipeline.id) end |
#delete ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/models/ci/persistent_ref.rb', line 29 def delete delete_refs(path) rescue Gitlab::Git::Repository::NoRepository # no-op rescue => e Gitlab::ErrorTracking .track_exception(e, pipeline_id: pipeline.id) end |
#exist? ⇒ Boolean
16 17 18 19 20 |
# File 'app/models/ci/persistent_ref.rb', line 16 def exist? ref_exists?(path) rescue false end |
#path ⇒ Object
38 39 40 |
# File 'app/models/ci/persistent_ref.rb', line 38 def path "refs/#{Repository::REF_PIPELINES}/#{pipeline.id}" end |