Revision 024faf05

b/ci/new_config
5 5
apt_repo = http://apt.dev.grnet.gr squeeze/
6 6
# Synnefo git repo
7 7
synnefo_repo = https://code.grnet.gr/git/synnefo
8
# Git branch to test (specify sha1 or branch name)
9
synnefo_branch = HEAD
8
# Git branch to test (specify sha1 or branch name). If not set, the
9
# branch/sha will result from the current repository.
10
synnefo_branch =
10 11
# snf-deploy git repo
11 12
deploy_repo = https://code.grnet.gr/git/snf-deploy
12 13
# Defines the schema that snf-deploy will use
b/ci/utils.py
9 9
import time
10 10
import logging
11 11
import fabric.api as fabric
12
import subprocess
12 13
from ConfigParser import ConfigParser, DuplicateSectionError
13 14

  
14 15
from kamaki.cli import config as kamaki_config
......
352 353
        _run(cmd, False)
353 354

  
354 355
        synnefo_repo = self.config.get('Global', 'synnefo_repo')
355
        synnefo_branch = self.config.get('Global', 'synnefo_branch')
356
        synnefo_branch = self.config.get("Global", "synnefo_branch")
357
        if synnefo_branch == "":
358
            synnefo_branch =\
359
                subprocess.Popen(["git", "rev-parse", "--abbrev-ref", "HEAD"],
360
                    stdout=subprocess.PIPE).communicate()[0].strip()
361
            if synnefo_branch == "HEAD":
362
                synnefo_branch = \
363
                    subprocess.Popen(["git", "rev-parse","--short", "HEAD"],
364
                        stdout=subprocess.PIPE).communicate()[0].strip()
365
        self.logger.info("Will use branch %s" % synnefo_branch)
356 366
        # Currently clonning synnefo can fail unexpectedly
357 367
        cloned = False
358
        for i in range(3):
368
        for i in range(10):
359 369
            self.logger.debug("Clone synnefo from %s" % synnefo_repo)
360
            cmd = ("git clone --branch %s %s"
361
                   % (synnefo_branch, synnefo_repo))
362 370
            try:
363
                _run(cmd, False)
371
                _run("git clone %s synnefo" % synnefo_repo, False)
364 372
                cloned = True
365 373
                break
366 374
            except:
367 375
                self.logger.warning("Clonning synnefo failed.. retrying %s"
368 376
                                    % i)
377
        cmd ="""
378
        cd synnefo
379
        for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
380
            git branch --track ${branch##*/} $branch
381
        done
382
        git checkout %s
383
        """ % (synnefo_branch)
384
        _run(cmd, False)
385

  
369 386
        if not cloned:
370 387
            self.logger.error("Can not clone Synnefo repo.")
371 388
            sys.exit(-1)

Also available in: Unified diff