class KuberKit::ArtifactsSync::GitArtifactResolver

Public Instance Methods

resolve(shell, artifact) click to toggle source
# 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

Private Instance Methods

artifact_already_cloned?(shell:, target_path:, remote_url:) click to toggle source
# File lib/kuber_kit/artifacts_sync/git_artifact_resolver.rb, line 27
def artifact_already_cloned?(shell:, target_path:, remote_url:)
  target_remote_url = git_commands.get_remote_url(shell, target_path)
  target_remote_url == remote_url
end