summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Holland <william.holland@codethink.co.uk>2015-10-01 00:55:27 +0100
committerWill Holland <william.holland@codethink.co.uk>2015-10-01 00:55:27 +0100
commitc694410fe86284f0fff49865308e81f2466abe70 (patch)
tree846c2480b1ead7a30fe298dce8ac8a8e9280bfd2
parent8d12d679fa874eabd964bafd8260a918849619fc (diff)
downloadorchestration-c694410fe86284f0fff49865308e81f2466abe70.tar.gz
Bottlerock call correct category
-rw-r--r--source/bottlerock.py31
-rw-r--r--source/configure.py17
-rw-r--r--source/master.cfg2
3 files changed, 34 insertions, 16 deletions
diff --git a/source/bottlerock.py b/source/bottlerock.py
index 3ba63e5..0a6e7a7 100644
--- a/source/bottlerock.py
+++ b/source/bottlerock.py
@@ -7,6 +7,7 @@ from bottle import post, request, run, HTTPResponse
import imp
import ciat_deployer
orch_config = imp.load_source('orch_config', '../source/orch_config.py')
+configure = imp.load_source('configure', '../source/orch_config.py')
LOGFILE = '../orch.log'
DEFINITIONS = 'ssh://git@cu010-trove.codethink.com/baserock/baserock/definitions'
@@ -80,17 +81,22 @@ def repo_update():
ref = change['ref']
sha = change['new']
if repo_name == DEFINITIONS:
+ candidate_refs = configure.get_candidate_refs()
if ref == orch_config.definitions_base_ref:
- # if baseref changes trigger firehose
+ # if baseref changes then trigger firehose
properties = {'repo_name':repo_name,'ref':ref}
return sendchange('repo_update',properties)
- elif ref in orch_config.candidate_refs.keys():
- slave = orch_config.candidate_refs[ref]
+ elif ref in candidate_refs:
+ # if a candidate ref changes then trigger that pipeline
+ pipeline = configure.pipeline_from_candidate_ref(ref)
properties = {"ref":ref,"sha":sha}
- return sendchange('definitions_update_%s' % slave,properties)
+ return sendchange(
+ category = '%s Build' % pipeline.name,
+ properties = properties)
elif repo_name == TEST_REPO:
+ # if the tests change then force a build
force = {"ref":"force","sha":sha}
- return sendchange('definitions_update',force)
+ return sendchange('genivi-demo-platform-x86_64 Build',force)
else:
properties = {'repo_name':repo_name,'ref':ref}
return sendchange('repo_update',properties)
@@ -108,11 +114,12 @@ def build_complete():
"slave",
"buildslave_scripts_sha",
"definitions_sha",
- "testing_sha")
+ "testing_sha",
+ "pipeline")
except Status400 as p:
return missing_property_response(p)
ciat_deployer.buildcomplete(properties)
- return sendchange('build_complete',properties)
+ return sendchange('%s Deploy' % properties['pipeline'],properties)
@post('/deploy_complete')
def deploy_complete():
@@ -121,10 +128,11 @@ def deploy_complete():
'artefact',
'testing_sha',
'buildslave_scripts_sha',
- 'definitions_sha')
+ 'definitions_sha',
+ "pipeline")
except Status400 as p:
return missing_property_response(p)
- return sendchange('deploy_complete',properties)
+ return sendchange('%s Test' % properties['pipeline'],properties)
@post('/testing_complete')
def testing_complete():
@@ -133,10 +141,11 @@ def testing_complete():
'artefact',
'testing_sha',
'buildslave_scripts_sha',
- 'definitions_sha')
+ 'definitions_sha',
+ "pipeline")
except Status400 as p:
return missing_property_response(p)
- return sendchange('publish',properties)
+ return sendchange('%s Pulbish' % properties['pipeline'],properties)
if __name__ == '__main__':
run(host='0.0.0.0', port=8080, debug=True)
diff --git a/source/configure.py b/source/configure.py
index e719c45..30c6d2a 100644
--- a/source/configure.py
+++ b/source/configure.py
@@ -34,19 +34,15 @@ def load_pipeline_configs():
pipelines = []
for pipeline in os.listdir(REPO_DIR):
if not pipeline.endswith('.yaml'): continue
- print "file %s ends in .yaml" % pipeline
pipeline_path = os.path.join(REPO_DIR,pipeline)
- print "path %s" % pipeline_path
with open(pipeline_path, 'r') as f:
config = yaml.load(f)
- print "file loaded"
validate_config(config,
'name',
'candidate-refs',
'slave-type',
'clusters',
'steps')
- print "file validated"
pipelines.append(config)
return pipelines
@@ -66,6 +62,19 @@ def get_columns():
columns += pipeline.columns
return columns
+def get_candidate_refs():
+ global pipelines
+ candidate_refs = []
+ for pipeline in pipelines:
+ candidate_refs += pipeline.candidate_refs
+ return candidate_refs
+
+def pipeline_from_candidate_ref(ref):
+ global pipelines
+ for p in pipelines:
+ if ref in p.candidate_refs:
+ return p
+
def configure():
from ciatlib.master import pipeline_from_dict
global slave_types
diff --git a/source/master.cfg b/source/master.cfg
index 2347886..a90705a 100644
--- a/source/master.cfg
+++ b/source/master.cfg
@@ -6,7 +6,7 @@
import imp
orch_config = imp.load_source('orch_config', '../../source/orch_config.py')
-configure = imp.load_source('orch_config', '../../source/configure.py')
+configure = imp.load_source('configure', '../../source/configure.py')
configure.configure()
# This is the dictionary that the buildmaster pays attention to. We also use