Module: Dapp::Dimg::Dapp::Command::Stages::CleanupRepo

Included in:
Dapp
Defined in:
lib/dapp/dimg/dapp/command/stages/cleanup_repo.rb

Instance Method Summary collapse

Instance Method Details

#stages_cleanup_repoObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dapp/dimg/dapp/command/stages/cleanup_repo.rb', line 7

def stages_cleanup_repo
  lock_repo(repo = option_repo) do
    raise ::Dapp::Error::Command, code: :stages_cleanup_required_option unless stages_cleanup_option?

    log_step_with_indent("#{repo} stages") do
      registry        = dimg_registry(repo)
      repo_dimgs      = repo_dimgs_images(registry)
      repo_dimgstages = repo_dimgstages_images(registry)

      array_hash_delete_if_by_id(repo_dimgstages, repo_dimgs) # ignoring stages with dimgs ids (v2)

      proper_repo_cache(registry, repo_dimgstages)                   if proper_cache_version?
      repo_dimgstages_cleanup(registry, repo_dimgs, repo_dimgstages) if proper_repo_cache?
      proper_repo_git_commit(registry)                               if proper_git_commit?
    end
  end
end