diff options
author | Lars Wirzenius <lwirzenius@wikimedia.org> | 2019-07-23 20:02:40 +0300 |
---|---|---|
committer | Lars Wirzenius <lwirzenius@wikimedia.org> | 2019-07-23 20:02:40 +0300 |
commit | 7d43e0237cb1dacbbf576d29fc45113a0edd8dd8 (patch) | |
tree | f7346dbdc0793b72e512e4010951c6f99241f320 | |
parent | 047c2aca245805746cee3af9f2588373b1602500 (diff) | |
download | wmf-ci-arch-7d43e0237cb1dacbbf576d29fc45113a0edd8dd8.tar.gz |
Add: deploy upon success
-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): |