diff options
Diffstat (limited to 'source/bottlerock.py')
-rw-r--r-- | source/bottlerock.py | 31 |
1 files changed, 20 insertions, 11 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) |