summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-08-04 19:49:28 +0200
committerParménides GV <parmegv@sdf.org>2015-08-04 19:49:28 +0200
commitb1fcf8692af28b4c4b66296bdf92e347eac23619 (patch)
tree0a33772b56c50fd59ff6856fb1dd8175287f925a
parentd059bfc4b4a5e2f994fa4323f90f636b094a88e4 (diff)
Publish and sumo, and symlink to latest
1) Scp to server (configured in conf.cfg) 2) Symlink to latest
-rw-r--r--master.cfg79
1 files changed, 58 insertions, 21 deletions
diff --git a/master.cfg b/master.cfg
index c53c37d..3d166aa 100644
--- a/master.cfg
+++ b/master.cfg
@@ -145,14 +145,67 @@ def create_builder(repo_name):
factory.addStep(ShellCommand(command=['trial', namespace], env=venv_path_factory, workdir=repo_name, name="trial "+namespace))
if repo_name is 'bitmask_client':
- factory.addStep(ShellCommand(command=['make', 'sumo_tarball'],
- env=venv_path_factory, workdir=repo_name,
- doStepIf=(lambda step: step.getProperty('slavename') == localhost_slave),
- name="make sumo tarball"))
+ publish_sumo = publish_sumo_command('`ls -t *SUMO.tar.gz | head -1`')
+ factory.addSteps(
+ [ShellCommand(command=['make', 'sumo_tarball'],
+ env=venv_path_factory, workdir=repo_name,
+ doStepIf=(lambda step: step.getProperty('slavename') == localhost_slave),
+ name="make sumo tarball"),
+ ShellCommand(command=publish_sumo,
+ env=venv_path_factory, workdir=repo_name + "/dist",
+ doStepIf=(lambda step: step.getProperty('slavename') == localhost_slave),
+ name="publish sumo to ftp")
+ ])
return BuilderConfig(name=builder_name, slavenames=[localhost_slave], factory=factory)
+def publish_sumo_command(location):
+ directory = config.get('ftp', 'sumo_target_directory')
+ command = ftp_publish_command(location, directory) + '&&' + ftp_soft_link_sumo(location)
+
+ return command
+
+def ftp_soft_link_sumo(filename):
+ directory = config.get('ftp', 'sumo_target_directory')
+ ssh_port = config.get('ftp', 'ssh_port')
+ ssh_key = config.get('ftp', 'ssh_key')
+ user = config.get('ftp', 'user')
+ server = config.get('ftp', 'server')
+
+ ssh_command = ['ssh',
+ "-i", ssh_key,
+ '-p', ssh_port,
+ user + '@' + server,
+ '"ln -sf ' + directory + '/' + filename + ' ' + directory + '/leap.bitmask-latest-SUMO.tar.gz"']
+
+ # Flatten to a string so that a shell executes de command, and
+ # expands ~
+ return ' '.join(ssh_command)
+
+def ftp_publish_dir_command(from_dir, to_dir):
+ return ftp_publish_command(from_dir + "/*", to_dir)
+
+def ftp_publish_command(from_location, to_location):
+ ssh_port = config.get('ftp', 'ssh_port')
+ ssh_key = config.get('ftp', 'ssh_key')
+ user = config.get('ftp', 'user')
+ server = config.get('ftp', 'server')
+
+ scp_command = ['scp',
+ '-i', ssh_key,
+ '-P', ssh_port,
+ '-r', from_location,
+ user + '@' + server + ':' + to_location]
+ ssh_command = ['ssh',
+ "-i", ssh_key,
+ '-p', ssh_port,
+ user + '@' + server,
+ '"chmod g+r ' + to_location + ' && chown -R ' + user + ':www-data ' + to_location + '"']
+ # Flatten to a string so that a shell executes de command, and
+ # expands ~
+ return ' '.join(scp_command) + ' && ' + ' '.join(ssh_command)
+
def make_wheel_builder():
builder_name = "builder_wheels"
venv_name = "virtualenv_wheels"
@@ -184,26 +237,10 @@ def make_wheel_builder():
return BuilderConfig(name=builder_name, slavenames=[localhost_slave], factory=factory)
def publish_wheels_command():
- ssh_port = config.get('ftp', 'ssh_port')
- ssh_key = config.get('ftp', 'ssh_key')
original_wheelhouse = config.get('ftp', 'copy_wheels_from')
- user = config.get('ftp', 'user')
- server = config.get('ftp', 'server')
directory = config.get('ftp', 'directory')
- scp_command = ['scp',
- '-i', ssh_key,
- '-P', ssh_port,
- '-r', original_wheelhouse + "/*",
- user + '@' + server + ':' + directory]
- ssh_command = ['ssh',
- "-i", ssh_key,
- '-p', ssh_port,
- user + '@' + server,
- '"chmod g+r ' + directory + '/* && chown ' + user + ':www-data ' + directory + '/*"']
- # Flatten to a string so that a shell executes de command, and
- # expands ~
- return ' '.join(scp_command) + ' && ' + ' '.join(ssh_command)
+ return ftp_publish_dir_command(original_wheelhouse, directory)
c['builders'] = []