Making possible to fetch repositories with custom tag

* adding checkout to fetch_repository
* allign logs with build and deploy commands

Change-Id: I77a396909c93dd8209d5e667d9c45a2ea75542c6
This commit is contained in:
Andrey Pavlov 2016-10-25 10:35:23 +03:00
parent f6ae9c6884
commit 7aff1c0900
1 changed files with 6 additions and 7 deletions

View File

@ -18,17 +18,16 @@ def fetch_repository(repository_def):
name = repository_def['name']
dest_dir = os.path.join(CONF.repositories.path, name)
if os.path.isdir(dest_dir):
LOG.debug('%s was already cloned, skipping', name)
LOG.debug('%s: Repository is already cloned, skipping', name)
return
git_url = repository_def['git_url']
git_ref = repository_def.get('git_ref')
LOG.debug('%s: Cloning repository %s to %s', name, git_url, dest_dir)
repo = git.Repo.clone_from(git_url, dest_dir)
if git_ref:
kwargs = {'branch': git_ref}
else:
kwargs = {}
LOG.debug('Clonning %s from %s to %s', name, git_url, dest_dir)
git.Repo.clone_from(git_url, dest_dir, **kwargs)
LOG.info('Cloned %s repo', name)
LOG.debug('%s: Changing reference to "%s"', name, git_ref)
repo.git.checkout(git_ref)
LOG.info('%s: Repository has been cloned', name)
def fetch_repositories(repository_defs=None):