Generic artifact upload

This is meant for the check job. Use it like this:

 # .zuul.yaml:
  - job:
    ...
    post-run: ci/post.yaml
    roles:
      - zuul: return-built-artifact
    vars:
      artifacts:
        glob: 'tarball-*.tar.xz'
        name: 'tarball'

 # ci/post.yaml:
 - hosts: all
   roles:
     - return-built-artifact

This will make sure that anything that is found in
~/zuul-output/artifacts/tarball-*.tar.xz will be uploaded to the log
server along with the change in question. The target location is right
next to job's logs, so there is no persistent registry here.

Change-Id: Ia018a58afd71333647cd317da98bb05e29bd0ab0
diff --git a/roles/return-built-artifact/tasks/main.yaml b/roles/return-built-artifact/tasks/main.yaml
new file mode 100644
index 0000000..0a1e4d1
--- /dev/null
+++ b/roles/return-built-artifact/tasks/main.yaml
@@ -0,0 +1,14 @@
+- name: find artifact name
+  find:
+    paths: '{{ ansible_user_dir }}/zuul-output/artifacts'
+    patterns: '{{ artifacts.glob }}'
+  register: found_artifacts
+
+- name: return artifacts to Zuul
+  zuul_return:
+    data:
+      zuul:
+        artifacts:
+          - name: '{{ artifacts.name }}'
+            url: 'artifacts/{{ item.path | basename }}'
+  loop: '{{ found_artifacts.files }}'