summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Holland <william.holland@codethink.co.uk>2015-09-23 09:45:20 +0100
committerWill Holland <william.holland@codethink.co.uk>2015-09-23 09:45:20 +0100
commitc47914485e4eca6e1dda6f9702fda49e65ef750c (patch)
tree1b76c8725b4021a3cdcc5489a3877b9fb3d3e293
parent75303a157c460c98dd0fe66c9a1bf315c9ffb45c (diff)
downloadciatlib-c47914485e4eca6e1dda6f9702fda49e65ef750c.tar.gz
Fix having added the wrong directory
-rw-r--r--ciatlib/__init__.py2
-rw-r--r--ciatlib/__init__.pycbin0 -> 2166 bytes
-rw-r--r--ciatlib/common.py10
-rw-r--r--ciatlib/master.py75
-rw-r--r--setup.py5
5 files changed, 92 insertions, 0 deletions
diff --git a/ciatlib/__init__.py b/ciatlib/__init__.py
new file mode 100644
index 0000000..ccfe4e7
--- /dev/null
+++ b/ciatlib/__init__.py
@@ -0,0 +1,2 @@
+import common
+import master
diff --git a/ciatlib/__init__.pyc b/ciatlib/__init__.pyc
new file mode 100644
index 0000000..87b4d90
--- /dev/null
+++ b/ciatlib/__init__.pyc
Binary files differ
diff --git a/ciatlib/common.py b/ciatlib/common.py
new file mode 100644
index 0000000..7a70a8b
--- /dev/null
+++ b/ciatlib/common.py
@@ -0,0 +1,10 @@
+def log(logfile,component,msg):
+ ''' write message to log file with timestamp and script name '''
+ import datetime
+ _component = str(component)
+ _msg = str(msg)
+ dt = str(datetime.datetime.now()).split('.')[0]
+ to_log = "[%s][%s] %s" % (dt, _component, _msg)
+ log_file = open(LOGFILE,'a')
+ log_file.write('%s\n' % to_log)
+ log_file.close()
diff --git a/ciatlib/master.py b/ciatlib/master.py
new file mode 100644
index 0000000..99a99f7
--- /dev/null
+++ b/ciatlib/master.py
@@ -0,0 +1,75 @@
+from buildbot.process.factory import BuildFactory
+from buildbot.steps.shell import ShellCommand
+from buildbot.plugins import util
+from buildbot.plugins import steps
+Property = util.Property
+Git = steps.Git
+
+class GitSource:
+ def __init__(self,urls,ref,sha=""):
+ ''' Specify a source by a list of urls and a ref and optionally a SHA
+ '''
+ if type(urls) is list:
+ self.urls = urls
+ elif type(urls) is str:
+ self.urls = [urls]
+ else:
+ error_msg = 'GitSource requires either a url as a string or a list of url strings'
+ raise TypeError(error_msg)
+ self.ref = ref
+ self.sha = sha
+
+class Column:
+
+ def add_get_definitions(self):
+ ''' add a step fetch definitions '''
+
+ default_ref = "cu010-trove/br6/firehose-test-1"
+ sha = Property("sha",default=default_ref)
+ get_defns_cmd = ['sh','get_definitions.sh',sha]
+ shell_cmd = ShellCommand(command=get_defns_cmd,
+ timeout=self.timeout)
+ self.factory.addStep(shell_cmd)
+
+ def format_cmd(self):
+ ''' a buildbot shell command to pass the properties to trigger '''
+
+ util_properties = []
+ for property in self.properties:
+ name = property[0]
+ default_str = property[1]
+ util_property = Property(name,default=default_str)
+ util_properties.append(util_property)
+ cmd = ['sh',self.trigger]+util_properties
+ return ShellCommand(command=cmd,
+ timeout=self.timeout)
+
+ def __init__(self,
+ name,
+ source_repo,
+ category,
+ trigger,
+ slavenames,
+ properties,
+ timeout=1200,
+ get_definitions=False):
+ ''' A worker in CIAT Orchestration which appears as a column in the
+ buildbot waterfall '''
+
+ self.name = name
+ assert isinstance(source_repo,GitSource)
+ self.source_repo = source_repo
+ self.category = category
+ self.trigger = 'triggers/%s' % trigger
+ self.slavenames = slavenames
+ self.properties = properties
+ self.timeout = timeout
+ self.get_definitions = get_definitions
+ self.factory = BuildFactory()
+ self.factory.addStep(Git(
+ repourl=self.source_repo,
+ mode='incremental'))
+ if self.get_definitions:
+ self.add_get_definitions()
+ self.cmd = self.format_cmd()
+ self.factory.addStep(self.cmd)
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..b6454b4
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,5 @@
+from distutils.core import setup
+
+setup(name='ciatlib',
+ packages=['ciatlib'],
+ )