Class: KuberKit::ArtifactsSync::GitArtifactResolver

Inherits:
AbstractArtifactResolver show all
Defined in:
lib/kuber_kit/artifacts_sync/git_artifact_resolver.rb

Instance Method Summary collapse

Instance Method Details

#resolve(shell, artifact) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/kuber_kit/artifacts_sync/git_artifact_resolver.rb', line 8

def resolve(shell, artifact)
  already_cloned = artifact_already_cloned?(
    shell:       shell,
    target_path: artifact.cloned_path,
    remote_url:  artifact.remote_url,
  )

  if already_cloned
    git_commands.force_pull_repo(shell, 
      path: artifact.cloned_path, branch: artifact.branch
    )
  else
    git_commands.download_repo(shell, 
      remote_url: artifact.remote_url, path: artifact.cloned_path, branch: artifact.branch
    )
  end
end