[152630] contrib/buildbot-test
raimue at macports.org
raimue at macports.org
Tue Sep 13 16:52:15 PDT 2016
Revision: 152630
https://trac.macports.org/changeset/152630
Author: raimue at macports.org
Date: 2016-09-13 16:52:14 -0700 (Tue, 13 Sep 2016)
Log Message:
-----------
buildbot: add deploy config for www/guide
This adds preliminary support for deploying generated static files with rsync
to the host running the web server. The builders and schedulers will only be
added if the deploy configuration is filled.
Modified Paths:
--------------
contrib/buildbot-test/config.json.sample
contrib/buildbot-test/master.cfg
Modified: contrib/buildbot-test/config.json.sample
===================================================================
--- contrib/buildbot-test/config.json.sample 2016-09-13 20:48:39 UTC (rev 152629)
+++ contrib/buildbot-test/config.json.sample 2016-09-13 23:52:14 UTC (rev 152630)
@@ -9,5 +9,21 @@
"svnurl": "https://svn.macports.org/repository/macports/trunk",
"archivesite": "https://packages.macports.org",
"slaveprefix": "/opt/local",
- "toolsprefix": "/opt/mports"
+ "toolsprefix": "/opt/mports",
+ "deploy": {
+ "www": {
+ "host": "",
+ "user": "",
+ "sshkeyfile": "",
+ "sshknownhostsfile": "ssh_known_hosts",
+ "destpath": ""
+ },
+ "guide": {
+ "host": "",
+ "user": "",
+ "sshkeyfile": "",
+ "sshknownhostsfile": "ssh_known_hosts",
+ "destpath": ""
+ }
+ }
}
Modified: contrib/buildbot-test/master.cfg
===================================================================
--- contrib/buildbot-test/master.cfg 2016-09-13 20:48:39 UTC (rev 152629)
+++ contrib/buildbot-test/master.cfg 2016-09-13 23:52:14 UTC (rev 152630)
@@ -37,7 +37,8 @@
'svnurl': "https://svn.macports.org/repository/macports/trunk",
'archivesite': "https://packages.macports.org",
'slaveprefix': "/opt/local",
- 'toolsprefix': "/opt/mports"
+ 'toolsprefix': "/opt/mports",
+ 'deploy': {}
}
if os.path.exists(_path('config.json')):
@@ -146,7 +147,6 @@
portwatcher_buildernames = ["ports-"+plat+"-watcher" for plat in build_platforms if 'linux' not in plat and '10.5_ppc' != plat]
portbuilder_buildernames = ["ports-"+plat+"-builder" for plat in build_platforms if 'linux' not in plat and '10.5_ppc' != plat]
portbuilder_triggerables = ["ports-"+plat+"-trigger" for plat in build_platforms if 'linux' not in plat and '10.5_ppc' != plat]
-docbuilder_buildernames = ["docs-www", "docs-guide"] if "docs" in slavedata['slaves'].keys() else []
from buildbot.schedulers.basic import SingleBranchScheduler
from buildbot.schedulers.forcesched import ForceScheduler
@@ -185,25 +185,32 @@
default="",
size=30,
required=True)
- ]),
- SingleBranchScheduler(
- name="www",
- treeStableTimer=300,
- change_filter = wwwfilter,
- builderNames=docbuilder_buildernames),
- SingleBranchScheduler(
- name="guide",
- treeStableTimer=300,
- change_filter = guidefilter,
- builderNames=docbuilder_buildernames),
- ForceScheduler(
- name="www_force",
- builderNames=docbuilder_buildernames),
- ForceScheduler(
- name="guide_force",
- builderNames=docbuilder_buildernames),
+ ])
]
+
+if 'www' in config['deploy']:
+ c['schedulers'] += [
+ SingleBranchScheduler(
+ name="www",
+ treeStableTimer=300,
+ change_filter = wwwfilter,
+ builderNames=["docs-www"]),
+ ForceScheduler(
+ name="www_force",
+ builderNames=["docs-www"])]
+
+if 'guide' in config['deploy']:
+ c['schedulers'] += [
+ SingleBranchScheduler(
+ name="guide",
+ treeStableTimer=300,
+ change_filter = guidefilter,
+ builderNames=["docs-guide"]),
+ ForceScheduler(
+ name="guide_force",
+ builderNames=["docs-www"])]
+
for i in range(len(portbuilder_buildernames)):
c['schedulers'].append(Triggerable(
name=portbuilder_triggerables[i],
@@ -297,7 +304,7 @@
ulpath='archive_staging'
ulpath_unique=ulpath+'-%(buildername)s'
-from buildbot.steps.transfer import DirectoryUpload
+from buildbot.steps.transfer import FileDownload, DirectoryUpload
from buildbot.steps.master import MasterShellCommand
from buildbot.steps.trigger import Trigger
@@ -460,25 +467,73 @@
alwaysRun=True))
-docs_www_factory = BuildFactory()
-docs_www_factory.addStep(SVN(
- repourl='https://svn.macports.org/repository/macports/trunk/www',
- method="copy"))
-# TODO: validate/lint files
-# TODO: deploy generated files
-# TODO: incremental mode with cleanup?
+def make_rsync_deploy_steps(host, user, sshkeyfile, sshknownhostsfile, srcpath, destpath):
+ return [
+ FileDownload(name="ssh key",
+ description="transferring",
+ descriptionDone="transfer",
+ mastersrc=sshkeyfile,
+ slavedest="ssh_key",
+ mode=0600),
+ FileDownload(name="ssh known_hosts",
+ description="transferring",
+ descriptionDone="transfer",
+ mastersrc=sshknownhostsfile,
+ slavedest="ssh_known_hosts",
+ mode=0600),
+ ShellCommand(name="rsync",
+ description="deploying",
+ descriptionDone="deploy",
+ command="rsync -avzhC --delay-updates --delete-delay %s/ %s@%s:%s/" % (srcpath, user, host, destpath),
+ env={'RSYNC_RSH': "ssh -i ssh_key -oUserKnownHostsFile=ssh_known_hosts"})
+ ]
-docs_guide_factory = BuildFactory()
-docs_guide_factory.addStep(SVN(
- repourl='https://svn.macports.org/repository/macports/trunk/doc-new',
- method="copy"))
-# TODO: check for existance of tools in toolsprefix?
-docs_guide_factory.addStep(Compile(command="make validate"))
-docs_guide_factory.addStep(Compile(command="make all"))
-# TODO: deploy generated files
-# TODO: incremental mode with cleanup?
+if 'www' in config['deploy']:
+ docs_www_factory = BuildFactory()
+ # TODO: incremental mode with cleanup?
+ docs_www_factory.addStep(SVN(
+ repourl='https://svn.macports.org/repository/macports/trunk/www',
+ mode="full",
+ method="copy",
+ workdir="www"))
+ # TODO: validate/lint files
+ docs_www_factory.addSteps(
+ make_rsync_deploy_steps(
+ host=config['deploy']['www']['host'],
+ user=config['deploy']['www']['user'],
+ sshkeyfile=config['deploy']['www']['sshkeyfile'],
+ sshknownhostsfile=config['deploy']['www']['sshknownhostsfile'],
+ srcpath="www",
+ destpath=config['deploy']['www']['destpath']))
+if 'guide' in config['deploy']:
+ docs_guide_factory = BuildFactory()
+ # TODO: incremental mode with cleanup?
+ docs_guide_factory.addStep(SVN(
+ repourl='https://svn.macports.org/repository/macports/trunk/doc-new',
+ mode="full",
+ method="copy",
+ workdir="guide"))
+ # TODO: check for existence of tools in toolsprefix
+ docs_guide_factory.addStep(Compile(
+ name="validate",
+ description="validating",
+ descriptionDone="validate",
+ command="make validate",
+ workdir="guide"))
+ docs_guide_factory.addStep(Compile(
+ command="make all",
+ workdir="guide"))
+ docs_guide_factory.addSteps(
+ make_rsync_deploy_steps(
+ host=config['deploy']['guide']['host'],
+ user=config['deploy']['guide']['user'],
+ sshkeyfile=config['deploy']['guide']['sshkeyfile'],
+ sshknownhostsfile=config['deploy']['guide']['sshknownhostsfile'],
+ srcpath="guide",
+ destpath=config['deploy']['guide']['destpath']))
+
# === BUILDER CONFIGURATION ===
from buildbot.config import BuilderConfig
@@ -525,20 +580,22 @@
tags=["portbuilder", os_version],
env=merge_dicts(env_buildinfo, {"PATH": path_ports}))]
-if "docs" in slavedata['slaves'].keys():
- c['builders'] += [
+if 'www' in config['deploy']:
+ c['builders'].append(
BuilderConfig(
name="docs-www",
slavenames=["docs"],
factory=docs_www_factory,
tags=["docs", "www"],
- env=merge_dicts(env_buildinfo, {"PATH": path_ports})),
+ env=merge_dicts(env_buildinfo, {"PATH": path_ports})))
+if 'guide' in config['deploy']:
+ c['builders'].append(
BuilderConfig(
name="docs-guide",
slavenames=["docs"],
factory=docs_guide_factory,
tags=["docs", "guide"],
- env=merge_dicts(env_buildinfo, {"PATH": path_ports}))]
+ env=merge_dicts(env_buildinfo, {"PATH": path_ports})))
####### STATUS TARGETS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160913/1a1dfdfb/attachment.html>
More information about the macports-changes
mailing list