Send open CORS header for jobs and builds

We don't have any precious data yet, so keep builds and jobs open like
status. This lets us use built artifacts as preview from CI jobs.

Change-Id: I81cad00d2d8f0b763601fc67a4863faa96037fc7
This commit is contained in:
Monty Taylor 2017-12-13 11:25:22 -06:00
parent 83f504c966
commit d59c61ddc6
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 4 additions and 1 deletions

View File

@ -190,7 +190,9 @@ class GearmanHandler(object):
def job_list(self, request):
tenant = request.match_info["tenant"]
job = self.rpc.submitJob('zuul:job_list', {'tenant': tenant})
return web.json_response(json.loads(job.data[0]))
resp = web.json_response(json.loads(job.data[0]))
resp.headers['Access-Control-Allow-Origin'] = '*'
return resp
def key_get(self, request):
source = request.match_info["source"]
@ -290,6 +292,7 @@ class SqlHandler(object):
raise ValueError("Unknown parameter %s" % k)
data = self.get_builds(args)
resp = web.json_response(data)
resp.headers['Access-Control-Allow-Origin'] = '*'
except Exception as e:
self.log.exception("Jobs exception:")
resp = web.json_response({'error_description': 'Internal error'},