diff options
Diffstat (limited to 'api.py')
-rwxr-xr-x | api.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -472,7 +472,27 @@ class Controller(API): name = r.get('name') logging.info('Repository %s build status %s', name, status) self._builds[name] = status + if status == 'success': + self._deploy(name) + def _deploy(self, name): + spec = { + 'artifact_id': name, + 'published_name': name, + } + + url = '{}/updaterepo'.format(self.DEPLOYER) + argv = [ + 'curl', + '-HAuthorization: Bearer {}'.format(self._token), + '-HContent-Type: application/json', + '--data-binary', json.dumps(spec), + url, + ] + ok = runcmd('.', argv, self.MAX_TRIGGER_TIME) + if not ok: + raise bottle.HTTPError(500, 'Error deploying') + return 'Deployed\n' def runcmd(cwd, argv, timeout): |