Merge "Switch artifact return back to list"
This commit is contained in:
commit
55971612db
|
@ -229,7 +229,7 @@ of item.
|
|||
under the ``zuul`` key:
|
||||
|
||||
.. var:: artifacts
|
||||
:type: dict
|
||||
:type: list
|
||||
|
||||
If the job has a :attr:`job.requires` attribute, and Zuul has
|
||||
found changes ahead of this change in the pipeline with matching
|
||||
|
@ -795,11 +795,11 @@ under the **zuul.artifacts** dictionary. For example:
|
|||
data:
|
||||
zuul:
|
||||
artifacts:
|
||||
tarball:
|
||||
- name: tarball
|
||||
url: http://example.com/path/to/package.tar.gz
|
||||
metadata:
|
||||
version: 3.0
|
||||
docs:
|
||||
- name: docs:
|
||||
url: build/docs/
|
||||
|
||||
If the value of **url** is a relative URL, it will be combined with
|
||||
|
|
|
@ -2,11 +2,3 @@
|
|||
features:
|
||||
- Artifacts may now include a metadata field for storing arbitrary
|
||||
metadata about the artifacts in the SQL database.
|
||||
deprecations:
|
||||
- Artifacts should now be supplied to zuul_return in dictionary form
|
||||
instead of a list. See :ref:`return_artifacts`.
|
||||
|
||||
This is to aid in multiple playbooks providing information back to
|
||||
Zuul without requiring coordination with each other.
|
||||
|
||||
Support for the list format will be removed in a future version.
|
||||
|
|
|
@ -15,20 +15,16 @@
|
|||
import voluptuous as v
|
||||
import urllib.parse
|
||||
|
||||
old_artifact = {
|
||||
'name': str,
|
||||
'url': str,
|
||||
}
|
||||
|
||||
new_artifact = {
|
||||
'url': str,
|
||||
artifact = {
|
||||
'name': v.Required(str),
|
||||
'url': v.Required(str),
|
||||
'metadata': dict,
|
||||
}
|
||||
|
||||
zuul_data = {
|
||||
'zuul': {
|
||||
'log_url': str,
|
||||
'artifacts': v.Any([old_artifact], {str: new_artifact}),
|
||||
'artifacts': [artifact],
|
||||
v.Extra: object,
|
||||
}
|
||||
}
|
||||
|
@ -48,18 +44,13 @@ def get_artifacts_from_result_data(result_data, logger=None):
|
|||
ret = []
|
||||
if validate_artifact_schema(result_data):
|
||||
artifacts = result_data.get('zuul', {}).get(
|
||||
'artifacts', {})
|
||||
if isinstance(artifacts, list):
|
||||
new_artifacts = {}
|
||||
for a in artifacts:
|
||||
new_artifacts[a['name']] = {'url': a['url']}
|
||||
artifacts = new_artifacts
|
||||
'artifacts', [])
|
||||
default_url = result_data.get('zuul', {}).get(
|
||||
'log_url')
|
||||
if default_url:
|
||||
if default_url[-1] != '/':
|
||||
default_url += '/'
|
||||
for artifact_name, artifact in artifacts.items():
|
||||
for artifact in artifacts:
|
||||
url = artifact['url']
|
||||
if default_url:
|
||||
# If the artifact url is relative, it will be combined
|
||||
|
@ -72,7 +63,6 @@ def get_artifacts_from_result_data(result_data, logger=None):
|
|||
logger.debug("Error parsing URL:",
|
||||
exc_info=1)
|
||||
d = artifact.copy()
|
||||
d['name'] = artifact_name
|
||||
d['url'] = url
|
||||
ret.append(d)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue