Browse Source

Return artifact metadata in API endpoint

Change-Id: Ifbfe385f652e3036373ce1cda7c14f4042ab5477
changes/52/638052/1
James E. Blair 2 years ago
parent
commit
27c9729410
3 changed files with 9 additions and 3 deletions
  1. +2
    -0
      tests/fixtures/config/sql-driver/git/common-config/playbooks/project-test1.yaml
  2. +2
    -1
      tests/unit/test_web.py
  3. +5
    -2
      zuul/web/__init__.py

+ 2
- 0
tests/fixtures/config/sql-driver/git/common-config/playbooks/project-test1.yaml View File

@ -9,6 +9,8 @@
artifacts:
- name: relative
url: relative/docs
metadata:
foo: bar
- name: Return artifact data
zuul_return:
data:


+ 2
- 1
tests/unit/test_web.py View File

@ -749,7 +749,8 @@ class TestArtifacts(ZuulDBTestCase, BaseTestWeb, AnsibleZuulTestCase):
{'url': 'http://example.com/docs',
'name': 'docs'},
{'url': 'http://logs.example.com/build/relative/docs',
'name': 'relative'},
'name': 'relative',
'metadata': {'foo': 'bar'}},
{'url': 'http://example.com/tarball',
'name': 'tarball'},
])

+ 5
- 2
zuul/web/__init__.py View File

@ -448,10 +448,13 @@ class ZuulWebAPI(object):
})
for artifact in build.artifacts:
ret['artifacts'].append({
art = {
'name': artifact.name,
'url': artifact.url,
})
}
if artifact.meta:
art['metadata'] = json.loads(artifact.meta)
ret['artifacts'].append(art)
for provides in build.provides:
ret['provides'].append({
'name': provides.name,


Loading…
Cancel
Save