Commit 923dc677 authored by Sebastien Robin's avatar Sebastien Robin

allow to test a particular branch

parent 56686a2b
from setuptools import setup, find_packages
name = "erp5.recipe.testnode"
version = '1.0'
version = '1.0.5'
def read(name):
return open(name).read()
......
......@@ -47,11 +47,12 @@ class SlapOSControler(object):
'reference': config['computer_id'],
'software_root': config['software_root']}))
def runSoftwareRelease(self, config, process_group_pid_list=None):
def runSoftwareRelease(self, config, environment, process_group_pid_list=None):
print "SlapOSControler.runSoftwareRelease"
while True:
cpu_count = os.sysconf("SC_NPROCESSORS_ONLN")
os.putenv('MAKEFLAGS', '-j%s' % cpu_count)
os.environ['PATH'] = environment['PATH']
slapgrid = subprocess.Popen([config['slapgrid_software_binary'], '-v', '-c',
#'--buildout-parameter',"'-U -N' -o",
config['slapos_config']],
......
......@@ -85,6 +85,7 @@ class Recipe(BaseSlapRecipe):
working_directory=CONFIG['working_directory'],
vcs_repository=self.parameter_dict.get('vcs_repository'),
node_quantity=self.parameter_dict.get('node_quantity', '1'),
branch=self.parameter_dict.get('branch', None),
test_suite_master_url=self.parameter_dict.get(
'test_suite_master_url', None),
test_suite_name=self.parameter_dict.get('test_suite_name'),
......@@ -96,6 +97,7 @@ class Recipe(BaseSlapRecipe):
# environment of running bot
bot_environment=self.parameter_dict.get('bot_environment', ''),
partition_reference=CONFIG['partition_reference'],
environment=dict(PATH=os.environ['PATH']),
)
]))
......
......@@ -59,6 +59,7 @@ slapos_controler = None
def run(args):
config = args[0]
slapgrid = None
branch = config.get('branch', None)
supervisord_pid_file = os.path.join(config['instance_root'], 'var', 'run',
'supervisord.pid')
subprocess.check_call([config['git_binary'],
......@@ -74,27 +75,33 @@ def run(args):
# Write our own software.cfg to use the local repository
custom_profile_path = os.path.join(config['working_directory'], 'software.cfg')
config['custom_profile_path'] = custom_profile_path
if not os.path.exists(custom_profile_path):
# create a profile in order to use the repository we already have
custom_profile = open(custom_profile_path, 'w')
profile_content = """
# create a profile in order to use the repository we already have
custom_profile = open(custom_profile_path, 'w')
profile_content = """
[buildout]
extends = %(software_config_path)s
[%(repository_name)s_repository]
[%(repository_name)s]
repository = %(repository_path)s
""" % {'software_config_path': os.path.join(repository_path,
config['profile_url']),
'repository_name': repository_name,
'repository_path' : repository_path}
custom_profile.write(profile_content)
custom_profile.close()
config['profile_url']),
'repository_name': repository_name,
'repository_path' : repository_path}
if branch is not None:
profile_content += "\nbranch = %s" % branch
custom_profile.write(profile_content)
custom_profile.close()
try:
while True:
# Make sure we have local repository
if not os.path.exists(repository_path):
subprocess.check_call([config['git_binary'],
'clone', config['vcs_repository'], repository_path])
parameter_list = [config['git_binary'], 'clone',
config['vcs_repository']]
if branch is not None:
parameter_list.extend(['-b',branch])
parameter_list.append(repository_path)
subprocess.check_call(parameter_list)
# XXX this looks like to not wait the end of the command
# Make sure we have local repository
updater = Updater(repository_path, git_binary=config['git_binary'])
......@@ -105,7 +112,6 @@ repository = %(repository_path)s
continue
previous_revision = revision
print config
portal_url = config['test_suite_master_url']
test_result_path = None
......@@ -137,6 +143,7 @@ repository = %(repository_path)s
if run_software:
# this should be always true later, but it is too slow for now
slapos_controler.runSoftwareRelease(config,
environment=config['environment'],
process_group_pid_list=process_group_pid_list,
)
run_software = False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment