yellow team mailing list archive
-
yellow team
-
Mailing list archive
-
Message #00411
[Merge] lp:~gary/charms/oneiric/buildbot-slave/run-as-buildbot into lp:~yellow/charms/oneiric/buildbot-slave/trunk
Gary Poster has proposed merging lp:~gary/charms/oneiric/buildbot-slave/run-as-buildbot into lp:~yellow/charms/oneiric/buildbot-slave/trunk.
Requested reviews:
Launchpad Yellow Squad (yellow)
For more details, see:
https://code.launchpad.net/~gary/charms/oneiric/buildbot-slave/run-as-buildbot/+merge/92400
These changes, along with those in https://code.launchpad.net/~gary/charms/oneiric/buildbot-master/run-as-buildbot/+register-merge , make the buildbot slave run as the buildbot user, and generally matches the Debian setup better.
--
https://code.launchpad.net/~gary/charms/oneiric/buildbot-slave/run-as-buildbot/+merge/92400
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~gary/charms/oneiric/buildbot-slave/run-as-buildbot into lp:~yellow/charms/oneiric/buildbot-slave/trunk.
=== modified file 'config.setuplxc.yaml'
--- config.setuplxc.yaml 2012-02-06 21:11:38 +0000
+++ config.setuplxc.yaml 2012-02-10 01:16:25 +0000
@@ -1,8 +1,10 @@
buildbot-slave:
builders: lucid_lp,lucid_db_lp
script-retrieval-method: bzr_cat
- script-url: "http://bazaar.launchpad.net/~gmb/launchpad/neuter-setuplxc/utilities/setuplxc.py"
+ script-url: "http://bazaar.launchpad.net/~gary/launchpad/setuplxc/utilities/setuplxc.py"
script-path: setuplxc.py
- script-args: "-u launchpad-pqm -e launchpad-pqm@xxxxxxxxxxxxx -f 'Launchpad PQM' /home/launchpad-pqm/launchpad/"
+ # The buildbot user's home directory is /var/lib/buildout.
+ # The LP dependencies will be in /var/lib/buildout/dependencies.
+ script-args: "-u buildbot -e launchpad-pqm@xxxxxxxxxxxxx -f 'Launchpad PQM' $INSTALLDIR"
extra-repository: deb http://us.archive.ubuntu.com/ubuntu/ lucid main universe
buildbot-pkg: buildbot/lucid
=== modified file 'config.yaml'
--- config.yaml 2012-02-06 21:11:38 +0000
+++ config.yaml 2012-02-10 01:16:25 +0000
@@ -40,4 +40,4 @@
description: |
The directory where the Buildbot slave will be installed.
type: string
- default: /tmp/buildslave
+ default: /var/lib/buildbot/slaves/slave
=== modified file 'hooks/install'
--- hooks/install 2012-02-09 10:44:48 +0000
+++ hooks/install 2012-02-10 01:16:25 +0000
@@ -7,11 +7,16 @@
apt_get_install,
command,
get_config,
+ install_extra_repository,
log,
log_entry,
log_exit,
run,
)
+from local import (
+ config_json,
+ create_slave,
+ )
import os
import shlex
import subprocess
@@ -40,21 +45,21 @@
def wget(source, path):
target = os.path.join('/tmp', path)
- command('wget', '-O', target, source)
+ run('wget', '-O', target, source)
return target
def hg_fetch(source, path):
apt_get_install('mercurial')
target = tempfile.mktemp()
- command('hg', 'clone', source, target)
+ run('hg', 'clone', source, target)
return os.path.join(target, path)
def git_fetch(source, path):
apt_get_install('git')
target = tempfile.mktemp()
- command('git', 'clone', source, target)
+ run('git', 'clone', source, target)
return os.path.join(target, path)
@@ -82,9 +87,33 @@
url = config.get('script-url')
path = config.get('script-path')
args = config.get('script-args')
+ buildbot_pkg = config.get('buildbot-pkg')
+ extra_repo = config.get('extra-repository')
+ buildbot_dir = config.get('installdir')
+
+ if extra_repo:
+ install_extra_repository(extra_repo)
+
+ if buildbot_pkg:
+ log('Installing ' + buildbot_pkg)
+ apt_get_install(buildbot_pkg)
+ log('Creating initial buildbot slave in ' + buildbot_dir)
+ create_slave('temporary', 'temporary', buildbot_dir=buildbot_dir)
+
+ config_json.set(config)
+
retrieve = METHODS.get(method)
if retrieve and url and path:
- sys.exit(handle_script(retrieve, url, path, args))
+ # Make buildbot user have a shell by editing /etc/passwd.
+ # Otherwise you cannot ssh as this user, which some scripts
+ # need (e.g. those that create lxc containers). We choose sh as
+ # a standard and basic "system" shell.
+ run('usermod', '-s', '/bin/sh', 'buildbot')
+ # This is naive; we can make it more sophisticated (e.g., allowing
+ # escaping dollar signs) if we discover we need it. For now,
+ # simplicity wins.
+ replaced_args = args.replace('$INSTALLDIR', buildbot_dir)
+ sys.exit(handle_script(retrieve, url, path, replaced_args))
if __name__ == '__main__':
Follow ups