Class: Releases::EvidencePipelineFinder

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/finders/releases/evidence_pipeline_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, params = {}) ⇒ EvidencePipelineFinder

Returns a new instance of EvidencePipelineFinder.



9
10
11
12
# File 'app/finders/releases/evidence_pipeline_finder.rb', line 9

def initialize(project, params = {})
  @project = project
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



7
8
9
# File 'app/finders/releases/evidence_pipeline_finder.rb', line 7

def params
  @params
end

#projectObject (readonly)

Returns the value of attribute project.



7
8
9
# File 'app/finders/releases/evidence_pipeline_finder.rb', line 7

def project
  @project
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/finders/releases/evidence_pipeline_finder.rb', line 14

def execute
  # TODO: remove this with the release creation moved to it's own form https://gitlab.com/gitlab-org/gitlab/-/issues/214245
  return params[:evidence_pipeline] if params[:evidence_pipeline]

  sha = existing_tag&.dereferenced_target&.sha
  sha ||= repository&.commit(ref)&.sha

  return unless sha

  project.ci_pipelines.for_sha(sha).last
end