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