summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-08-04 14:25:15 +0200
committerParménides GV <parmegv@sdf.org>2015-08-04 15:45:17 +0200
commit8ce7fcf40489de6d91a65ca04866765f6a3fad77 (patch)
treee2ea6b0cd652f48765c7c0ff597d6765c02bb8e2
parent68a198fbd909bb2715f2645455cc494b92fee3bb (diff)
Publish wheels to specified server and directory
conf.cfg points to a user at a server, and a directory, and uploads wheels from a configurable directory to there. Sets the permission in the server to g+r and changes the ownership of the folder to user:www-data
-rw-r--r--conf_template.cfg8
-rw-r--r--master.cfg39
2 files changed, 41 insertions, 6 deletions
diff --git a/conf_template.cfg b/conf_template.cfg
index faed98e..4b59e89 100644
--- a/conf_template.cfg
+++ b/conf_template.cfg
@@ -1,3 +1,11 @@
[Buildbot]
url = url:port
title = Buildbot
+
+[ftp]
+copy_wheels_from = ~/wheelhouse
+ssh_port = port
+ssh_key = ~/.ssh/id
+user = user
+server = server
+directory = ~/wheels \ No newline at end of file
diff --git a/master.cfg b/master.cfg
index 87e3d18..0c4a876 100644
--- a/master.cfg
+++ b/master.cfg
@@ -1,6 +1,12 @@
# -*- python -*-
# ex: set syntax=python:
+import textwrap
+import ConfigParser
+
+config = ConfigParser.ConfigParser()
+config.read('conf.cfg')
+
# This is the dictionary that the buildmaster pays attention to. We also use
# a shorter alias to save typing.
c = BuildmasterConfig = {}
@@ -153,6 +159,8 @@ def make_wheel_builder():
factory = BuildFactory()
generate_wheels = 'pkg/generate_wheels.sh'
+ publish_wheels = publish_wheels_command()
+
sandbox_path_top = {'PATH': "./" + venv_name + '/bin' + ':${PATH}'}
sandbox_path = {'PATH': "../" + venv_name + '/bin' + ':${PATH}'}
sandbox_path_soledad = {'PATH': "../../" + venv_name + '/bin/' + ':${PATH}'}
@@ -167,13 +175,36 @@ def make_wheel_builder():
if 'soledad' in repo_name:
for subpackage in ["common", "client", "server"]:
factory.addStep(
- ShellCommand(command=generate_wheels, env=sandbox_path_soledad, haltOnFailure=True, workdir=workdir+'/'+subpackage, name="reqs: " + repo_name+"."+subpackage))
+ ShellCommand(command=generate_wheels, env=sandbox_path_soledad, haltOnFailure=True, workdir=workdir+'/'+subpackage, name="wheels for " + repo_name+"."+subpackage))
else:
factory.addStep(
- ShellCommand(command=generate_wheels, env=sandbox_path, haltOnFailure=True, workdir=workdir, name="reqs: " + repo_name))
+ ShellCommand(command=generate_wheels, env=sandbox_path, haltOnFailure=True, workdir=workdir, name="wheels for " + repo_name))
+ factory.addStep(ShellCommand(command=publish_wheels, env=sandbox_path, haltOnFailure=True, workdir=".", name="publish wheels"))
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)
+
c['builders'] = []
for repo_name, _, _, _ in REPOS:
@@ -195,10 +226,6 @@ c['www'] = dict(port=PORT_WEB,
####### PROJECT IDENTITY
-import ConfigParser
-config = ConfigParser.ConfigParser()
-config.read('conf.cfg')
-
# the 'title' string will appear at the top of this buildbot
# installation's html.WebStatus home page (linked to the
# 'titleURL') and is embedded in the title of the waterfall HTML page.